cloudflare
Version:
The official TypeScript library for the Cloudflare API
69 lines • 2.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TenantCustomNameservers = exports.BaseTenantCustomNameservers = 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 BaseTenantCustomNameservers = /* @__PURE__ */ (() => {
class BaseTenantCustomNameservers extends resource_1.APIResource {
/**
* Adds a custom nameserver for a tenant.
*
* @example
* ```ts
* const tenantCustomNameserver =
* await client.tenantCustomNameservers.create(
* '699d98642c564d2e855e9661899b7252',
* { ns_name: 'ns1.example.com' },
* );
* ```
*/
create(tenantTag, body, options) {
return this._client.post((0, path_1.path) `/tenants/${tenantTag}/custom_ns`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Deletes a tenant's custom nameserver.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const tenantCustomNameserverDeleteResponse of client.tenantCustomNameservers.delete(
* 'ns1.example.com',
* { tenant_tag: '699d98642c564d2e855e9661899b7252' },
* )) {
* // ...
* }
* ```
*/
delete(customNSID, params, options) {
const { tenant_tag } = params;
return this._client.getAPIList((0, path_1.path) `/tenants/${tenant_tag}/custom_ns/${customNSID}`, (pagination_1.SinglePage), { method: 'delete', ...options });
}
/**
* Lists a tenant's custom nameservers.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const tenantCustomNameserverGetResponse of client.tenantCustomNameservers.get(
* '699d98642c564d2e855e9661899b7252',
* )) {
* // ...
* }
* ```
*/
get(tenantTag, options) {
return this._client.getAPIList((0, path_1.path) `/tenants/${tenantTag}/custom_ns`, (pagination_1.SinglePage), options);
}
}
BaseTenantCustomNameservers._key = Object.freeze([
'tenantCustomNameservers',
]);
return BaseTenantCustomNameservers;
})();
exports.BaseTenantCustomNameservers = BaseTenantCustomNameservers;
class TenantCustomNameservers extends BaseTenantCustomNameservers {
}
exports.TenantCustomNameservers = TenantCustomNameservers;
//# sourceMappingURL=tenant-custom-nameservers.js.map