UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

76 lines • 3.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Apps = exports.BaseApps = void 0; const tslib_1 = require("../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const EvaluateAPI = tslib_1.__importStar(require("./evaluate.js")); const evaluate_1 = require("./evaluate.js"); const FlagsAPI = tslib_1.__importStar(require("./flags/flags.js")); const flags_1 = require("./flags/flags.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseApps = /* @__PURE__ */ (() => { class BaseApps extends resource_1.APIResource { /** * Creates an app. The returned `id` is used in all subsequent flag, changelog, and * evaluation requests. */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/flagship/apps`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates an app. Only `name` is mutable. */ update(appID, params, options) { const { account_id, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/flagship/apps/${appID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all Flagship apps in the account. Returns identity and audit fields only; * flag definitions are not included. */ list(params, options) { const { account_id } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/flagship/apps`, (pagination_1.SinglePage), options); } /** * Deletes an app and all its flags and changelog history. Returns 409 if any * Worker still references this app via a Flagship binding. */ delete(appID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/flagship/apps/${appID}`, options)._thenUnwrap((obj) => obj.result); } /** * Returns an app's name and audit fields. Flag definitions are not included. */ get(appID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/flagship/apps/${appID}`, options)._thenUnwrap((obj) => obj.result); } } BaseApps._key = Object.freeze(['flagship', 'apps']); return BaseApps; })(); exports.BaseApps = BaseApps; var Apps = /* @__PURE__ */ (() => { class Apps extends BaseApps { constructor() { super(...arguments); this.flags = new FlagsAPI.Flags(this._client); this.evaluate = new EvaluateAPI.Evaluate(this._client); } } Apps.Flags = flags_1.Flags; Apps.BaseFlags = flags_1.BaseFlags; Apps.Evaluate = evaluate_1.Evaluate; Apps.BaseEvaluate = evaluate_1.BaseEvaluate; return Apps; })(); exports.Apps = Apps; //# sourceMappingURL=apps.js.map