import { NonNullablePaths } from '@wix/sdk-types'; interface Workflow { /** Workflow information and metadata. */ info?: WorkflowInfo; /** * Final phase of the workflow. * Cards in `winPhase` are treated as if they are not part of the workflow. * * Normally, a contact can be attached to only 1 card in the workflow. * Moving a contact's card to `winPhase` * frees up the contact to be attached to another card in the workflow. */ winPhase?: Phase; /** Phases that make up the workflow. */ phasesList?: PhasesList; } interface WorkflowInfo { /** * Workflow ID. * @format GUID * @readonly */ _id?: string | null; /** Display name for the workflow. */ name?: string | null; /** * Workflow description, * shown below the workflow's display name in the dashboard. */ description?: string | null; /** * @internal * @internal * @readonly * @deprecated */ createdAt?: Date | null; /** * Indicates whether the workflow can be deleted. * @readonly * @deprecated */ isDeletable?: boolean | null; /** * Date and time the workflow was created. * @readonly */ _createdDate?: Date | null; } interface Phase { /** Phase information. */ info?: PhaseInfo; /** Cards contained in the phase. */ cardsList?: CardsList; } interface PhaseInfo { /** * Phase ID. * @format GUID * @readonly */ _id?: string | null; /** Display name shown at the top of the phase. */ name?: string | null; } /** a list of cards (a page) along with the total number */ interface CardsList { /** Total number of cards in the phase. */ total?: number; /** * List of cards in the phase. * Sorted according to the card display order, from top to bottom. */ cards?: Card[]; } interface Card { /** Card details. */ info?: CardInfo; } /** entity representing a card-info */ interface CardInfo { /** * Card ID. * @format GUID * @readonly */ _id?: string | null; /** Display name shown at the top of the card. */ name?: string | null; /** Card description. */ description?: string | null; /** Details about the contact attached to the card. */ primaryAttachment?: Attachment; /** Due date. */ dueDate?: Date | null; /** Name of the app or service that created the contact. */ source?: string | null; /** * @internal * @internal * @readonly * @deprecated */ createdAt?: Date | null; /** * @internal * @internal * @readonly * @deprecated */ updatedAt?: Date | null; /** * ID of the phase that currently holds the card. * @format GUID * @readonly */ phaseId?: string | null; /** * Date and time the card was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the card was updated. * @readonly */ _updatedDate?: Date | null; } interface Attachment { /** * Attachment ID. For internal use. * @format GUID * @readonly */ attachmentId?: string; /** * @internal * @internal * @deprecated */ value?: string; /** * @internal * @internal * @deprecated */ attachmentType?: AttachmentTypeWithLiterals; /** * ID of the contact attached to the card. * @format GUID */ contactId?: string; } /** describes the supported types of attachments (currently only supports Contact which is the default type) */ declare enum AttachmentType { ContactType = "ContactType" } /** @enumType */ type AttachmentTypeWithLiterals = AttachmentType | 'ContactType'; /** a list of phases (a page) along with the total number */ interface PhasesList { /** Total number of phases in the workflow, excluding `winPhase`. */ total?: number; /** * List of phases in the workflow. * Sorted according to the phase display order, from left to right. */ phases?: Phase[]; } interface ListWorkflowsRequest { /** * Number of workflows to return. * If omitted, all results are returned. */ limit?: number | null; /** * Number of items to skip in the current sort order. * * Defaults to `0`. */ offset?: number | null; /** * Supported fields: * `id`, `name`, `description`, `createdDate` * * List of fields to sort by. * Formatted as `field:direction`, * where field is the field name * and direction is `asc` (ascending) or `desc` (descending). * * Sorting is applied lexicographically, so `"abc"` comes after `"XYZ"`. */ sort?: string[]; } interface ListWorkflowsResponse { /** Retrieved list of workflows. */ workflows?: WorkflowInfo[]; /** Metadata for the page of results. */ pagination?: PaginationResponse; } interface PaginationResponse { /** Number of items that were skipped in the current sort order. */ offset?: number; /** Total number of items that matched the filter. */ total?: number; /** Number of returned items. */ count?: number; } interface QueryWorkflowsRequest { /** Query options. */ query?: Query; } interface Query { /** * Filter object in the following format: * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }` * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` */ filter?: any; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */ fields?: string[]; /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */ fieldsets?: string[]; } interface Sorting { /** * Name of the field to sort by. * @maxLength 512 */ fieldName?: string; /** Sort order. */ order?: SortOrderWithLiterals; } declare enum SortOrder { ASC = "ASC", DESC = "DESC" } /** @enumType */ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC'; interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } interface QueryWorkflowsResponse { /** List of workflows that matched the query. */ workflows?: Workflow[]; /** Metadata for the paginated results. */ pagination?: PaginationResponse; } interface GetWorkflowRequest { /** * ID of the workflow to retrieve. * @format GUID */ _id: string; /** * Maximum number of cards to return per phase. * To retrieve additional pages of cards, use * [List Cards](../cards/listCards) * (in the Cards API). * @max 100 */ cardsPerPhase?: number | null; } interface GetWorkflowResponse { /** Requested workflow. */ workflow?: Workflow; } interface UpdateWorkflowRequest { /** * ID of the workflow to update. * @format GUID */ _id: string; /** Workflow info. */ workflow?: WorkflowInfo; } interface UpdateWorkflowResponse { } interface CreateWorkflowRequest { /** Workflow details. */ workflow?: WorkflowInfo; } interface CreateWorkflowResponse { /** * ID of the new workflow. * @format GUID */ _id?: string | null; } interface DeleteWorkflowRequest { /** * ID of the workflow to delete. * @format GUID */ _id: string; } interface DeleteWorkflowResponse { } interface SetupWorkflowRequest { } interface SetupWorkflowResponse { } /** * Retrieves a list of the site's workflows info. * * * The `listWorkflows()` function returns a Promise that resolves to a list containing information about the site's workflows. * * * Use the `options` parameter to specify which workflows to retrieve and in which order to retrieve them. Workflows can be sorted based on their `"name"`. * * * If no `limit` parameter is passed, the first 100 workflows are returned. Sort order defaults to by `"name"` ascending. * @public * @documentationMaturity preview * @param options - Options to use when retrieving a list of workflows. * @permissionId workflows.view * @fqn com.wixpress.workflow.api.v1.WorkflowsService.ListWorkflows */ declare function listWorkflows(options?: ListWorkflowsOptions): Promise>; interface ListWorkflowsOptions { /** * Number of workflows to return. * If omitted, all results are returned. */ limit?: number | null; /** * Number of items to skip in the current sort order. * * Defaults to `0`. */ offset?: number | null; /** * Supported fields: * `id`, `name`, `description`, `createdDate` * * List of fields to sort by. * Formatted as `field:direction`, * where field is the field name * and direction is `asc` (ascending) or `desc` (descending). * * Sorting is applied lexicographically, so `"abc"` comes after `"XYZ"`. */ sort?: string[]; } /** * Retrieves a workflow by ID. * * * The `getWorkflow()` function returns a Promise that resolves to the workflow info with the specified ID. * * * This function requires you to specify the ID of a workflow. To learn about retrieving IDs in the Workflows APIs, see [Retrieving IDs](wix-workflows-v2/introduction#retrieving-ids). * @param _id - ID of the workflow to retrieve. * @param cardsPerPhase - Maximum number of cards to return per phase. * To retrieve additional pages of cards, use * [List Cards](../cards/listCards) * (in the Cards API). * @public * @documentationMaturity preview * @requiredField _id * @requiredField cardsPerPhase * @param options - Options to use when retrieving a workflow. * @permissionId workflows.view * @returns Requested workflow. * @fqn com.wixpress.workflow.api.v1.WorkflowsService.GetWorkflow */ declare function getWorkflow(_id: string, cardsPerPhase: number): Promise>; /** * Updates an existing workflow. * * * The `updateWorkflow()` function returns a Promise that resolves when the workflow has been updated with the specified values. * * * Only the properties passed in the `workflow` object will be updated. All other properties will remain the same. * * * This function requires you to specify the ID of a workflow. To learn about retrieving IDs in the Workflow API, see [Retrieving IDs](#retrieving-ids). * @param _id - ID of the workflow to update. * @param workflow - Workflow info. * @public * @documentationMaturity preview * @requiredField _id * @requiredField workflow * @param options - Options to use when updating a workflow. * @permissionId workflows.modify * @fqn com.wixpress.workflow.api.v1.WorkflowsService.UpdateWorkflow */ declare function updateWorkflow(_id: string, workflow: WorkflowInfo): Promise; /** * Creates a new workflow. * * * The `createWorkflow()` function returns a Promise that resolves to the created workflow ID. * @param workflow - Workflow details. * @public * @documentationMaturity preview * @requiredField workflow * @requiredField workflow.name * @param options - Options to use when creating a workflow. * @permissionId workflows.modify * @fqn com.wixpress.workflow.api.v1.WorkflowsService.CreateWorkflow */ declare function createWorkflow(workflow: NonNullablePaths): Promise; /** * Deletes a workflow. * * * The `deleteWorkflow()` function returns a Promise when the specified workflow has been deleted. * * * This function requires you to specify the ID of a workflow. To learn about retrieving IDs in the Workflows APIs, see [Retrieving IDs](wix-workflows-v2/introduction#retrieving-ids). * @param _id - ID of the workflow to delete. * @public * @documentationMaturity preview * @requiredField _id * @permissionId workflows.modify * @fqn com.wixpress.workflow.api.v1.WorkflowsService.DeleteWorkflow */ declare function deleteWorkflow(_id: string): Promise; export { type Attachment, AttachmentType, type AttachmentTypeWithLiterals, type Card, type CardInfo, type CardsList, type CreateWorkflowRequest, type CreateWorkflowResponse, type DeleteWorkflowRequest, type DeleteWorkflowResponse, type GetWorkflowRequest, type GetWorkflowResponse, type ListWorkflowsOptions, type ListWorkflowsRequest, type ListWorkflowsResponse, type PaginationResponse, type Paging, type Phase, type PhaseInfo, type PhasesList, type Query, type QueryWorkflowsRequest, type QueryWorkflowsResponse, type SetupWorkflowRequest, type SetupWorkflowResponse, SortOrder, type SortOrderWithLiterals, type Sorting, type UpdateWorkflowRequest, type UpdateWorkflowResponse, type Workflow, type WorkflowInfo, createWorkflow, deleteWorkflow, getWorkflow, listWorkflows, updateWorkflow };