cloudflare
Version:
The official TypeScript library for the Cloudflare API
61 lines • 2.69 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as VersionsAPI from "./versions.mjs";
import { BaseVersions, Versions, } from "./versions.mjs";
import * as InstancesAPI from "./instances/instances.mjs";
import { BaseInstances, Instances, } from "./instances/instances.mjs";
import { V4PagePaginationArray } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseWorkflows = /* @__PURE__ */ (() => {
class BaseWorkflows extends APIResource {
/**
* Creates a new workflow or updates an existing workflow definition.
*/
update(workflowName, params, options) {
const { account_id, ...body } = params;
return this._client.put(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(path `/accounts/${account_id}/workflows`, (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(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(path `/accounts/${account_id}/workflows/${workflowName}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseWorkflows._key = Object.freeze(['workflows']);
return BaseWorkflows;
})();
export 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;
Workflows.BaseInstances = BaseInstances;
Workflows.Versions = Versions;
Workflows.BaseVersions = BaseVersions;
return Workflows;
})();
//# sourceMappingURL=workflows.mjs.map