export interface DataItem { /** Data item ID. */ id?: string; /** * Data item contents. * * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields: * * + `_id`: Item ID. * + `_createdDate`: Date and time the item was added to the collection. * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value. * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions. */ data?: Record | null; } export interface InsertDataItemRequest { /** ID of the collection in which to insert the item. */ dataCollectionId: string; /** Item to insert. */ dataItem: DataItem; } export declare enum Environment { LIVE = "LIVE", SANDBOX = "SANDBOX" } export interface Options { } export interface PublishPluginOptions { showDraftItems?: boolean; } export interface InsertDataItemResponse { /** Inserted data item. */ dataItem?: DataItem; } export interface UpdateDataItemRequest { /** ID of the collection containing the existing item. */ dataCollectionId: string; /** Updated data item content. The existing data item's content is replaced entirely. */ dataItem: DataItem; } export interface UpdateDataItemResponse { /** Updated data item. */ dataItem?: DataItem; } export interface SaveDataItemRequest { /** ID of the collection in which to insert or update the item. */ dataCollectionId: string; /** Data item to insert or update. */ dataItem: DataItem; } export interface SaveDataItemResponse { /** * The action carried out for the item. * * + `INSERTED`: A new item was added to the collection. * + `UPDATED`: An existing item in the collection was updated. */ action?: Action; /** Inserted or updated data item. */ dataItem?: DataItem; } export declare enum Action { UNKNOWN_ACTION = "UNKNOWN_ACTION", INSERTED = "INSERTED", UPDATED = "UPDATED" } export interface GetDataItemRequest { /** ID of the collection from which to retrieve the data item. */ dataCollectionId: string; /** ID of the data item to retrieve. */ dataItemId: string; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } export interface GetDataItemResponse { /** Retrieved item. */ dataItem?: DataItem; } export interface RemoveDataItemRequest { /** ID of the collection from which to remove the item. */ dataCollectionId: string; /** ID of the item to remove. */ dataItemId: string; } export interface RemoveDataItemResponse { /** Removed item. */ dataItem?: DataItem; } export interface TruncateDataItemsRequest { /** ID of the collection to truncate. */ dataCollectionId: string; } export interface TruncateDataItemsResponse { } export interface QueryDataItemsRequest { /** ID of the collection in which to insert the item. */ dataCollectionId: string; /** Query preferences. For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). */ query?: QueryV2; /** * Whether to return the total count in the response for a query with offset paging. * When `true`, the `pagingMetadata` object in the response contains a `total` field. * * Default: `false` */ returnTotalCount?: boolean; /** * Properties for which to include referenced items in the query's results. * Up to 50 referenced items can be included for each item that matches the query. */ includeReferencedItems?: string[]; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } export 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"} * }` * * Examples 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[]; } /** @oneof */ export 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; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } 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 CursorPaging { /** Number of items to load. */ 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; } export interface QueryDataItemsResponse { /** Retrieved items. */ dataItems?: DataItem[]; /** Paging information. */ pagingMetadata?: 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, `returnTotalCount` is `true` in the request, and `tooManyToCount` is false. */ total?: number | null; /** Whether 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 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; } export interface AggregateDataItemsRequest extends AggregateDataItemsRequestPagingMethodOneOf { /** 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; /** ID of the collection on which to run the aggregation. */ dataCollectionId: string; /** Filter applied to the collection's data prior to running the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */ initialFilter?: Record | null; /** Aggregation applied to the data. */ aggregation?: Aggregation; /** Filter applied to the processed data following the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */ finalFilter?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; /** * Whether to return the total count in the response for a query with offset paging. * When `true`, the `pagingMetadata` object in the response contains a `total` field. * * Default: `false` */ returnTotalCount?: boolean; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } /** @oneof */ export interface AggregateDataItemsRequestPagingMethodOneOf { /** 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; } export interface Average { /** Name of the field for which to calculate the average value. */ itemFieldName?: string; } export interface Min { /** Name of the field for which to calculate the minimum value. */ itemFieldName?: string; } export interface Max { /** Name of the field for which to calculate the maximum value. */ itemFieldName?: string; } export interface Sum { /** Name of the field for which to calculate the sum. */ itemFieldName?: string; } export interface Count { } export interface Operation extends OperationCalculateOneOf { /** Calculate the average value of a specified field for all items in the grouping. */ average?: Average; /** Calculate the minimum value of a specified field for all items in the grouping. */ min?: Min; /** Calculate the maximum value of a specified field for all items in the grouping. */ max?: Max; /** Calculate the sum of values of a specified field for all items in the grouping. */ sum?: Sum; /** Calculate the number of items in the grouping. */ itemCount?: Count; /** Name of the field containing results of the operation. */ resultFieldName?: string; } /** @oneof */ export interface OperationCalculateOneOf { /** Calculate the average value of a specified field for all items in the grouping. */ average?: Average; /** Calculate the minimum value of a specified field for all items in the grouping. */ min?: Min; /** Calculate the maximum value of a specified field for all items in the grouping. */ max?: Max; /** Calculate the sum of values of a specified field for all items in the grouping. */ sum?: Sum; /** Calculate the number of items in the grouping. */ itemCount?: Count; } export interface Aggregation { /** Fields by which to group items for the aggregation. If empty, the aggregation is carried out on all items in the collection. */ groupingFields?: string[]; /** Operations to carry out on the data in each grouping. */ operations?: Operation[]; } export interface AggregateDataItemsResponse { /** Aggregation results. */ results?: Record[] | null; /** Paging information. */ pagingMetadata?: PagingMetadataV2; } export interface CountDataItemsRequest { /** ID of the collection for which to count query results. */ dataCollectionId: string; /** * Filter object in the following format: * * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }`. * * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`. */ filter?: Record | null; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } export interface CountDataItemsResponse { /** Number of items matching the query. */ totalCount?: number; } export interface QueryDistinctValuesRequest extends QueryDistinctValuesRequestPagingMethodOneOf { /** 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; /** ID of the collection to query. */ dataCollectionId: string; /** Item field name for which to return all distinct values. */ fieldName?: string; /** * Filter object in the following format: * * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }`. * * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`. */ filter?: Record | null; /** Sort order. */ order?: SortOrder; /** * Whether to return the total count in the response for a query with offset paging. * When `true`, the `pagingMetadata` object in the response contains a `total` field. * * Default: `false` */ returnTotalCount?: boolean; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } /** @oneof */ export interface QueryDistinctValuesRequestPagingMethodOneOf { /** 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; } export interface QueryDistinctValuesResponse { /** List of distinct values contained in the field specified in `fieldName`. */ distinctValues?: any[]; /** Paging information. */ pagingMetadata?: PagingMetadataV2; } export interface BulkInsertDataItemsRequest { /** ID of the collection in which to insert the items. */ dataCollectionId: string; /** Data items to insert. */ dataItems: DataItem[]; /** * Whether to return the inserted data items. * When `true`, the `results` objects contain a `dataItem` field. * * Default: `false` */ returnEntity?: boolean; } export interface BulkInsertDataItemsResponse { /** Information about the inserted items. */ results?: BulkDataItemResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface BulkDataItemResult { /** The action attempted for the data item. */ action?: BulkActionType; /** Metadata related to the data item for which the action was attempted. */ itemMetadata?: ItemMetadata; /** The data item for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */ dataItem?: DataItem; } export declare enum BulkActionType { UNKNOWN_ACTION_TYPE = "UNKNOWN_ACTION_TYPE", INSERT = "INSERT", UPDATE = "UPDATE", DELETE = "DELETE" } export interface ItemMetadata { /** Item ID. This field doesn't appear if there is no item ID, for example, when item creation fails. */ id?: string | null; /** Index of the item within the request array. Allows for correlation between request and response items. */ originalIndex?: number; /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */ success?: boolean; /** Details about the error in case of failure. */ error?: ApplicationError; } export interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } export interface BulkActionMetadata { /** Number of items successfully processed. */ totalSuccesses?: number; /** Number of items that couldn't be processed. */ totalFailures?: number; } export interface BulkUpdateDataItemsRequest { /** ID of the collection in which to update items. */ dataCollectionId: string; /** Data items to update. */ dataItems: DataItem[]; /** * Whether to return the updated data items. * When `true`, the `results` objects contain a `dataItem` field. * * Default: `false` */ returnEntity?: boolean; } export interface BulkUpdateDataItemsResponse { /** Information about the updated items. */ results?: BulkDataItemResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface BulkSaveDataItemsRequest { /** ID of the collection in which to insert or update the items. */ dataCollectionId: string; /** Data items to insert or update. */ dataItems: DataItem[]; /** * Whether to return the saved data item. * When `true`, the `results` objects contain a `dataItem` field. * * Default: `false` */ returnEntity?: boolean; } export interface BulkSaveDataItemsResponse { /** Information about the saved items. */ results?: BulkDataItemResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface BulkRemoveDataItemsRequest { /** ID of the collection from which to remove the item. */ dataCollectionId: string; /** IDs of data items to remove. */ dataItemIds: string[]; } export interface BulkRemoveDataItemsResponse { /** Information about the removed data items. */ results?: BulkDataItemResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface QueryReferencedDataItemsRequest extends QueryReferencedDataItemsRequestPagingMethodOneOf { /** 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; /** ID of the collection containing the referring item. */ dataCollectionId: string; /** ID of the referring item. */ referringItemId?: string; /** Field containing references in the referring item. */ referringItemFieldName?: string; /** Order of the returned referenced items. Sorted by the date each item was referenced. */ order?: SortOrder; /** * Whether to return the total count in the response. * When `true`, the `pagingMetadata` object in the response contains a `total` field. * * Default: `false` */ returnTotalCount?: boolean; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } /** @oneof */ export interface QueryReferencedDataItemsRequestPagingMethodOneOf { /** 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; } export interface QueryReferencedDataItemsResponse { /** Referenced items and/or IDs. For successfully resolved references, the referenced data item is returned. For references that can't be resolved, the ID is returned. */ results?: ReferencedResult[]; /** Paging information. */ pagingMetadata?: PagingMetadataV2; } export interface UnresolvedReference { /** ID of the referring item. */ referringItemId?: string; /** Field specified to query for references. */ referringItemFieldName?: string; } export interface ReferencedResult extends ReferencedResultEntityOneOf { /** Data item referenced. */ dataItem?: DataItem; /** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */ unresolvedReference?: UnresolvedReference; } /** @oneof */ export interface ReferencedResultEntityOneOf { /** Data item referenced. */ dataItem?: DataItem; /** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */ unresolvedReference?: UnresolvedReference; } export interface IsReferencedDataItemRequest { /** ID of the collection containing the referring data item. */ dataCollectionId: string; /** Field to check for a reference to the item that may be referenced. */ referringItemFieldName: string; /** ID of the referring item. */ referringItemId: string; /** ID of the item that may be referenced. */ referencedItemId: string; /** * Whether to retrieve data from the primary database instance. * This decreases performance but ensures data retrieved is up to date even immediately after an update. * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency). * * Default: `false` */ consistentRead?: boolean; } export interface IsReferencedDataItemResponse { /** Whether the specified reference exists. */ isReferenced?: boolean; } export interface InsertDataItemReferenceRequest { /** ID of the collection in which to insert the reference. */ dataCollectionId: string; /** Reference to insert */ dataItemReference?: DataItemReference; } export interface DataItemReference { /** Referring item field containing the references to the referenced items. */ referringItemFieldName?: string; /** ID of the referring item. */ referringItemId?: string; /** ID of the referenced item. */ referencedItemId?: string; } export interface InsertDataItemReferenceResponse { /** Inserted reference. */ dataItemReference?: DataItemReference; } export interface RemoveDataItemReferenceRequest { /** ID of the collection containing the referring item. */ dataCollectionId: string; /** Reference to remove. */ dataItemReference: DataItemReference; } export interface RemoveDataItemReferenceResponse { /** Removed reference. */ dataItemReference?: DataItemReference; } export interface BulkInsertDataItemReferencesRequest { /** ID of the collection containing the referring items. */ dataCollectionId: string; /** References to insert. */ dataItemReferences: DataItemReference[]; /** * Whether to return the inserted data item references. * When `true`, the `results` objects contain a `dataItemReference` field. * * Default: `false` */ returnEntity?: boolean; } export interface BulkInsertDataItemReferencesResponse { /** Information about the inserted references. */ results?: BulkDataItemReferenceResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface BulkDataItemReferenceResult { /** The action attempted for the reference. */ action?: BulkActionType; /** Metadata related to the reference for which the action was attempted. */ referenceMetadata?: ItemMetadata; /** The reference for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */ dataItemReference?: DataItemReference; } export interface BulkRemoveDataItemReferencesRequest { /** ID of the collection containing the referring items. */ dataCollectionId: string; /** References to remove. */ dataItemReferences: DataItemReference[]; } export interface BulkRemoveDataItemReferencesResponse { /** Information about the removed references. */ results?: BulkDataItemReferenceResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } export interface ReplaceDataItemReferencesRequest { /** ID of the collection containing the referring item. */ dataCollectionId: string; /** Field containing references in the referring item. */ referringItemFieldName: string; /** ID of the referring item. */ referringItemId: string; /** List of new referenced item IDs to replace the existing ones. */ newReferencedItemIds?: string[]; } export interface ReplaceDataItemReferencesResponse { /** Updated references. */ dataItemReferences?: DataItemReference[]; }