@jesseditson/dnsimple
Version:
A Node.JS client for the DNSimple API.
248 lines (247 loc) • 9.55 kB
TypeScript
import type { DNSimple, QueryParams } from "./main";
import type * as types from "./types";
export declare class Zones {
private readonly _client;
constructor(_client: DNSimple);
/**
* Activate DNS resolution for the zone in the account.
*
* PUT /{account}/zones/{zone}/activation
*
* @see https://developer.dnsimple.com/v2/zones/#activateZoneService
*
* @param account The account id
* @param zone The zone name
*/
activateDns: (account: number, zone: string, params?: QueryParams & {}) => Promise<{
data: types.Zone;
}>;
/**
* Deativate DNS resolution for the zone in the account.
*
* DELETE /{account}/zones/{zone}/activation
*
* @see https://developer.dnsimple.com/v2/zones/#deactivateZoneService
*
* @param account The account id
* @param zone The zone name
*/
deactivateDns: (account: number, zone: string, params?: QueryParams & {}) => Promise<{
data: types.Zone;
}>;
/**
* Lists the zones in the account.
*
* This API is paginated. Call `listZones.iterateAll(account, params)` to get an asynchronous iterator over individual items across all pages. You can also use `await listZones.collectAll(account, params)` to quickly retrieve all items across all pages into an array. We suggest using `iterateAll` when possible, as `collectAll` will make all requests at once, which may increase latency and trigger rate limits.
*
* GET /{account}/zones
*
* @see https://developer.dnsimple.com/v2/zones/#listZones
*
* @param account The account id
* @param params Query parameters
* @param params.name_like Only include results with a name field containing the given string
* @param params.sort Sort results. Default sorting is by name ascending.
*/
listZones: {
(account: number, params?: QueryParams & {
name_like?: string;
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc";
}): Promise<{
data: Array<types.Zone>;
pagination: types.Pagination;
}>;
iterateAll(account: number, params?: QueryParams & {
name_like?: string;
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc";
}): AsyncGenerator<types.Zone, any, any>;
collectAll(account: number, params?: QueryParams & {
name_like?: string;
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc";
}): Promise<types.Zone[]>;
};
/**
* Retrieves the details of an existing zone.
*
* GET /{account}/zones/{zone}
*
* @see https://developer.dnsimple.com/v2/zones/#getZone
*
* @param account The account id
* @param zone The zone name
* @param params Query parameters
*/
getZone: (account: number, zone: string, params?: QueryParams & {}) => Promise<{
data: types.Zone;
}>;
/**
* Download the zonefile for an existing zone.
*
* GET /{account}/zones/{zone}/file
*
* @see https://developer.dnsimple.com/v2/zones/#getZoneFile
*
* @param account The account id
* @param zone The zone name
* @param params Query parameters
*/
getZoneFile: (account: number, zone: string, params?: QueryParams & {}) => Promise<{
data: types.ZoneFile;
}>;
/**
* Checks if a zone is fully distributed to all our name servers across the globe.
*
* GET /{account}/zones/{zone}/distribution
*
* @see https://developer.dnsimple.com/v2/zones/#checkZoneDistribution
*
* @param account The account id
* @param zone The zone name
* @param params Query parameters
*/
checkZoneDistribution: (account: number, zone: string, params?: QueryParams & {}) => Promise<{
data: types.ZoneDistribution;
}>;
/**
* Updates the zone's NS records
*
* PUT /{account}/zones/{zone}/ns_records
*
* @see https://developer.dnsimple.com/v2/zones/#updateZoneNsRecords
*
* @param account The account id
* @param zone The zone name
* @param params Query parameters
*/
updateZoneNsRecords: (account: number, zone: string, data: Partial<{
ns_names: Array<string>;
ns_set_ids: Array<number>;
}>, params?: QueryParams & {}) => Promise<{
data: Array<types.ZoneRecord>;
}>;
/**
* Lists the records for a zone.
*
* This API is paginated. Call `listZoneRecords.iterateAll(account, zone, params)` to get an asynchronous iterator over individual items across all pages. You can also use `await listZoneRecords.collectAll(account, zone, params)` to quickly retrieve all items across all pages into an array. We suggest using `iterateAll` when possible, as `collectAll` will make all requests at once, which may increase latency and trigger rate limits.
*
* GET /{account}/zones/{zone}/records
*
* @see https://developer.dnsimple.com/v2/zones/#listZoneRecords
*
* @param account The account id
* @param zone The zone name
* @param params Query parameters
* @param params.name_like Only include results with a name field containing the given string
* @param params.name Only include results with a name field exactly matching the given string
* @param params.type Only include results with a type field exactly matching the given string
* @param params.sort Sort results. Default sorting is by name ascending.
*/
listZoneRecords: {
(account: number, zone: string, params?: QueryParams & {
name_like?: string;
name?: string;
type?: string;
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "content:asc" | "content:desc" | "type:asc" | "type:desc";
}): Promise<{
data: Array<types.ZoneRecord>;
pagination: types.Pagination;
}>;
iterateAll(account: number, zone: string, params?: QueryParams & {
name_like?: string;
name?: string;
type?: string;
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "content:asc" | "content:desc" | "type:asc" | "type:desc";
}): AsyncGenerator<types.ZoneRecord, any, any>;
collectAll(account: number, zone: string, params?: QueryParams & {
name_like?: string;
name?: string;
type?: string;
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "content:asc" | "content:desc" | "type:asc" | "type:desc";
}): Promise<types.ZoneRecord[]>;
};
/**
* Creates a new zone record.
*
* POST /{account}/zones/{zone}/records
*
* @see https://developer.dnsimple.com/v2/zones/#createZoneRecord
*
* @param account The account id
* @param zone The zone name
* @param params Query parameters
*/
createZoneRecord: (account: number, zone: string, data: Partial<{
name: string;
type: types.ZoneRecordType;
content: string;
ttl: number;
priority: number;
regions: Array<types.ZoneRecordRegion>;
}>, params?: QueryParams & {}) => Promise<{
data: types.ZoneRecord;
}>;
/**
* Retrieves the details of an existing zone record.
*
* GET /{account}/zones/{zone}/records/{zonerecord}
*
* @see https://developer.dnsimple.com/v2/zones/#getZoneRecord
*
* @param account The account id
* @param zone The zone name
* @param zonerecord The zone record id
* @param params Query parameters
*/
getZoneRecord: (account: number, zone: string, zonerecord: number, params?: QueryParams & {}) => Promise<{
data: types.ZoneRecord;
}>;
/**
* Updates the zone record details.
*
* PATCH /{account}/zones/{zone}/records/{zonerecord}
*
* @see https://developer.dnsimple.com/v2/zones/#updateZoneRecord
*
* @param account The account id
* @param zone The zone name
* @param zonerecord The zone record id
* @param params Query parameters
*/
updateZoneRecord: (account: number, zone: string, zonerecord: number, data: Partial<{
name: string;
content: string;
ttl: number;
priority: number;
regions: Array<types.ZoneRecordRegion>;
}>, params?: QueryParams & {}) => Promise<{
data: types.ZoneRecord;
}>;
/**
* Permanently deletes a zone record.
*
* DELETE /{account}/zones/{zone}/records/{zonerecord}
*
* @see https://developer.dnsimple.com/v2/zones/#deleteZoneRecord
*
* @param account The account id
* @param zone The zone name
* @param zonerecord The zone record id
* @param params Query parameters
*/
deleteZoneRecord: (account: number, zone: string, zonerecord: number, params?: QueryParams & {}) => Promise<{}>;
/**
* Checks if a zone record is fully distributed to all our name servers across the globe.
*
* GET /{account}/zones/{zone}/records/{zonerecord}/distribution
*
* @see https://developer.dnsimple.com/v2/zones/#checkZoneRecordDistribution
*
* @param account The account id
* @param zone The zone name
* @param zonerecord The zone record id
* @param params Query parameters
*/
checkZoneRecordDistribution: (account: number, zone: string, zonerecord: number, params?: QueryParams & {}) => Promise<{
data: types.ZoneDistribution;
}>;
}