-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.ts
34 lines (30 loc) · 1001 Bytes
/
dns.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { BegetRequest } from '../beget-request';
import { Methods } from '../types/controller.interface';
import { ChangeRecords, DomainInfo } from '../types/dns.interface';
// /**
// * DnsEndpoint
// * @category Endpoints
// */
export class DnsEndpoint {
constructor(private readonly client: BegetRequest) {}
/**
* @private
*/
private method<T>(method: Methods['dns'], data?: object): Promise<T> {
return this.client.api('dns', method, data);
}
/**
* Method returns information about domain from DNS server.
*/
getData(params: Pick<DomainInfo, 'fqdn'>): Promise<DomainInfo[]> {
return this.method('getData', params);
}
/**
* // TODO: change records to overloading
* Method changes DNS records for given domain.
* @returns Returns property of successful or unsuccessful execution.
*/
changeRecords(params: ChangeRecords): Promise<boolean> {
return this.method('changeRecords', params);
}
}