// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import * as BindingsAPI from 'cloudflare/resources/workers/scripts/bindings';
import * as ContentAPI from 'cloudflare/resources/workers/scripts/content';
import * as ContentV2API from 'cloudflare/resources/workers/scripts/content-v2';
import * as SchedulesAPI from 'cloudflare/resources/workers/scripts/schedules';
import * as SettingsAPI from 'cloudflare/resources/workers/scripts/settings';
import * as TailAPI from 'cloudflare/resources/workers/scripts/tail';
import * as UsageModelAPI from 'cloudflare/resources/workers/scripts/usage-model';
import { maybeMultipartFormRequestOptions } from 'cloudflare/core';
export class Scripts extends APIResource {
    constructor() {
        super(...arguments);
        this.bindings = new BindingsAPI.Bindings(this._client);
        this.schedules = new SchedulesAPI.Schedules(this._client);
        this.tail = new TailAPI.Tail(this._client);
        this.usageModel = new UsageModelAPI.UsageModel(this._client);
        this.content = new ContentAPI.Content(this._client);
        this.contentV2 = new ContentV2API.ContentV2(this._client);
        this.settings = new SettingsAPI.Settings(this._client);
    }
    /**
     * Upload a worker module.
     */
    update(scriptName, params, options) {
        const { account_id, rollback_to, ...body } = params;
        return this._client.put(`/accounts/${account_id}/workers/scripts/${scriptName}`, maybeMultipartFormRequestOptions({ query: { rollback_to }, body, ...options }))._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetch a list of uploaded workers.
     */
    list(params, options) {
        const { account_id } = params;
        return this._client.get(`/accounts/${account_id}/workers/scripts`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Delete your worker. This call has no response body on a successful delete.
     */
    delete(scriptName, params, options) {
        const { account_id, force } = params;
        return this._client.delete(`/accounts/${account_id}/workers/scripts/${scriptName}`, {
            query: { force },
            ...options,
            headers: { Accept: '*/*', ...options?.headers },
        });
    }
    /**
     * Fetch raw script content for your worker. Note this is the original script
     * content, not JSON encoded.
     */
    get(scriptName, params, options) {
        const { account_id } = params;
        return this._client.get(`/accounts/${account_id}/workers/scripts/${scriptName}`, {
            ...options,
            __binaryResponse: true,
        });
    }
}
(function (Scripts) {
    Scripts.Bindings = BindingsAPI.Bindings;
    Scripts.Schedules = SchedulesAPI.Schedules;
    Scripts.Tail = TailAPI.Tail;
    Scripts.UsageModel = UsageModelAPI.UsageModel;
    Scripts.Content = ContentAPI.Content;
    Scripts.ContentV2 = ContentV2API.ContentV2;
    Scripts.Settings = SettingsAPI.Settings;
})(Scripts || (Scripts = {}));
//# sourceMappingURL=scripts.mjs.map