UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

42 lines 2.32 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as BindingsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings'; import * as ContentAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/content'; import * as SettingsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/settings'; import { maybeMultipartFormRequestOptions } from 'cloudflare/core'; export class Scripts extends APIResource { constructor() { super(...arguments); this.content = new ContentAPI.Content(this._client); this.settings = new SettingsAPI.Settings(this._client); this.bindings = new BindingsAPI.Bindings(this._client); } /** * Upload a worker module to a Workers for Platforms namespace. */ update(dispatchNamespace, scriptName, params, options) { const { account_id, ...body } = params; return this._client.put(`/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}`, maybeMultipartFormRequestOptions({ body, ...options }))._thenUnwrap((obj) => obj.result); } /** * Delete a worker from a Workers for Platforms namespace. This call has no * response body on a successful delete. */ delete(dispatchNamespace, scriptName, params, options) { const { account_id, force } = params; return this._client.delete(`/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}`, { query: { force }, ...options, headers: { Accept: '*/*', ...options?.headers } }); } /** * Fetch information about a script uploaded to a Workers for Platforms namespace. */ get(dispatchNamespace, scriptName, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}`, options)._thenUnwrap((obj) => obj.result); } } (function (Scripts) { Scripts.Content = ContentAPI.Content; Scripts.Settings = SettingsAPI.Settings; Scripts.Bindings = BindingsAPI.Bindings; })(Scripts || (Scripts = {})); //# sourceMappingURL=scripts.mjs.map