-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add inline docs for the plain client Workflows interfaces [EXT-…
…4927] (#2175) * docs: add inline docs for the plain client Workflows Changelog interface [EXT-4927] * docs: add inline docs for the plain client Workflow interface [EXT-4927] * docs: add inline docs for the plain client Workflow Definition interface [EXT-4927]
- Loading branch information
1 parent
61a2994
commit c2e9871
Showing
6 changed files
with
278 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { RawAxiosRequestHeaders } from 'axios' | ||
import { | ||
CollectionProp, | ||
GetAppDefinitionParams, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { RawAxiosRequestHeaders } from 'axios' | ||
import { | ||
GetWorkflowDefinitionParams, | ||
GetSpaceEnvironmentParams, | ||
CollectionProp, | ||
} from '../../common-types' | ||
import { | ||
WorkflowDefinitionProps, | ||
WorkflowDefinitionQueryOptions, | ||
CreateWorkflowDefinitionParams, | ||
CreateWorkflowDefinitionProps, | ||
UpdateWorkflowDefinitionParams, | ||
UpdateWorkflowDefinitionProps, | ||
DeleteWorkflowDefinitionParams, | ||
} from '../../export-types' | ||
import { OptionalDefaults } from '../wrappers/wrap' | ||
import { CreateOrUpdate } from './base' | ||
|
||
export type WorkflowDefinitionPlainClientAPI = { | ||
/** | ||
* Fetch a Workflow Definition | ||
* @param params entity IDs to identify the Workflow Definition | ||
* @returns the Workflow Definition | ||
* @throws if the request fails, or the Space/Environment is not found | ||
* @example | ||
* ```javascript | ||
* const workflowDefinition = await client.workflowDefinition.get({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* workflowDefinitionId: '<workflow_definition_id>', | ||
* }); | ||
* ``` | ||
*/ | ||
get( | ||
params: OptionalDefaults<GetWorkflowDefinitionParams>, | ||
headers?: RawAxiosRequestHeaders | ||
): Promise<WorkflowDefinitionProps> | ||
/** | ||
* Query Workflow Definitions with certain filters | ||
* @param params entity IDs to identify the Space/Environment, optional query parameters to filter returned Workflow Definitions | ||
* @returns an object containing the list of Workflow Definitions | ||
* @throws if the request fails, or the Space/Environment is not found | ||
* @example | ||
* ```javascript | ||
* const workflowDefinitions = await client.workflowDefinition.getMany({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* query: { | ||
* limit: 10, | ||
* } | ||
* }); | ||
* ``` | ||
* */ | ||
getMany( | ||
params: OptionalDefaults< | ||
GetSpaceEnvironmentParams & { query?: WorkflowDefinitionQueryOptions } | ||
>, | ||
headers?: RawAxiosRequestHeaders | ||
): Promise<CollectionProp<WorkflowDefinitionProps>> | ||
/** | ||
* Create a new Workflow Definition | ||
* @param params entity IDs to identify the Space/Environment to create the Workflow Definition in | ||
* @param rawData the new Workflow Definition | ||
* @throws if the request fails, or the Space/Environment is not found | ||
* @example | ||
* ```javascript | ||
* const workflowDefinition = await client.workflowDefinition.create({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* }, workflowDefinitionProps); | ||
* ``` | ||
*/ | ||
create: CreateOrUpdate< | ||
CreateWorkflowDefinitionParams, | ||
CreateWorkflowDefinitionProps, | ||
WorkflowDefinitionProps | ||
> | ||
/** | ||
* Update a Workflow Definition | ||
* @param params entity IDs to identify the Space/Environment and Workflow Definition | ||
* @param rawData the updated Workflow Definition | ||
* @throws if the request fails, or the Space/Environment is not found | ||
* @example | ||
* ```javascript | ||
* const updatedWorkflowDefinition = await client.workflowDefinition.update({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* workflowDefinitionId: '<workflow_definition_id>', | ||
* }, { | ||
* ...workflowDefinition, | ||
* steps: [ | ||
* ...workflowDefinition.steps, | ||
* newStep, | ||
* ] | ||
* }); | ||
* ``` | ||
*/ | ||
update: CreateOrUpdate< | ||
UpdateWorkflowDefinitionParams, | ||
UpdateWorkflowDefinitionProps, | ||
WorkflowDefinitionProps | ||
> | ||
/** | ||
* Delete a Workflow Definition | ||
* @param params entity IDs to identify the Space/Environment and Workflow Definition version | ||
* @throws if the request fails, or the Space/Environment is not found | ||
* @example | ||
* ```javascript | ||
* await client.workflowDefinition.delete({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* workflowDefinitionId: '<workflow_definition_id>', | ||
* version: 1 | ||
* }); | ||
* ``` | ||
*/ | ||
delete( | ||
params: OptionalDefaults<DeleteWorkflowDefinitionParams>, | ||
headers?: RawAxiosRequestHeaders | ||
): Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { RawAxiosRequestHeaders } from 'axios' | ||
import { GetSpaceEnvironmentParams, CollectionProp } from '../../common-types' | ||
import { | ||
CreateWorkflowParams, | ||
UpdateWorkflowParams, | ||
CompleteWorkflowParams, | ||
} from '../../entities/workflow' | ||
import { | ||
WorkflowQueryOptions, | ||
WorkflowProps, | ||
CreateWorkflowProps, | ||
UpdateWorkflowProps, | ||
DeleteWorkflowParams, | ||
} from '../../export-types' | ||
import { OptionalDefaults } from '../wrappers/wrap' | ||
import { CreateOrUpdate } from './base' | ||
|
||
export type WorkflowPlainClientAPI = { | ||
/** | ||
* Query Workflows with certain filters | ||
* @param params entity IDs to identify the Space/Environment, optional query parameters to filter returned Workflows | ||
* @returns an object containing the list of Workflows | ||
* @throws if the request fails, or the Space/Environment is not found | ||
* @example | ||
* ```javascript | ||
* const workflows = await client.workflow.getMany({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* query: { | ||
* limit: 10 | ||
* } | ||
* }); | ||
* ``` | ||
*/ | ||
getMany( | ||
params: OptionalDefaults<GetSpaceEnvironmentParams & { query?: WorkflowQueryOptions }>, | ||
headers?: RawAxiosRequestHeaders | ||
): Promise<CollectionProp<WorkflowProps>> | ||
/** | ||
* Start a Workflow | ||
* @param params entity IDs to identify the Space/Environment | ||
* @param rawData the Workflow configuration, including the entity to start the Workflow on and the Workflow Definition to use | ||
* @returns the created Workflow | ||
* @throws if the request fails | ||
* @example | ||
* ```javascript | ||
* const workflow = await client.workflow.create({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* }, { | ||
* entity: { | ||
* sys: { | ||
* type: 'Link', | ||
* linkType: 'Entry', | ||
* id: '<entry_id>' | ||
* } | ||
* }, | ||
* workflowDefinition: { | ||
* sys: { | ||
* type: 'Link', | ||
* linkType: 'WorkflowDefinition', | ||
* id: <workflow_definition_id> | ||
* } | ||
* } | ||
* }); | ||
* ``` | ||
*/ | ||
create: CreateOrUpdate<CreateWorkflowParams, CreateWorkflowProps, WorkflowProps> | ||
/** | ||
* Update a Workflow (i.e. move to another step) | ||
* @param params entity IDs to identify the Space/Environment and Workflow | ||
* @param rawData the step to move to | ||
* @returns the updated Workflow | ||
* @throws if the request fails | ||
* @example | ||
* ```javascript | ||
* const workflow = await client.workflow.update({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* workflowId: '<workflow_id>', | ||
* }, { | ||
* stepId: '<step_id>' | ||
* }); | ||
* ``` | ||
*/ | ||
update: CreateOrUpdate<UpdateWorkflowParams, UpdateWorkflowProps, WorkflowProps> | ||
/** | ||
* Delete a Workflow | ||
* @param params entity IDs to identify the Space/Environment and Workflow | ||
* @throws if the request fails | ||
* @example | ||
* ```javascript | ||
* await client.workflow.delete({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* workflowId: '<workflow_id>', | ||
* }); | ||
* ``` | ||
*/ | ||
delete( | ||
params: OptionalDefaults<DeleteWorkflowParams>, | ||
headers?: RawAxiosRequestHeaders | ||
): Promise<void> | ||
/** | ||
* Complete a Workflow, allowing a new one to be created for the same entry | ||
* @param params entity IDs to identify the Space/Environment and Workflow | ||
* @throws if the request fails | ||
* @example | ||
* ```javascript | ||
* await client.workflow.complete({ | ||
* spaceId: '<space_id>', | ||
* environmentId: '<environment_id>', | ||
* workflowId: '<workflow_id>', | ||
* }); | ||
* ``` | ||
*/ | ||
complete( | ||
params: OptionalDefaults<CompleteWorkflowParams>, | ||
headers?: RawAxiosRequestHeaders | ||
): Promise<void> | ||
} |
Oops, something went wrong.