File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ export enum Actions {
22 login = 'login' ,
33 infoDnsZone = 'infoDnsZone' ,
44 infoDnsRecords = 'infoDnsRecords' ,
5+ updateDnsRecords = 'updateDnsRecords' ,
56}
Original file line number Diff line number Diff line change 1+ import { DnsRecord } from './Responses' ;
2+
13export interface AuthParam {
24 customernumber : string ;
35 apikey : string ;
@@ -30,3 +32,13 @@ export interface LoginParam {
3032 apipassword : string ;
3133 customernumber : string ;
3234}
35+
36+ export interface UpdateDNSRecordsRequest {
37+ action : string ;
38+ param : UpdateDNSRecordsParam ;
39+ }
40+
41+ export interface UpdateDNSRecordsParam extends AuthParam {
42+ domainname : string ;
43+ dnsrecordset : { dnsrecords : DnsRecord [ ] } ;
44+ }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export interface LoginResponsedata {
2323export interface InfoDNSZoneResponse {
2424 serverrequestid : string ;
2525 clientrequestid : string ;
26- action : string ;
26+ action : Actions . infoDnsZone ;
2727 status : string ;
2828 statuscode : number ;
2929 shortmessage : string ;
@@ -59,3 +59,12 @@ export interface DnsRecord {
5959 deleterecord : boolean ;
6060 state : string ;
6161}
62+
63+ export interface UpdateDNSRecordsResponse extends ApiResponse {
64+ action : Actions . updateDnsRecords ;
65+ responsedata : UpdateDNSRecordsResponseData ;
66+ }
67+
68+ interface UpdateDNSRecordsResponseData {
69+ dnsrecords : DnsRecord [ ] ;
70+ }
Original file line number Diff line number Diff line change @@ -8,11 +8,14 @@ import {
88 InfoDNSZoneRequest ,
99 LoginParam ,
1010 LoginRequest ,
11+ UpdateDNSRecordsParam ,
12+ UpdateDNSRecordsRequest ,
1113} from './@types/Requests' ;
1214import {
1315 InfoDNSRecordsResponse ,
1416 InfoDNSZoneResponse ,
1517 LoginResponse ,
18+ UpdateDNSRecordsResponse ,
1619} from './@types/Responses' ;
1720import { getFormattedUrl } from './utils' ;
1821
@@ -82,4 +85,16 @@ export default class NetcupRestApi {
8285 } ,
8386 ) ;
8487 }
88+
89+ public updateDnsRecords ( params : UpdateDNSRecordsParam ) {
90+ return this . postJson < UpdateDNSRecordsRequest , UpdateDNSRecordsResponse > (
91+ getFormattedUrl ( this . format ) ,
92+ {
93+ action : Actions . updateDnsRecords ,
94+ param : {
95+ ...params ,
96+ } ,
97+ } ,
98+ ) ;
99+ }
85100}
Original file line number Diff line number Diff line change 11import { Formats } from './@types/Formats' ;
22import { InitParams } from './@types/InitParams' ;
33import { NetcupAuth } from './@types/NetcupAuth' ;
4- import { InfoDNSRecordsParam , InfoDNSZoneParam } from './@types/Requests' ;
4+ import {
5+ InfoDNSRecordsParam ,
6+ InfoDNSZoneParam ,
7+ UpdateDNSRecordsParam ,
8+ } from './@types/Requests' ;
59import {
610 InfoDNSRecordsResponse ,
711 InfoDNSZoneResponse ,
812 LoginResponse ,
13+ UpdateDNSRecordsResponse ,
914} from './@types/Responses' ;
1015import NetcupRestApi from './api' ;
1116import { INVALID_FORMAT_ERROR , NOT_INITIALIZED_ERROR } from './constants' ;
@@ -70,6 +75,18 @@ class NetcupApi {
7075 } ) ;
7176 }
7277
78+ public async updateDnsRecords (
79+ params : Pick < UpdateDNSRecordsParam , 'dnsrecordset' | 'domainname' > ,
80+ ) : Promise < UpdateDNSRecordsResponse > {
81+ await this . checkAndRefreshAuth ( ) ;
82+ return this . restApi . updateDnsRecords ( {
83+ apisessionid : this . authData . apiSessionId ,
84+ customernumber : this . authData . customerNumber ,
85+ apikey : this . authData . apiKey ,
86+ ...params ,
87+ } ) ;
88+ }
89+
7390 public getAuthData ( ) : NetcupAuth {
7491 return this . authData ;
7592 }
You can’t perform that action at this time.
0 commit comments