UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

49 lines 2.12 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as NamespacesAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/namespaces'; import * as ScriptsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts'; import { SinglePage } from 'cloudflare/pagination'; export class Namespaces extends APIResource { constructor() { super(...arguments); this.scripts = new ScriptsAPI.Scripts(this._client); } /** * Create a new Workers for Platforms namespace. */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/workers/dispatch/namespaces`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetch a list of Workers for Platforms namespaces. */ list(params, options) { const { account_id } = params; return this._client.getAPIList(`/accounts/${account_id}/workers/dispatch/namespaces`, NamespaceListResponsesSinglePage, options); } /** * Delete a Workers for Platforms namespace. */ delete(dispatchNamespace, params, options) { const { account_id } = params; return this._client.delete(`/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}`, options)._thenUnwrap((obj) => obj.result); } /** * Fetch a Workers for Platforms namespace. */ get(dispatchNamespace, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}`, options)._thenUnwrap((obj) => obj.result); } } export class NamespaceListResponsesSinglePage extends SinglePage { } (function (Namespaces) { Namespaces.NamespaceListResponsesSinglePage = NamespacesAPI.NamespaceListResponsesSinglePage; Namespaces.Scripts = ScriptsAPI.Scripts; })(Namespaces || (Namespaces = {})); //# sourceMappingURL=namespaces.mjs.map