cloudflare
Version:
The official TypeScript library for the Cloudflare API
54 lines • 2.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScriptAndVersionSettings = exports.BaseScriptAndVersionSettings = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const uploads_1 = require("../../../internal/uploads.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseScriptAndVersionSettings = /* @__PURE__ */ (() => {
class BaseScriptAndVersionSettings extends resource_1.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((0, path_1.path) `/accounts/${account_id}/workers/scripts/${scriptName}/settings`, (0, uploads_1.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((0, path_1.path) `/accounts/${account_id}/workers/scripts/${scriptName}/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseScriptAndVersionSettings._key = Object.freeze([
'workers',
'scripts',
'scriptAndVersionSettings',
]);
return BaseScriptAndVersionSettings;
})();
exports.BaseScriptAndVersionSettings = BaseScriptAndVersionSettings;
class ScriptAndVersionSettings extends BaseScriptAndVersionSettings {
}
exports.ScriptAndVersionSettings = ScriptAndVersionSettings;
//# sourceMappingURL=script-and-version-settings.js.map