cloudflare
Version:
The official TypeScript library for the Cloudflare API
58 lines • 2.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = exports.BaseSettings = 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 BaseSettings = /* @__PURE__ */ (() => {
class BaseSettings extends resource_1.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((0, path_1.path) `/accounts/${account_id}/workers/dispatch/namespaces/${dispatch_namespace}/scripts/${scriptName}/settings`, (0, uploads_1.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((0, path_1.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;
})();
exports.BaseSettings = BaseSettings;
class Settings extends BaseSettings {
}
exports.Settings = Settings;
//# sourceMappingURL=settings.js.map