import * as _wix_sdk_types from '@wix/sdk-types'; import { QuerySpec, Query, NonNullablePaths } from '@wix/sdk-types'; interface Task { /** * Task ID. * @format GUID * @readonly */ _id?: string | null; /** * Revision number, which increments by 1 each time the task is updated. To prevent conflicting changes, the existing `revision` must be used when updating a task. * @readonly */ revision?: string | null; /** * Title of the task. * @minLength 1 * @maxLength 250 */ title?: string | null; /** * Description of the task. * @minLength 1 * @maxLength 500 */ description?: string | null; /** * Date and time the task was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the task was last updated. * @readonly */ _updatedDate?: Date | null; /** Due date for the task. */ dueDate?: Date | null; /** * Status of the task. * * Default: `ACTION_NEEDED` */ status?: TaskStatusWithLiterals; /** Details about the task source. */ source?: TaskSource; /** Information about the contact associated with the task. */ contact?: ContactInfo; } /** Possible statuses in which the task may be. */ declare enum TaskStatus { /** Action needed. */ ACTION_NEEDED = "ACTION_NEEDED", /** Task completed. */ COMPLETED = "COMPLETED" } /** @enumType */ type TaskStatusWithLiterals = TaskStatus | 'ACTION_NEEDED' | 'COMPLETED'; interface TaskSource { /** * How the task was created. * @readonly */ sourceType?: SourceTypeWithLiterals; /** * App ID, if the task was created by an app. * @format GUID * @readonly */ appId?: string | null; /** * User ID, if the task was created by a Wix user. * @format GUID * @readonly */ userId?: string | null; } /** Possible sources that can create tasks. */ declare enum SourceType { /** Task was created by an app. */ APP = "APP", /** Task was created by a Wix user. */ USER = "USER" } /** @enumType */ type SourceTypeWithLiterals = SourceType | 'APP' | 'USER'; interface ContactInfo { /** * ID of the contact associated with the task. * @format GUID */ _id?: string | null; /** * Contact's first name. * @readonly */ firstName?: string | null; /** * Contact's last name. * @readonly */ lastName?: string | null; /** * Contact's image URL. * @readonly */ imageUrl?: string | null; /** * Contact's primary email. * @readonly */ email?: string | null; /** * Contact's primary phone. * @readonly */ phone?: string | null; /** * Image URL expiration date. * @readonly */ imageUrlExpirationDate?: Date | null; } interface RepositionTask { /** * The id of the last task that was re-positioned * @format GUID */ taskId?: string | null; /** The position of the last task that was re-positioned */ position?: string | null; } interface TaskOverdue { /** The overdue task. */ task?: Task; } interface TaskAssigned { /** * The id of the assignee * @format GUID */ assigneeId?: string; /** The task that was assigned */ task?: Task; } interface CreateTaskRequest { /** Task to create. */ task: Task; } interface CreateTaskResponse { /** The created task. */ task?: Task; } interface ContactNotFoundError { /** @format GUID */ contactId?: string; } interface GetTaskRequest { /** * ID of the task to retrieve. * @format GUID */ taskId: string; } interface GetTaskResponse { /** The retrieved task. */ task?: Task; } interface UpdateTaskRequest { /** Task to update. */ task: Task; } interface UpdateTaskResponse { /** The updated task. */ task?: Task; } interface DeleteTaskRequest { /** * ID of the task to delete. * @format GUID */ taskId: string; } interface DeleteTaskResponse { } interface QueryTasksRequest { /** Query options. */ query?: CursorQuery; } interface CursorQuery extends CursorQueryPagingMethodOneOf { /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; /** * 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?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; } /** @oneof */ interface CursorQueryPagingMethodOneOf { /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrderWithLiterals; } declare enum SortOrder { /** Sort by ascending order. */ ASC = "ASC", /** Sort by descending order. */ DESC = "DESC" } /** @enumType */ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC'; interface CursorPaging { /** * Number of items to load. * @max 1000 */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * You can get the relevant cursor token * from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. */ cursor?: string | null; } interface QueryTasksResponse { /** The retrieved tasks. */ tasks?: Task[]; /** Paging metadata. */ pagingMetadata?: CursorPagingMetadata; } interface CursorPagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ cursors?: Cursors; /** * Indicates if there are more results after the current page. * If `true`, another page of results can be retrieved. * If `false`, this is the last page. */ hasNext?: boolean | null; } interface Cursors { /** Cursor pointing to next page in the list of results. */ next?: string | null; /** Cursor pointing to previous page in the list of results. */ prev?: string | null; } interface CountTasksRequest { /** * Filter which tasks to count. See [supported filters](https://dev.wix.com/docs/rest/api-reference/crm/tasks/task-v2/filter-and-sort). * * Filter tasks 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?: Record | null; } interface CountTasksResponse { /** The number of tasks that match the specified filter. */ count?: number; } interface QueryTasksInternalRequest { /** WQL expression */ query?: QueryV2; } interface QueryV2 extends QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; /** * 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?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; /** 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[]; } /** @oneof */ interface QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } interface Paging { /** * Number of items to load. * @max 1000 */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } interface QueryTasksInternalResponse { /** The retrieved tasks. */ tasks?: Task[]; /** Details on the paged set of results returned. */ pagingMetadata?: PagingMetadataV2; } interface PagingMetadataV2 { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */ cursors?: Cursors; } interface MoveTaskAfterRequest { /** * ID of the task to move. * @format GUID */ taskId: string; /** * The ID of the task after which the moved task is positioned in the task display. * If `beforeTaskId` is not specified, the moved task is positioned first in the task display. * @format GUID */ beforeTaskId?: string | null; } interface MoveTaskAfterResponse { } interface TaskNotFoundError { /** * The task id that was not found * @format GUID */ taskId?: string; } interface Empty { } interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`. */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; } /** @oneof */ interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } interface EntityCreatedEvent { entity?: string; } interface RestoreInfo { deletedDate?: Date | null; } interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } interface EntityDeletedEvent { /** Entity that was deleted. */ deletedEntity?: string | null; } interface ActionEvent { body?: string; } interface MessageEnvelope { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; /** Details related to the account */ accountInfo?: AccountInfo; } interface IdentificationData extends IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; /** @readonly */ identityType?: WebhookIdentityTypeWithLiterals; } /** @oneof */ interface IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } /** @enumType */ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP'; interface AccountInfo { /** * ID of the Wix account associated with the event. * @format GUID */ accountId?: string | null; /** * ID of the parent Wix account. Only included when accountId belongs to a child account. * @format GUID */ parentAccountId?: string | null; /** * ID of the Wix site associated with the event. Only included when the event is tied to a specific site. * @format GUID */ siteId?: string | null; } interface DeleteCompletedTasksRequest { /** * Optional list of tasks ids of the tasks to delete. If the list is not provided the filter is used. * @format GUID * @maxSize 1000 */ taskIds?: string[]; /** An optional filter of tasks to count. See 'queryTasks' for supported filter options. */ filter?: Record | null; } interface DeleteCompletedTasksResponse { } interface SendTasksReminderRequest { /** * Ids of the tasks to remind * @format GUID * @maxSize 50 */ taskIds?: string[]; /** The reminder type */ reminderType?: ReminderTypeWithLiterals; } declare enum ReminderType { UNKNOWN_REMINDER_TYPE = "UNKNOWN_REMINDER_TYPE", FIRST_REMINDER = "FIRST_REMINDER", LAST_REMINDER = "LAST_REMINDER" } /** @enumType */ type ReminderTypeWithLiterals = ReminderType | 'UNKNOWN_REMINDER_TYPE' | 'FIRST_REMINDER' | 'LAST_REMINDER'; interface SendTasksReminderResponse { } /** @docsIgnore */ type CreateTaskApplicationErrors = { code?: 'CONTACT_NOT_FOUND'; description?: string; data?: ContactNotFoundError; }; /** @docsIgnore */ type UpdateTaskApplicationErrors = { code?: 'CONTACT_NOT_FOUND'; description?: string; data?: ContactNotFoundError; }; /** @docsIgnore */ type CountTasksApplicationErrors = { code?: 'TOO_MANY_TO_COUNT'; description?: string; data?: Record; }; /** @docsIgnore */ type MoveTaskAfterApplicationErrors = { code?: 'TASK_NOT_FOUND'; description?: string; data?: TaskNotFoundError; }; interface BaseEventMetadata { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Details related to the account */ accountInfo?: AccountInfo; } interface EventMetadata extends BaseEventMetadata { /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`. */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; accountInfo?: AccountInfoMetadata; } interface AccountInfoMetadata { /** ID of the Wix account associated with the event */ accountId: string; /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */ siteId?: string; /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */ parentAccountId?: string; } interface TaskCreatedEnvelope { entity: Task; metadata: EventMetadata; } /** * Triggered when a task is created. * @permissionScope Manage_Wix_Rentals_App_Forms_submissions * @permissionScopeId SCOPE.RENTALS.MANAGE * @permissionScope Manage Stores * @permissionScopeId SCOPE.STORES.MANAGE-STORES * @permissionScope Read Tasks * @permissionScopeId SCOPE.DC-CRM.READ-TASKS * @permissionScope Read Members and Contacts - all read permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionScope Manage Tasks * @permissionScopeId SCOPE.DC-CRM.MANAGE-TASKS * @permissionId CRM_TASKS.TASK_READ * @webhook * @eventType wix.crm.tasks.v2.task_created * @serviceIdentifier wix.crm.tasks.v2.Tasks * @slug created */ declare function onTaskCreated(handler: (event: TaskCreatedEnvelope) => void | Promise): void; interface TaskDeletedEnvelope { metadata: EventMetadata; } /** * Triggered when a task is deleted. * @permissionScope Manage_Wix_Rentals_App_Forms_submissions * @permissionScopeId SCOPE.RENTALS.MANAGE * @permissionScope Manage Stores * @permissionScopeId SCOPE.STORES.MANAGE-STORES * @permissionScope Read Tasks * @permissionScopeId SCOPE.DC-CRM.READ-TASKS * @permissionScope Read Members and Contacts - all read permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionScope Manage Tasks * @permissionScopeId SCOPE.DC-CRM.MANAGE-TASKS * @permissionId CRM_TASKS.TASK_READ * @webhook * @eventType wix.crm.tasks.v2.task_deleted * @serviceIdentifier wix.crm.tasks.v2.Tasks * @slug deleted */ declare function onTaskDeleted(handler: (event: TaskDeletedEnvelope) => void | Promise): void; interface TaskOverdueEnvelope { data: TaskOverdue; metadata: EventMetadata; } /** * Triggered when a task reaches its due date. * @permissionScope Manage_Wix_Rentals_App_Forms_submissions * @permissionScopeId SCOPE.RENTALS.MANAGE * @permissionScope Manage Stores * @permissionScopeId SCOPE.STORES.MANAGE-STORES * @permissionScope Read Tasks * @permissionScopeId SCOPE.DC-CRM.READ-TASKS * @permissionScope Read Members and Contacts - all read permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionScope Manage Tasks * @permissionScopeId SCOPE.DC-CRM.MANAGE-TASKS * @permissionId CRM_TASKS.TASK_READ * @webhook * @eventType wix.crm.tasks.v2.task_task_overdue * @serviceIdentifier wix.crm.tasks.v2.Tasks * @slug task_overdue */ declare function onTaskOverdue(handler: (event: TaskOverdueEnvelope) => void | Promise): void; interface TaskUpdatedEnvelope { entity: Task; metadata: EventMetadata; /** @hidden */ modifiedFields: Record; } /** * Triggered when a task is updated. * @permissionScope Manage_Wix_Rentals_App_Forms_submissions * @permissionScopeId SCOPE.RENTALS.MANAGE * @permissionScope Manage Stores * @permissionScopeId SCOPE.STORES.MANAGE-STORES * @permissionScope Read Tasks * @permissionScopeId SCOPE.DC-CRM.READ-TASKS * @permissionScope Read Members and Contacts - all read permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionScope Manage Tasks * @permissionScopeId SCOPE.DC-CRM.MANAGE-TASKS * @permissionId CRM_TASKS.TASK_READ * @webhook * @eventType wix.crm.tasks.v2.task_updated * @serviceIdentifier wix.crm.tasks.v2.Tasks * @slug updated */ declare function onTaskUpdated(handler: (event: TaskUpdatedEnvelope) => void | Promise): void; /** * Creates a new task. * @param task - Task to create. * @public * @requiredField task * @permissionId CRM_TASKS.TASK_CREATE * @applicableIdentity APP * @returns The created task. * @fqn wix.crm.tasks.v2.Tasks.CreateTask */ declare function createTask(task: Task): Promise & { __applicationErrorsType?: CreateTaskApplicationErrors; }>; /** * Retrieves a task by ID. * @param taskId - ID of the task to retrieve. * @public * @requiredField taskId * @permissionId CRM_TASKS.TASK_READ * @applicableIdentity APP * @returns The retrieved task. * @fqn wix.crm.tasks.v2.Tasks.GetTask */ declare function getTask(taskId: string): Promise>; /** * Updates a task. * * Each time the task is updated, `revision` increments by 1. * The existing `revision` must be included when updating the task. * This ensures you're working with the latest task * and prevents unintended overwrites. * @param _id - Task ID. * @public * @requiredField _id * @requiredField task * @requiredField task.revision * @param task - Task to update. * @permissionId CRM_TASKS.TASK_UPDATE * @applicableIdentity APP * @returns The updated task. * @fqn wix.crm.tasks.v2.Tasks.UpdateTask */ declare function updateTask(_id: string, task: NonNullablePaths): Promise & { __applicationErrorsType?: UpdateTaskApplicationErrors; }>; interface UpdateTask { /** * Task ID. * @format GUID * @readonly */ _id?: string | null; /** * Revision number, which increments by 1 each time the task is updated. To prevent conflicting changes, the existing `revision` must be used when updating a task. * @readonly */ revision?: string | null; /** * Title of the task. * @minLength 1 * @maxLength 250 */ title?: string | null; /** * Description of the task. * @minLength 1 * @maxLength 500 */ description?: string | null; /** * Date and time the task was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the task was last updated. * @readonly */ _updatedDate?: Date | null; /** Due date for the task. */ dueDate?: Date | null; /** * Status of the task. * * Default: `ACTION_NEEDED` */ status?: TaskStatusWithLiterals; /** Details about the task source. */ source?: TaskSource; /** Information about the contact associated with the task. */ contact?: ContactInfo; } /** * Deletes a task by ID. * @param taskId - ID of the task to delete. * @public * @requiredField taskId * @permissionId CRM_TASKS.TASK_DELETE * @applicableIdentity APP * @fqn wix.crm.tasks.v2.Tasks.DeleteTask */ declare function deleteTask(taskId: string): Promise; /** * Creates a query to retrieve a list of tasks. * * The `queryTasks()` method builds a query to retrieve a list of tasks and returns a `TasksQueryBuilder` object. * * The returned object contains the query definition which is typically used to run the query using the `find()` method. You can refine the query by chaining `TasksQueryBuilder` methods onto the query. `TasksQueryBuilder` methods enable you to sort, filter, and control the results that `queryTasks()` returns. * * `queryTasks()` runs with these `TasksQueryBuilder` defaults, which you can override: * - `limit(50)` * - `descending('_createdDate')` * * The methods that are chained to `queryTasks()` are applied in the order they are called. For example, if you apply `ascending('_createdDate')` and then `descending('_updatedDate')`, the results are sorted first by the created date and then, if there are multiple results with the same date, the items are sorted by the updated date. * * The following `TasksQueryBuilder` methods are supported for `queryTasks()`. For a full description of the `task` object, see the object returned for the `items` property in `TasksQueryResult`. * @public * @permissionId CRM_TASKS.TASK_READ * @applicableIdentity APP * @fqn wix.crm.tasks.v2.Tasks.QueryTasks */ declare function queryTasks(): TasksQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } interface TasksQueryResult extends QueryCursorResult { items: Task[]; query: TasksQueryBuilder; next: () => Promise; prev: () => Promise; } interface TasksQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: '_id' | '_createdDate' | '_updatedDate' | 'dueDate' | 'status' | 'contact.id', value: any) => TasksQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: '_id' | '_createdDate' | '_updatedDate' | 'dueDate' | 'status' | 'contact.id', value: any) => TasksQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder; in: (propertyName: '_id' | 'status' | 'contact.id', value: any) => TasksQueryBuilder; exists: (propertyName: 'dueDate' | 'contact.id', value: boolean) => TasksQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'_id' | '_createdDate' | '_updatedDate' | 'dueDate'>) => TasksQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'_id' | '_createdDate' | '_updatedDate' | 'dueDate'>) => TasksQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => TasksQueryBuilder; /** @param cursor - A pointer to specific record */ skipTo: (cursor: string) => TasksQueryBuilder; find: () => Promise; } /** * @hidden * @fqn wix.crm.tasks.v2.Tasks.QueryTasks * @requiredField query */ declare function typedQueryTasks(query: TaskQuery): Promise>; interface TaskQuerySpec extends QuerySpec { paging: 'cursor'; wql: [ { fields: ['_id']; operators: ['$eq', '$in', '$ne']; sort: 'BOTH'; }, { fields: ['_createdDate']; operators: ['$eq', '$gt', '$gte', '$lt', '$lte', '$ne']; sort: 'BOTH'; }, { fields: ['_updatedDate']; operators: ['$eq', '$gt', '$gte', '$lt', '$lte', '$ne']; sort: 'BOTH'; }, { fields: ['dueDate']; operators: ['$eq', '$exists', '$gt', '$gte', '$lt', '$lte', '$ne']; sort: 'BOTH'; }, { fields: ['status']; operators: ['$eq', '$in', '$ne', '$nin']; sort: 'NONE'; }, { fields: ['contact._id']; operators: ['$eq', '$exists', '$in', '$ne']; sort: 'NONE'; } ]; } type CommonQueryWithEntityContext = Query; type TaskQuery = { /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: { /** Number of items to load. @max: 1000 */ limit?: NonNullable['limit'] | null; /** Pointer to the next or previous page in the list of results. You can get the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. */ cursor?: NonNullable['cursor'] | null; }; /** 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?: CommonQueryWithEntityContext['filter'] | null; /** Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: { /** Name of the field to sort by. */ fieldName?: NonNullable[number]['fieldName']; /** Sort order. */ order?: NonNullable[number]['order']; }[]; }; declare const utils: { query: _wix_sdk_types.QueryHelpers; }; /** * Counts the number of tasks. * * * This method returns the count of all tasks regardless of their `status`. * * Optionally, you can specify a filter to count only tasks that meet certain criteria. * @public * @param options - Filtering options. * @permissionId CRM_TASKS.TASK_READ * @applicableIdentity APP * @fqn wix.crm.tasks.v2.Tasks.CountTasks */ declare function countTasks(options?: CountTasksOptions): Promise & { __applicationErrorsType?: CountTasksApplicationErrors; }>; interface CountTasksOptions { /** * Filter which tasks to count. See [supported filters](https://dev.wix.com/docs/rest/api-reference/crm/tasks/task-v2/filter-and-sort). * * Filter tasks 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?: Record | null; } /** * Moves a task specified by ID to be placed after another task in the task display. * * You can reposition a task to be first in the display by omitting `beforeTaskId`. * @param taskId - ID of the task to move. * @public * @requiredField taskId * @param options - Options for moving the task. * @permissionId CRM_TASKS.TASK_UPDATE * @applicableIdentity APP * @fqn wix.crm.tasks.v2.Tasks.MoveTaskAfter */ declare function moveTaskAfter(taskId: string, options?: MoveTaskAfterOptions): Promise; interface MoveTaskAfterOptions { /** * The ID of the task after which the moved task is positioned in the task display. * If `beforeTaskId` is not specified, the moved task is positioned first in the task display. * @format GUID */ beforeTaskId?: string | null; } export { type AccountInfo, type AccountInfoMetadata, type ActionEvent, type BaseEventMetadata, type CommonQueryWithEntityContext, type ContactInfo, type ContactNotFoundError, type CountTasksApplicationErrors, type CountTasksOptions, type CountTasksRequest, type CountTasksResponse, type CreateTaskApplicationErrors, type CreateTaskRequest, type CreateTaskResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteCompletedTasksRequest, type DeleteCompletedTasksResponse, type DeleteTaskRequest, type DeleteTaskResponse, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type GetTaskRequest, type GetTaskResponse, type IdentificationData, type IdentificationDataIdOneOf, type MessageEnvelope, type MoveTaskAfterApplicationErrors, type MoveTaskAfterOptions, type MoveTaskAfterRequest, type MoveTaskAfterResponse, type Paging, type PagingMetadataV2, type QueryTasksInternalRequest, type QueryTasksInternalResponse, type QueryTasksRequest, type QueryTasksResponse, type QueryV2, type QueryV2PagingMethodOneOf, ReminderType, type ReminderTypeWithLiterals, type RepositionTask, type RestoreInfo, type SendTasksReminderRequest, type SendTasksReminderResponse, SortOrder, type SortOrderWithLiterals, type Sorting, SourceType, type SourceTypeWithLiterals, type Task, type TaskAssigned, type TaskCreatedEnvelope, type TaskDeletedEnvelope, type TaskNotFoundError, type TaskOverdue, type TaskOverdueEnvelope, type TaskQuery, type TaskQuerySpec, type TaskSource, TaskStatus, type TaskStatusWithLiterals, type TaskUpdatedEnvelope, type TasksQueryBuilder, type TasksQueryResult, type UpdateTask, type UpdateTaskApplicationErrors, type UpdateTaskRequest, type UpdateTaskResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, countTasks, createTask, deleteTask, getTask, moveTaskAfter, onTaskCreated, onTaskDeleted, onTaskOverdue, onTaskUpdated, queryTasks, typedQueryTasks, updateTask, utils };