cloudflare
Version:
The official TypeScript library for the Cloudflare API
105 lines • 3.71 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import { V4PagePaginationArray, } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseViews = /* @__PURE__ */ (() => {
class BaseViews extends APIResource {
/**
* Create Internal DNS View for an account
*
* @example
* ```ts
* const view = await client.dns.settings.account.views.create(
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* name: 'my view',
* zones: ['372e67954025e0ba6aaa6d586b9e0b59'],
* },
* );
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/dns_settings/views`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List DNS Internal Views for an Account
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const viewListResponse of client.dns.settings.account.views.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/dns_settings/views`, (V4PagePaginationArray), { query, ...options });
}
/**
* Delete an existing Internal DNS View
*
* @example
* ```ts
* const view = await client.dns.settings.account.views.delete(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(viewID, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/dns_settings/views/${viewID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Update an existing Internal DNS View
*
* @example
* ```ts
* const response =
* await client.dns.settings.account.views.edit(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
edit(viewID, params, options) {
const { account_id, ...body } = params;
return this._client.patch(path `/accounts/${account_id}/dns_settings/views/${viewID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Get DNS Internal View
*
* @example
* ```ts
* const view = await client.dns.settings.account.views.get(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(viewID, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/dns_settings/views/${viewID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseViews._key = Object.freeze([
'dns',
'settings',
'account',
'views',
]);
return BaseViews;
})();
export class Views extends BaseViews {
}
//# sourceMappingURL=views.mjs.map