// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import { isRequestOptions } from 'cloudflaredev/core';
import * as AppsAPI from 'cloudflaredev/resources/spectrum/apps';
import { V4PagePaginationArray } from 'cloudflaredev/pagination';
export class Apps extends APIResource {
    /**
     * Creates a new Spectrum application from a configuration using a name for the
     * origin.
     */
    create(zone, body, options) {
        return this._client.post(`/zones/${zone}/spectrum/apps`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates a previously existing application's configuration that uses a name for
     * the origin.
     */
    update(zone, appId, body, options) {
        return this._client.put(`/zones/${zone}/spectrum/apps/${appId}`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    list(zone, query = {}, options) {
        if (isRequestOptions(query)) {
            return this.list(zone, {}, query);
        }
        return this._client.getAPIList(`/zones/${zone}/spectrum/apps`, AppListResponsesV4PagePaginationArray, {
            query,
            ...options,
        });
    }
    /**
     * Deletes a previously existing application.
     */
    delete(zone, appId, options) {
        return this._client.delete(`/zones/${zone}/spectrum/apps/${appId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Gets the application configuration of a specific application inside a zone.
     */
    get(zone, appId, options) {
        return this._client.get(`/zones/${zone}/spectrum/apps/${appId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
export class AppListResponsesV4PagePaginationArray extends V4PagePaginationArray {
}
(function (Apps) {
    Apps.AppListResponsesV4PagePaginationArray = AppsAPI.AppListResponsesV4PagePaginationArray;
})(Apps || (Apps = {}));
//# sourceMappingURL=apps.mjs.map