cloudflare
Version:
The official TypeScript library for the Cloudflare API
49 lines • 2.09 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 BaseScriptAndVersionSettings = /* @__PURE__ */ (() => {
class BaseScriptAndVersionSettings extends APIResource {
/**
* Patch Worker script metadata or config, such as bindings or usage model.
*
* @example
* ```ts
* const response =
* await client.workers.scripts.scriptAndVersionSettings.edit(
* 'this-is_my_script-01',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
edit(scriptName, params, options) {
const { account_id, ...body } = params;
return this._client.patch(path `/accounts/${account_id}/workers/scripts/${scriptName}/settings`, multipartFormRequestOptions({ body, ...options }, this._client))._thenUnwrap((obj) => obj.result);
}
/**
* Get Worker script metadata and config, such as bindings or usage model.
*
* @example
* ```ts
* const scriptAndVersionSetting =
* await client.workers.scripts.scriptAndVersionSettings.get(
* 'this-is_my_script-01',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(scriptName, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/workers/scripts/${scriptName}/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseScriptAndVersionSettings._key = Object.freeze([
'workers',
'scripts',
'scriptAndVersionSettings',
]);
return BaseScriptAndVersionSettings;
})();
export class ScriptAndVersionSettings extends BaseScriptAndVersionSettings {
}
//# sourceMappingURL=script-and-version-settings.mjs.map