UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

110 lines • 3.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Views = exports.BaseViews = 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 BaseViews = /* @__PURE__ */ (() => { class BaseViews extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/dns_settings/views`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/dns_settings/views/${viewID}`, options)._thenUnwrap((obj) => obj.result); } } BaseViews._key = Object.freeze([ 'dns', 'settings', 'account', 'views', ]); return BaseViews; })(); exports.BaseViews = BaseViews; class Views extends BaseViews { } exports.Views = Views; //# sourceMappingURL=views.js.map