UNPKG

4.16 kBTypeScriptView Raw
1import type { RawAxiosRequestHeaders } from 'axios';
2import type { GetWorkflowDefinitionParams, GetSpaceEnvironmentParams, CollectionProp } from '../../common-types';
3import type { OptionalDefaults } from '../wrappers/wrap';
4import type { CreateWorkflowDefinitionParams, CreateWorkflowDefinitionProps, DeleteWorkflowDefinitionParams, UpdateWorkflowDefinitionParams, UpdateWorkflowDefinitionProps, WorkflowDefinitionProps, WorkflowDefinitionQueryOptions } from '../../entities/workflow-definition';
5export type WorkflowDefinitionPlainClientAPI = {
6 /**
7 * Fetch a Workflow Definition
8 * @param params entity IDs to identify the Workflow Definition
9 * @returns the Workflow Definition
10 * @throws if the request fails, or the Space/Environment is not found
11 * @example
12 * ```javascript
13 * const workflowDefinition = await client.workflowDefinition.get({
14 * spaceId: '<space_id>',
15 * environmentId: '<environment_id>',
16 * workflowDefinitionId: '<workflow_definition_id>',
17 * });
18 * ```
19 */
20 get(params: OptionalDefaults<GetWorkflowDefinitionParams>, headers?: RawAxiosRequestHeaders): Promise<WorkflowDefinitionProps>;
21 /**
22 * Query Workflow Definitions with certain filters
23 * @param params entity IDs to identify the Space/Environment, optional query parameters to filter returned Workflow Definitions
24 * @returns an object containing the list of Workflow Definitions
25 * @throws if the request fails, or the Space/Environment is not found
26 * @example
27 * ```javascript
28 * const workflowDefinitions = await client.workflowDefinition.getMany({
29 * spaceId: '<space_id>',
30 * environmentId: '<environment_id>',
31 * query: {
32 * limit: 10,
33 * }
34 * });
35 * ```
36 * */
37 getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & {
38 query?: WorkflowDefinitionQueryOptions;
39 }>, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<WorkflowDefinitionProps>>;
40 /**
41 * Create a new Workflow Definition
42 * @param params entity IDs to identify the Space/Environment to create the Workflow Definition in
43 * @param rawData the new Workflow Definition
44 * @throws if the request fails, or the Space/Environment is not found
45 * @example
46 * ```javascript
47 * const workflowDefinition = await client.workflowDefinition.create({
48 * spaceId: '<space_id>',
49 * environmentId: '<environment_id>',
50 * }, workflowDefinitionProps);
51 * ```
52 */
53 create(params: OptionalDefaults<CreateWorkflowDefinitionParams>, rawData: CreateWorkflowDefinitionProps, headers?: RawAxiosRequestHeaders): Promise<WorkflowDefinitionProps>;
54 /**
55 * Update a Workflow Definition
56 * @param params entity IDs to identify the Space/Environment and Workflow Definition
57 * @param rawData the updated Workflow Definition
58 * @throws if the request fails, or the Space/Environment is not found
59 * @example
60 * ```javascript
61 * const updatedWorkflowDefinition = await client.workflowDefinition.update({
62 * spaceId: '<space_id>',
63 * environmentId: '<environment_id>',
64 * workflowDefinitionId: '<workflow_definition_id>',
65 * }, {
66 * ...workflowDefinition,
67 * steps: [
68 * ...workflowDefinition.steps,
69 * newStep,
70 * ]
71 * });
72 * ```
73 */
74 update(params: OptionalDefaults<UpdateWorkflowDefinitionParams>, rawData: UpdateWorkflowDefinitionProps, headers?: RawAxiosRequestHeaders): Promise<WorkflowDefinitionProps>;
75 /**
76 * Delete a Workflow Definition
77 * @param params entity IDs to identify the Space/Environment and Workflow Definition version
78 * @throws if the request fails, or the Space/Environment is not found
79 * @example
80 * ```javascript
81 * await client.workflowDefinition.delete({
82 * spaceId: '<space_id>',
83 * environmentId: '<environment_id>',
84 * workflowDefinitionId: '<workflow_definition_id>',
85 * version: 1
86 * });
87 * ```
88 */
89 delete(params: OptionalDefaults<DeleteWorkflowDefinitionParams>, headers?: RawAxiosRequestHeaders): Promise<any>;
90};