cloudflare
Version:
The official TypeScript library for the Cloudflare API
53 lines • 2.38 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../../core/resource.mjs";
import { multipartFormRequestOptions } from "../../../../../internal/uploads.mjs";
import { path } from "../../../../../internal/utils/path.mjs";
export var BaseSettings = /* @__PURE__ */ (() => {
class BaseSettings extends APIResource {
/**
* Patch metadata for a script uploaded to a Workers for Platforms dispatch
* namespace, such as bindings.
*
* @example
* ```ts
* const response =
* await client.workersForPlatforms.dispatch.namespaces.scripts.settings.edit(
* 'this-is_my_script-01',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* dispatch_namespace: 'my-dispatch-namespace',
* },
* );
* ```
*/
edit(scriptName, params, options) {
const { account_id, dispatch_namespace, ...body } = params;
return this._client.patch(path `/accounts/${account_id}/workers/dispatch/namespaces/${dispatch_namespace}/scripts/${scriptName}/settings`, multipartFormRequestOptions({ body, ...options }, this._client))._thenUnwrap((obj) => obj.result);
}
/**
* Get settings for a script uploaded to a Workers for Platforms dispatch
* namespace.
*
* @example
* ```ts
* const setting =
* await client.workersForPlatforms.dispatch.namespaces.scripts.settings.get(
* 'this-is_my_script-01',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* dispatch_namespace: 'my-dispatch-namespace',
* },
* );
* ```
*/
get(scriptName, params, options) {
const { account_id, dispatch_namespace } = params;
return this._client.get(path `/accounts/${account_id}/workers/dispatch/namespaces/${dispatch_namespace}/scripts/${scriptName}/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSettings._key = Object.freeze(['workersForPlatforms', 'dispatch', 'namespaces', 'scripts', 'settings']);
return BaseSettings;
})();
export class Settings extends BaseSettings {
}
//# sourceMappingURL=settings.mjs.map