/** Background task job that processes data items in bulk. */ export interface Task extends TaskOptionsOneOf { /** Options for tasks of the type `DELETE_BY_QUERY`. */ deleteByQueryOptions?: DeleteByQueryOptions; /** Options for tasks of the type `COPY_FIELD_DATA`. */ copyFieldDataOptions?: CopyFieldDataOptions; /** Options for tasks of the type `EDIT_FIELD_DATA`. */ editFieldDataOptions?: EditFieldDataOptions; /** Options for tasks of the type `UPDATE_PUBLISH_STATUS`. */ updatePublishStatusOptions?: UpdatePublishStatusOptions; /** * Task ID. * @readonly */ id?: string; /** Task type. */ type?: Type; /** * Task status. * @readonly */ status?: Status; /** * Task start time. Empty if the task status is `NEW`. * @readonly */ startedAt?: Date | null; /** * Task finish time. Empty until the task status updates to `COMPLETED` or `FAILED`. * @readonly */ finishedAt?: Date | null; /** * Number of items whose processing failed. * @readonly */ itemsFailed?: number; /** * List of errors generated during the task. * * Learn more about [Wix Data error codes](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-error-codes). * @readonly */ failures?: ApplicationError[]; /** * Estimated number of items affected by the task. * @readonly */ estimatedItemCount?: number; /** * Number of items successfully processed so far. * @readonly */ itemsSucceeded?: number; } /** @oneof */ export interface TaskOptionsOneOf { /** Options for tasks of the type `DELETE_BY_QUERY`. */ deleteByQueryOptions?: DeleteByQueryOptions; /** Options for tasks of the type `COPY_FIELD_DATA`. */ copyFieldDataOptions?: CopyFieldDataOptions; /** Options for tasks of the type `EDIT_FIELD_DATA`. */ editFieldDataOptions?: EditFieldDataOptions; /** Options for tasks of the type `UPDATE_PUBLISH_STATUS`. */ updatePublishStatusOptions?: UpdatePublishStatusOptions; } export declare enum Type { /** Unknown task type. */ UNKNOWN = "UNKNOWN", /** Deletes all items that match the specified filter. */ DELETE_BY_QUERY = "DELETE_BY_QUERY", /** Copies data from one field to another for all items in the collection. */ COPY_FIELD_DATA = "COPY_FIELD_DATA", /** Updates field data for items that match the specified filter. */ EDIT_FIELD_DATA = "EDIT_FIELD_DATA", /** In collections that have the Publish plugin, updates the publish status of items that match the specified filter. */ UPDATE_PUBLISH_STATUS = "UPDATE_PUBLISH_STATUS" } export declare enum Status { /** Task was created but has not started. */ NEW = "NEW", /** Task is currently running. */ RUNNING = "RUNNING", /** Task has completed. Partial errors are listed in `failures`. */ COMPLETED = "COMPLETED", /** * Task has failed. Tasks can fail due to errors or because they were cancelled. * * Failures are listed in `failures`. Cancelled tasks have a failure `code` value of `CANCELLED`, and no associated failure `data`. */ FAILED = "FAILED" } export interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } export interface DeleteByQueryOptions { /** ID of the collection from which to delete the items that match the filter. */ dataCollectionId?: string; /** * [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing) from which to delete item. * * Default: `LIVE`. */ environment?: Environment; /** * Query filter. If not specified, all items are deleted. * * Learn about working with [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language). */ filter?: Record | null; /** * Additional options specific to the [Wix app collection](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections) you are querying. * * Learn more about [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections). */ appOptions?: Record | null; /** * Options for the [Publish plugin](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection). * * This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object) to be marked as draft or published. Published items are visible to site visitors, while draft items are not. */ publishPluginOptions?: PublishPluginOptions; } export declare enum Environment { /** Collection [live environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#live-collections). */ LIVE = "LIVE", /** Collection [sandbox environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections). */ SANDBOX = "SANDBOX", /** If the [collection's sandbox environment is enabled](https://support.wix.com/en/article/cms-accessing-and-syncing-your-sandbox-and-live-collections#enabling-sandbox-collections), run the task in the collection's sandbox environment. If not, run the task in the collection's live environment. */ SANDBOX_PREFERRED = "SANDBOX_PREFERRED" } export interface PublishPluginOptions { /** * Whether to include draft items. * * When `true`, the task affects both published and draft items. Default: `false`. */ includeDraftItems?: boolean; } export interface CopyFieldDataOptions { /** ID of the collection in which to copy and write item field data. */ dataCollectionId?: string; /** * [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections) in which to copy and write field data. * * Default: `LIVE`. */ environment?: Environment; /** ID of the field to copy data from. */ sourceFieldKey?: string; /** ID of the field to copy data to. */ targetFieldKey?: string; } export interface EditFieldDataOptions { /** ID of the collection in which to edit the specified field. */ dataCollectionId?: string; /** * [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections) in which to edit the specified field. * * Default: `LIVE`. */ environment?: Environment; /** * Query filter. Only items that match the filter are edited. * * Learn about working with [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language). */ filter?: Record | null; /** ID of the field to update. */ fieldKey?: string; /** Operations to perform on the specified field. */ operations?: Operations; } export interface Replace { /** Value or array element to replace. */ from?: any; /** Value or array element to replace with. */ to?: any; } export interface Operations { /** * Add elements to a field of type Array. * * Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type). */ addItems?: any[]; /** * Remove elements from a field of type Array. * * Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type). */ removeItems?: any[]; /** * In a field of type Array, replace all matching elements. In a field of another type, replace all matching values. * * Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type). */ replaceItems?: Replace[]; /** * In a field of type Array, remove duplicate elements. Default: `false`. * * Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type). */ removeDuplicates?: boolean; } export interface UpdatePublishStatusOptions extends UpdatePublishStatusOptionsOptionsOneOf { /** In a `SCHEDULE_DRAFT_STATUS` operation, options for scheduling the status update to `DRAFT`. */ scheduleDraftStatusOptions?: ScheduleOperation; /** In a `SCHEDULE_PUBLISHED_STATUS` operation, options for scheduling the status update to `PUBLISHED`. */ schedulePublishedStatusOptions?: ScheduleOperation; /** ID of the collection whose items' publish status is to be updated. */ dataCollectionId?: string; /** * [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections) in which to update the publish status of the items. * * Default: `LIVE`. */ environment?: Environment; /** * Query filter. If not specified, the publish status of all items is updated. * * Learn about working with [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language). */ filter?: Record | null; /** Publish status update operation. */ operation?: Operation; } /** @oneof */ export interface UpdatePublishStatusOptionsOptionsOneOf { /** In a `SCHEDULE_DRAFT_STATUS` operation, options for scheduling the status update to `DRAFT`. */ scheduleDraftStatusOptions?: ScheduleOperation; /** In a `SCHEDULE_PUBLISHED_STATUS` operation, options for scheduling the status update to `PUBLISHED`. */ schedulePublishedStatusOptions?: ScheduleOperation; } export declare enum Operation { UNDEFINED = "UNDEFINED", /** Update the publish status of all items that match the filter to `PUBLISHED`. */ SET_PUBLISHED_STATUS = "SET_PUBLISHED_STATUS", /** Update the publish status of all items that match the filter to `DRAFT`. */ SET_DRAFT_STATUS = "SET_DRAFT_STATUS", /** Schedule when to update the publish status of all items that match the filter to `PUBLISHED`. */ SCHEDULE_PUBLISHED_STATUS = "SCHEDULE_PUBLISHED_STATUS", /** Schedule when to update the publish status of all items that match the filter to `DRAFT`. */ SCHEDULE_DRAFT_STATUS = "SCHEDULE_DRAFT_STATUS", /** Cancel all scheduled status updates. */ CANCEL_SCHEDULING = "CANCEL_SCHEDULING" } export interface ScheduleOperation { /** When to update the item's publish status. */ date?: Date | null; } export interface CreateTaskRequest { /** Task to create and run. */ task: Task; } export interface CreateTaskResponse { /** Created task. */ task?: Task; } export interface ListTasksRequest { /** * Paginating information. This has the following default values: * - `limit`: 30 * - `offset`: 0 */ paging?: Paging; } export interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } export interface ListTasksResponse { /** Retrieved tasks. */ tasks?: Task[]; /** Paging metadata. */ metadata?: PagingMetadataV2; } export 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; } export interface Cursors { /** Cursor string pointing to the next page in the list of results. */ next?: string | null; /** Cursor pointing to the previous page in the list of results. */ prev?: string | null; } export interface GetTaskRequest { /** Task ID. */ taskId: string; } export interface GetTaskResponse { /** Retrieved task. */ task?: Task; } export interface CancelTaskRequest { /** Task ID. */ taskId: string; } export interface CancelTaskResponse { /** Cancelled task. */ task?: Task; } export interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * 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 defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } /** @oneof */ export interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } export interface EntityCreatedEvent { entityAsJson?: string; /** Indicates the event was triggered by a restore-from-trashbin operation for a previously deleted entity */ restoreInfo?: RestoreInfo; } export interface RestoreInfo { deletedDate?: Date | null; } export 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. */ currentEntityAsJson?: string; } export interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntityAsJson?: string | null; } export interface ActionEvent { bodyAsJson?: string; } export interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } export interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ export interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } export declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } interface PublishPluginOptionsNonNullableFields { includeDraftItems: boolean; } interface DeleteByQueryOptionsNonNullableFields { dataCollectionId: string; environment: Environment; publishPluginOptions?: PublishPluginOptionsNonNullableFields; } interface CopyFieldDataOptionsNonNullableFields { dataCollectionId: string; environment: Environment; sourceFieldKey: string; targetFieldKey: string; } interface OperationsNonNullableFields { removeDuplicates: boolean; } interface EditFieldDataOptionsNonNullableFields { dataCollectionId: string; environment: Environment; fieldKey: string; operations?: OperationsNonNullableFields; } interface UpdatePublishStatusOptionsNonNullableFields { dataCollectionId: string; environment: Environment; operation: Operation; } interface ApplicationErrorNonNullableFields { code: string; description: string; } interface TaskNonNullableFields { deleteByQueryOptions?: DeleteByQueryOptionsNonNullableFields; copyFieldDataOptions?: CopyFieldDataOptionsNonNullableFields; editFieldDataOptions?: EditFieldDataOptionsNonNullableFields; updatePublishStatusOptions?: UpdatePublishStatusOptionsNonNullableFields; id: string; type: Type; status: Status; itemsFailed: number; failures: ApplicationErrorNonNullableFields[]; estimatedItemCount: number; itemsSucceeded: number; } export interface CreateTaskResponseNonNullableFields { task?: TaskNonNullableFields; } export interface ListTasksResponseNonNullableFields { tasks: TaskNonNullableFields[]; } export interface GetTaskResponseNonNullableFields { task?: TaskNonNullableFields; } export interface CancelTaskResponseNonNullableFields { task?: TaskNonNullableFields; } export {};