cloudflare
Version:
The official TypeScript library for the Cloudflare API
70 lines • 2.96 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import * as EvaluateAPI from "./evaluate.mjs";
import { BaseEvaluate, Evaluate } from "./evaluate.mjs";
import * as FlagsAPI from "./flags/flags.mjs";
import { BaseFlags, Flags, } from "./flags/flags.mjs";
import { SinglePage } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseApps = /* @__PURE__ */ (() => {
class BaseApps extends 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(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(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(path `/accounts/${account_id}/flagship/apps`, (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(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(path `/accounts/${account_id}/flagship/apps/${appID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseApps._key = Object.freeze(['flagship', 'apps']);
return BaseApps;
})();
export 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;
Apps.BaseFlags = BaseFlags;
Apps.Evaluate = Evaluate;
Apps.BaseEvaluate = BaseEvaluate;
return Apps;
})();
//# sourceMappingURL=apps.mjs.map