File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,44 @@ interface Domain {
2626 renewal_date : string ;
2727}
2828
29- // @todo implementare contact
29+ interface ContactRequest {
30+ name ?: string ;
31+ org ?: string ;
32+ street ?: string ;
33+ city ?: string ;
34+ province ?: string ;
35+ postalcode ?: string ;
36+ countrycode ?: string ;
37+ voice ?: string ;
38+ email ?: string ;
39+ nationalitycode ?: string ;
40+ }
41+
42+ interface Contact {
43+ status : string [ ] ;
44+ handle : string ;
45+ name : string ;
46+ org : string ;
47+ street : string ;
48+ street2 : string ;
49+ street3 : string ;
50+ city : string ;
51+ province : string ;
52+ postalcode : string ;
53+ countrycode : string ;
54+ voice : string ;
55+ fax : string ;
56+ email : string ;
57+ authinfo : string ;
58+ consentforpublishing : number ;
59+ nationalitycode : string ;
60+ entitytype : number ;
61+ regcode : string ;
62+ schoolcode : string ;
63+ owner : string ;
64+ timestamp : number ;
65+ }
66+
3067export class Domains implements Service {
3168 client : AxiosInstance ;
3269 readonly service = 'domains' ;
@@ -66,6 +103,27 @@ export class Domains implements Service {
66103 return await ( await this . client . delete ( this . url + '/domain/' + domain + '/tech/' + techId ) ) . data . data ;
67104 }
68105
106+ // Contacts
107+ async listContacts ( ) : Promise < string [ ] > {
108+ return await ( await this . client . get ( this . url + '/contact' ) ) . data . data ;
109+ }
110+ async createContact ( data : ContactRequest ) {
111+ return await ( await this . client . post ( this . url + '/contact' , JSON . stringify ( data ) ) ) . data ;
112+ }
113+
114+ async getContact ( id : string ) : Promise < Contact > {
115+ return await ( await this . client . get ( this . url + '/contact/' + id ) ) . data . data ;
116+ }
117+
118+ async updateContact ( id : string , data : ContactRequest ) {
119+ return await ( await this . client . put ( this . url + '/contact/' + id , JSON . stringify ( data ) ) ) . data ;
120+ }
121+
122+ async deleteContact ( id : string ) {
123+ return await ( await this . client . delete ( this . url + '/contact/' + id ) ) . data . data ;
124+ }
125+
126+
69127 get url ( ) {
70128 return getBaseUrl ( this . environment , this . baseUrl )
71129 }
You can’t perform that action at this time.
0 commit comments