/** An index is a map of a collection's data, organized according to specific fields to increase query speed. */ export interface Index { /** Name of the index. */ name?: string; /** * Fields for which the index is defined. * * Max: 3 fields (for a unique index: 1 field) */ fields?: Field[]; /** * Current status of the index. * - `BUILDING`: Index creation is in progress. * - `ACTIVE`: Index has been successfully created and can be used in queries. * - `DROPPING`: Index is in the process of being dropped. * - `DROPPED`: Index has been dropped successfully. * - `FAILED`: Index creation has failed. * - `INVALID`: Index contains incorrectly indexed data. * @readonly */ status?: Status; /** * Contains details about the reasons for failure when `status` is `FAILED`. * @readonly */ failure?: Failure; /** * Whether the index enforces uniqueness of values in the field for which it is defined. * If `true`, the index can have only one field. * * Default: `false` */ unique?: boolean; /** * Whether the index ignores case. * * Default: `false` */ caseInsensitive?: boolean; } /** * Order determines how values are ordered in the index. This is important when * ordering and/or range querying by indexed fields. */ export declare enum Order { ASC = "ASC", DESC = "DESC" } export interface Field { /** Path of the field to index. For example: `title` or `options.price`. */ path?: string; /** * Sort order for the index. Base on how the data is regularly queried. * * Default: `ASC` */ order?: Order; } export declare enum Status { /** Place holder. Never returned by the service. */ UNKNOWN = "UNKNOWN", /** Index creation is in progress. */ BUILDING = "BUILDING", /** Index has been successfully created and can be used in queries. */ ACTIVE = "ACTIVE", /** Index is in the process of being dropped. */ DROPPING = "DROPPING", /** Index has been dropped successfully. */ DROPPED = "DROPPED", /** Index creation has failed. */ FAILED = "FAILED", /** Index contains incorrectly indexed data. */ INVALID = "INVALID" } export interface Failure { /** * Error code. * - `WDE0112`: Unknown error while building collection index. * - `WDE0113`: Duplicate key error while building collection index. * - `WDE0114`: Document too large while building collection index. */ code?: string; /** Description of the failure. */ description?: string; /** * ID of the data item that caused the failure. * For example, if `unique` is `true`, the ID of an item containing a duplicate value. */ itemId?: string | null; } export interface CreateIndexRequest { /** Details of the index to be created. */ index: Index; /** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which to generate the index. */ dataCollectionId?: string; } export declare enum Environment { LIVE = "LIVE", SANDBOX = "SANDBOX" } export interface CreateIndexResponse { /** Details of the index being generated. */ index?: Index; } export interface DropIndexRequest { /** Name of the index to drop. */ indexName: string; /** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which the index to be dropped is defined. */ dataCollectionId?: string; } export interface DropIndexResponse { } export interface ListIndexesRequest { /** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which to list indexes. */ dataCollectionId?: string; } export interface ListIndexesResponse { /** List of all indexes for the requested data collection. */ indexes?: Index[]; }