cloudflare
Version:
The official TypeScript library for the Cloudflare API
64 lines • 2.43 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 BaseTenantCustomNameservers = /* @__PURE__ */ (() => {
class BaseTenantCustomNameservers extends 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(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(path `/tenants/${tenant_tag}/custom_ns/${customNSID}`, (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(path `/tenants/${tenantTag}/custom_ns`, (SinglePage), options);
}
}
BaseTenantCustomNameservers._key = Object.freeze([
'tenantCustomNameservers',
]);
return BaseTenantCustomNameservers;
})();
export class TenantCustomNameservers extends BaseTenantCustomNameservers {
}
//# sourceMappingURL=tenant-custom-nameservers.mjs.map