@jesseditson/dnsimple
Version:
A Node.JS client for the DNSimple API.
93 lines (92 loc) • 4.03 kB
TypeScript
import type { DNSimple, QueryParams } from "./main";
import type * as types from "./types";
export declare class Services {
private readonly _client;
constructor(_client: DNSimple);
/**
* List all available one-click services.
*
* This API is paginated. Call `listServices.iterateAll(params)` to get an asynchronous iterator over individual items across all pages. You can also use `await listServices.collectAll(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 /services
*
* @see https://developer.dnsimple.com/v2/services/#listServices
*
* @param params Query parameters
* @param params.sort Sort results. Default sorting is by id ascending.
*/
listServices: {
(params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "sid:asc" | "sid:desc";
}): Promise<{
data: Array<types.Service>;
pagination: types.Pagination;
}>;
iterateAll(params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "sid:asc" | "sid:desc";
}): AsyncGenerator<types.Service, any, any>;
collectAll(params?: QueryParams & {
sort?: "id:asc" | "id:desc" | "sid:asc" | "sid:desc";
}): Promise<types.Service[]>;
};
/**
* Retrieves the details of a one-click service.
*
* GET /services/{service}
*
* @see https://developer.dnsimple.com/v2/services/#getService
*
* @param service The service sid or id
* @param params Query parameters
*/
getService: (service: string, params?: QueryParams & {}) => Promise<{
data: types.Service;
}>;
/**
* List services applied to a domain.
*
* This API is paginated. Call `applyService.iterateAll(account, domain, params)` to get an asynchronous iterator over individual items across all pages. You can also use `await applyService.collectAll(account, domain, 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}/domains/{domain}/services
*
* @see https://developer.dnsimple.com/v2/services/#listDomainAppliedServices
*
* @param account The account id
* @param domain The domain name or id
* @param params Query parameters
*/
applyService: {
(account: number, domain: string, params?: QueryParams & {}): Promise<{
data: Array<types.Service>;
pagination: types.Pagination;
}>;
iterateAll(account: number, domain: string, params?: QueryParams & {}): AsyncGenerator<types.Service, any, any>;
collectAll(account: number, domain: string, params?: QueryParams & {}): Promise<types.Service[]>;
};
/**
* Applies a service to a domain.
*
* POST /{account}/domains/{domain}/services/{service}
*
* @see https://developer.dnsimple.com/v2/services/#applyServiceToDomain
*
* @param account The account id
* @param domain The domain name or id
* @param service The service sid or id
* @param params Query parameters
*/
appliedServices: (account: number, domain: string, service: string, data: Partial<{}>, params?: QueryParams & {}) => Promise<{}>;
/**
* Unapplies a service from a domain.
*
* DELETE /{account}/domains/{domain}/services/{service}
*
* @see https://developer.dnsimple.com/v2/services/#unapplyServiceFromDomain
*
* @param account The account id
* @param domain The domain name or id
* @param service The service sid or id
* @param params Query parameters
*/
unapplyService: (account: number, domain: string, service: string, params?: QueryParams & {}) => Promise<{}>;
}