@@ -57,9 +57,11 @@ After logging in to [Netcup CCP](https://www.customercontrolpanel.de/), navigate
5757
5858The default exported ` NetcupApi ` is a wrapper around the actual api. It handles authentication and passes parameters to the implemented api.
5959
60+ #### ESM
61+
6062``` javascript
6163import NetcupApi from ' netcup-node' ;
62- const api = await new Netcup ().init ({
64+ const api = await new NetcupApi ().init ({
6365 apikey: ' YOUR_API_KEY' ,
6466 apipassword: ' YOUR_API_PASSWORD' ,
6567 customernumber: ' YOUR_CUSTOMER_NUMBER' ,
@@ -84,3 +86,95 @@ const dnsRecords = await api.infoDnsRecords({
8486 domainname: ' YOUR.DOMAIN' ,
8587});
8688```
89+
90+ #### CJS
91+
92+ ``` javascript
93+ const NetcupApi = require (' netcup-node' ).default ;
94+ // or const { NetcupApi } = require('netcup-node');
95+
96+ const api = await new NetcupApi ().init ({
97+ apikey: ' YOUR_API_KEY' ,
98+ apipassword: ' YOUR_API_PASSWORD' ,
99+ customernumber: ' YOUR_CUSTOMER_NUMBER' ,
100+ });
101+ const dnsInfo = await api .infoDnsZone ({ domainname: ' YOUR.DOMAIN' });
102+ ```
103+
104+ ### Reference
105+
106+ ``` javascript
107+ /**
108+ * Initializes authentication parameters
109+ */
110+ NetcupApi .init ({
111+ apikey: ' YOUR_API_KEY' ,
112+ apipassword: ' YOUR_API_PASSWORD' ,
113+ customernumber: ' YOUR_CUSTOMER_NUMBER' ,
114+ });
115+
116+ /**
117+ * Retrieves information about a DNS zone
118+ * */
119+ NetcupApi .infoDnsZone ({
120+ domainname: ' YOUR.DOMAIN' ,
121+ });
122+
123+ /**
124+ * Retrieves information about DNS records of a domain
125+ * */
126+ NetcupApi .infoDnsRecords ({
127+ domainname: ' YOUR.DOMAIN' ,
128+ });
129+
130+ /**
131+ * Updates DNS records of a domain and only those that are specified.
132+ */
133+ NetcupApi .updateDnsRecords ({
134+ domainname: ' example.com' ,
135+ dnsrecordset: {
136+ dnsrecords: [{ name: ' www' , type: ' A' , destination: ' some-ip' }],
137+ },
138+ });
139+ // can also be used for deletion
140+ NetcupApi .updateDnsRecords ({
141+ domainname: ' example.com' ,
142+ dnsrecordset: {
143+ dnsrecords: [
144+ { name: ' www' , type: ' A' , destination: ' some-ip' , deleterecord: true },
145+ ],
146+ },
147+ });
148+
149+ /**
150+ * Updates DNS records of a domain with the current public ip.
151+ * @example
152+ * // update ipv4 only
153+ * await api .updateDnsRecordsWithCurrentIp ({ domainname: ' example.com' , dnsrecords: [{ hostname: ' www' }] })
154+ * @example
155+ * // update ipv4 and ipv6
156+ * await api .updateDnsRecordsWithCurrentIp ({ domainname: ' example.com' , dnsrecords: [{ hostname: ' www' }], useIpv4AndIpv6: true })
157+ * @example
158+ * // update ipv6 only
159+ * await api .updateDnsRecordsWithCurrentIp ({ domainname: ' example.com' , dnsrecords: [{ hostname: ' www' }], useIpv6Only: true })
160+ */
161+ // update ipv4 only
162+ NetcupApi .updateDnsRecordWithCurrentIp ({
163+ domainname: ' example.com' ,
164+ dnsrecordset: { dnsrecords: [{ hostname: ' www' }] },
165+ });
166+
167+ // update ipv4 and ipv6
168+ NetcupApi .updateDnsRecordWithCurrentIp ({
169+ domainname: ' example.com' ,
170+ dnsrecordset: { dnsrecords: [{ hostname: ' www' }] },
171+ useIpv4AndIpv6: true ,
172+ });
173+
174+ // update ipv6 only
175+ NetcupApi .updateDnsRecordWithCurrentIp ({
176+ domainname: ' example.com' ,
177+ dnsrecordset: { dnsrecords: [{ hostname: ' www' }] },
178+ useIpv6Only: true ,
179+ });
180+ ```
0 commit comments