cloudflare
Version:
The official TypeScript library for the Cloudflare API
67 lines • 3.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Workflows = exports.BaseWorkflows = 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 VersionsAPI = tslib_1.__importStar(require("./versions.js"));
const versions_1 = require("./versions.js");
const InstancesAPI = tslib_1.__importStar(require("./instances/instances.js"));
const instances_1 = require("./instances/instances.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseWorkflows = /* @__PURE__ */ (() => {
class BaseWorkflows extends resource_1.APIResource {
/**
* Creates a new workflow or updates an existing workflow definition.
*/
update(workflowName, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/workflows/${workflowName}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists all workflows configured for the account.
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/workflows`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes a Workflow. This only deletes the Workflow and does not delete or modify
* any Worker associated to this Workflow or bounded to it.
*/
delete(workflowName, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/workflows/${workflowName}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves configuration and metadata for a specific workflow.
*/
get(workflowName, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/workflows/${workflowName}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseWorkflows._key = Object.freeze(['workflows']);
return BaseWorkflows;
})();
exports.BaseWorkflows = BaseWorkflows;
var Workflows = /* @__PURE__ */ (() => {
class Workflows extends BaseWorkflows {
constructor() {
super(...arguments);
this.instances = new InstancesAPI.Instances(this._client);
this.versions = new VersionsAPI.Versions(this._client);
}
}
Workflows.Instances = instances_1.Instances;
Workflows.BaseInstances = instances_1.BaseInstances;
Workflows.Versions = versions_1.Versions;
Workflows.BaseVersions = versions_1.BaseVersions;
return Workflows;
})();
exports.Workflows = Workflows;
//# sourceMappingURL=workflows.js.map