cloudflare
Version:
The official TypeScript library for the Cloudflare API
66 lines • 2.5 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { SinglePage } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseCustomNameservers = /* @__PURE__ */ (() => {
class BaseCustomNameservers extends APIResource {
/**
* Adds a custom nameserver to the account for use as a vanity nameserver on zones.
*
* @example
* ```ts
* const customNameserver =
* await client.customNameservers.create({
* account_id: '372e67954025e0ba6aaa6d586b9e0b59',
* ns_name: 'ns1.example.com',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/custom_ns`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Removes a custom nameserver from the account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const customNameserverDeleteResponse of client.customNameservers.delete(
* 'ns1.example.com',
* { account_id: '372e67954025e0ba6aaa6d586b9e0b59' },
* )) {
* // ...
* }
* ```
*/
delete(customNSID, params, options) {
const { account_id } = params;
return this._client.getAPIList(path `/accounts/${account_id}/custom_ns/${customNSID}`, (SinglePage), { method: 'delete', ...options });
}
/**
* List an account's custom nameservers.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const customNameserver of client.customNameservers.get(
* { account_id: '372e67954025e0ba6aaa6d586b9e0b59' },
* )) {
* // ...
* }
* ```
*/
get(params, options) {
const { account_id } = params;
return this._client.getAPIList(path `/accounts/${account_id}/custom_ns`, (SinglePage), options);
}
}
BaseCustomNameservers._key = Object.freeze([
'customNameservers',
]);
return BaseCustomNameservers;
})();
export class CustomNameservers extends BaseCustomNameservers {
}
//# sourceMappingURL=custom-nameservers.mjs.map