/** 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. * @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 for which to generate the index. */ dataCollectionId: string; } export declare enum Environment { LIVE = "LIVE", SANDBOX = "SANDBOX", SANDBOX_PREFERRED = "SANDBOX_PREFERRED" } 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 for which the index to be dropped is defined. */ dataCollectionId: string; } export interface DropIndexResponse { } export interface ListIndexesRequest { /** ID of the data collection for which to list indexes. */ dataCollectionId: string; /** Paging options to limit and skip the number of items. */ 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 ListIndexesResponse { /** List of all indexes for the requested data collection. */ indexes?: Index[]; /** Paging metadata. */ pagingMetadata?: PagingMetadata; } export interface PagingMetadata { /** 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. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; } export interface ListAvailableIndexesRequest { /** Data collection to show available indexes for */ dataCollectionId?: string; } export interface ListAvailableIndexesResponse { /** * limit of regular single-field indexes, even if 0 1-field indices may be created using * 3-field quota (if available) */ regular1Field?: number; /** limit of regular indexes up to 3-fields (in addition to 1-field indexes quota) */ regular3Field?: number; /** limit of unique indexes */ unique1Field?: number; /** Overall index limit, missing value means there's no overall limit */ total?: number | null; } interface FieldNonNullableFields { path: string; order: Order; } interface FailureNonNullableFields { code: string; broadCode: string; description: string; } interface IndexNonNullableFields { name: string; fields: FieldNonNullableFields[]; status: Status; failure?: FailureNonNullableFields; unique: boolean; caseInsensitive: boolean; } export interface CreateIndexResponseNonNullableFields { index?: IndexNonNullableFields; } export interface ListIndexesResponseNonNullableFields { indexes: IndexNonNullableFields[]; } export {};