namecomv4
Version:
A Node.js library wrapper for Name.com's V4 API, designed to simplify domain management tasks such as querying domain information, managing DNS records, and handling domain registration and transfer.
46 lines (40 loc) • 1.71 kB
text/typescript
import AxiosClient from './AxiosClient.js';
import { DNSSEC } from './types/index.js';
export default class NameComDNSSec extends AxiosClient {
async listDNSSECs(domainName:string) {
try {
const response = await this.axiosInstance.get(`/domains/${domainName}/dnssec`);
return response.data; // Assuming the API returns the expected JSON response
} catch (error) {
// console.error('Error listing DNSSECs:', error);
throw error;
}
}
async getDNSSEC(domainName:string, digest:string) {
try {
const response = await this.axiosInstance.get(`/domains/${domainName}/dnssec/${digest}`);
return response.data; // Assuming the API returns the expected JSON response
} catch (error) {
// console.error('Error retrieving DNSSEC:', error);
throw error;
}
}
async createDNSSEC(domainName:string, dnssecData: DNSSEC) {
try {
const response = await this.axiosInstance.post(`/domains/${domainName}/dnssec`, dnssecData);
return response.data; // Assuming the API returns the expected JSON response
} catch (error) {
// console.error('Error creating DNSSEC:', error);
throw error;
}
}
async deleteDNSSEC(domainName:string, digest:string) {
try {
const response = await this.axiosInstance.delete(`/domains/${domainName}/dnssec/${digest}`);
return response.data; // Assuming the API returns an empty response on success
} catch (error) {
//console.error('Error removing DNSSEC:', error);
throw error;
}
}
}