// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import * as BindingsAPI from 'cloudflaredev/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings';
import * as ContentAPI from 'cloudflaredev/resources/workers-for-platforms/dispatch/namespaces/scripts/content';
import * as SecretsAPI from 'cloudflaredev/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets';
import * as SettingsAPI from 'cloudflaredev/resources/workers-for-platforms/dispatch/namespaces/scripts/settings';
import * as TagsAPI from 'cloudflaredev/resources/workers-for-platforms/dispatch/namespaces/scripts/tags';
import { maybeMultipartFormRequestOptions } from 'cloudflaredev/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);
        this.secrets = new SecretsAPI.Secrets(this._client);
        this.tags = new TagsAPI.Tags(this._client);
    }
    /**
     * Upload a worker module to a Workers for Platforms namespace. You can find an
     * example of the metadata on our docs:
     * https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
     */
    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.Secrets = SecretsAPI.Secrets;
    Scripts.SecretListResponsesSinglePage = SecretsAPI.SecretListResponsesSinglePage;
    Scripts.Tags = TagsAPI.Tags;
    Scripts.TagListResponsesSinglePage = TagsAPI.TagListResponsesSinglePage;
})(Scripts || (Scripts = {}));
//# sourceMappingURL=scripts.mjs.map