UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

71 lines • 2.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CustomNameservers = exports.BaseCustomNameservers = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseCustomNameservers = /* @__PURE__ */ (() => { class BaseCustomNameservers extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/custom_ns/${customNSID}`, (pagination_1.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((0, path_1.path) `/accounts/${account_id}/custom_ns`, (pagination_1.SinglePage), options); } } BaseCustomNameservers._key = Object.freeze([ 'customNameservers', ]); return BaseCustomNameservers; })(); exports.BaseCustomNameservers = BaseCustomNameservers; class CustomNameservers extends BaseCustomNameservers { } exports.CustomNameservers = CustomNameservers; //# sourceMappingURL=custom-nameservers.js.map