@jesseditson/dnsimple
Version:
A Node.JS client for the DNSimple API.
178 lines (177 loc) • 7.5 kB
TypeScript
import type { DNSimple, QueryParams } from "./main";
import type * as types from "./types";
export declare class Templates {
private readonly _client;
constructor(_client: DNSimple);
/**
* Lists the templates in the account.
*
* This API is paginated. Call `listTemplates.iterateAll(account, params)` to get an asynchronous iterator over individual items across all pages. You can also use `await listTemplates.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}/templates
*
* @see https://developer.dnsimple.com/v2/templates/#listTemplates
*
* @param account The account id
* @param params Query parameters
* @param params.sort Sort results. Default sorting is by id ascending.
*/
listTemplates: {
(account: number, params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "sid:asc" | "sid:desc";
}): Promise<{
data: Array<types.Template>;
pagination: types.Pagination;
}>;
iterateAll(account: number, params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "sid:asc" | "sid:desc";
}): AsyncGenerator<types.Template, any, any>;
collectAll(account: number, params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "sid:asc" | "sid:desc";
}): Promise<types.Template[]>;
};
/**
* Creates a template.
*
* POST /{account}/templates
*
* @see https://developer.dnsimple.com/v2/templates/#createTemplate
*
* @param account The account id
* @param params Query parameters
*/
createTemplate: (account: number, data: Partial<{
sid: string;
name: string;
description: string;
}>, params?: QueryParams & {}) => Promise<{
data: types.Template;
}>;
/**
* Retrieves the details of an existing template.
*
* GET /{account}/templates/{template}
*
* @see https://developer.dnsimple.com/v2/templates/#getTemplate
*
* @param account The account id
* @param template The template id or short name
* @param params Query parameters
*/
getTemplate: (account: number, template: number | string, params?: QueryParams & {}) => Promise<{
data: types.Template;
}>;
/**
* Updates the template details.
*
* PATCH /{account}/templates/{template}
*
* @see https://developer.dnsimple.com/v2/templates/#updateTemplate
*
* @param account The account id
* @param template The template id or short name
* @param params Query parameters
*/
updateTemplate: (account: number, template: number | string, data: Partial<{
sid: string;
name: string;
description: string;
}>, params?: QueryParams & {}) => Promise<{
data: types.Template;
}>;
/**
* Permanently deletes a template.
*
* DELETE /{account}/templates/{template}
*
* @see https://developer.dnsimple.com/v2/templates/#deleteTemplate
*
* @param account The account id
* @param template The template id or short name
* @param params Query parameters
*/
deleteTemplate: (account: number, template: number | string, params?: QueryParams & {}) => Promise<{}>;
/**
* Lists the records for a template.
*
* This API is paginated. Call `listTemplateRecords.iterateAll(account, template, params)` to get an asynchronous iterator over individual items across all pages. You can also use `await listTemplateRecords.collectAll(account, template, 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}/templates/{template}/records
*
* @see https://developer.dnsimple.com/v2/templates/#listTemplateRecords
*
* @param account The account id
* @param template The template id or short name
* @param params Query parameters
* @param params.sort Sort results. Default sorting is by id ascending.
*/
listTemplateRecords: {
(account: number, template: number | string, params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "content:asc" | "content:desc" | "type:asc" | "type:desc";
}): Promise<{
data: Array<types.TemplateRecord>;
pagination: types.Pagination;
}>;
iterateAll(account: number, template: number | string, params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "content:asc" | "content:desc" | "type:asc" | "type:desc";
}): AsyncGenerator<types.TemplateRecord, any, any>;
collectAll(account: number, template: number | string, params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "name:asc" | "name:desc" | "content:asc" | "content:desc" | "type:asc" | "type:desc";
}): Promise<types.TemplateRecord[]>;
};
/**
* Creates a new template record.
*
* POST /{account}/templates/{template}/records
*
* @see https://developer.dnsimple.com/v2/templates/#createTemplateRecord
*
* @param account The account id
* @param template The template id or short name
* @param params Query parameters
*/
createTemplateRecord: (account: number, template: number | string, data: Partial<{}>, params?: QueryParams & {}) => Promise<{
data: types.TemplateRecord;
}>;
/**
* Retrieves the details of an existing template record.
*
* GET /{account}/templates/{template}/records/{templaterecord}
*
* @see https://developer.dnsimple.com/v2/templates/#getTemplateRecord
*
* @param account The account id
* @param template The template id or short name
* @param templaterecord The template record id
* @param params Query parameters
*/
getTemplateRecord: (account: number, template: number | string, templaterecord: number, params?: QueryParams & {}) => Promise<{
data: types.TemplateRecord;
}>;
/**
* Permanently deletes a template record.
*
* DELETE /{account}/templates/{template}/records/{templaterecord}
*
* @see https://developer.dnsimple.com/v2/templates/#deleteTemplateRecord
*
* @param account The account id
* @param template The template id or short name
* @param templaterecord The template record id
* @param params Query parameters
*/
deleteTemplateRecord: (account: number, template: number | string, templaterecord: number, params?: QueryParams & {}) => Promise<{}>;
/**
* Applies a template to a domain.
*
* POST /{account}/domains/{domain}/templates/{template}
*
* @see https://developer.dnsimple.com/v2/templates/#applyTemplateToDomain
*
* @param account The account id
* @param domain The domain name or id
* @param template The template id or short name
* @param params Query parameters
*/
applyTemplate: (account: number, domain: string, template: number | string, params?: QueryParams & {}) => Promise<{}>;
}