/** A data collection determines the structure of data to be stored in a database. */ export interface DataCollection { /** Collection ID. For example, `my-first-collection`. May include a namespace. */ id?: string; /** * Collection type. Indicates how the collection was created and is stored. * * * `NATIVE`: User-created collection. * * `WIX_APP`: [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app, including [starter collections](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-starter-collections) created when a Wix app is installed. * * `BLOCKS_APP`: Collection created by a Wix Blocks app. * * `EXTERNAL`: Collection located in externally connected storage. * @readonly */ collectionType?: CollectionType; /** * ID of the app that defined this collection. For user-defined collections, this value is null. * @readonly */ ownerAppId?: string | null; /** * Maximum number of items returned in a single query, based on the underlying storage. * Native collections have a maximum page size of 1000 for offset-based queries or 100 for cursor-based queries. * External collections' maximum page size defaults to 50, but an external provider can set any maximum value up to 1000. * @readonly */ maxPageSize?: number | null; /** Collection's display name as shown in the Content Manager. For example, `My First Collection`. */ displayName?: string | null; /** * Indicates how the collection's items are sorted by default when a query doesn't specify an order. * @readonly */ defaultDisplayOrder?: Sort; /** * UI-friendly namespace of the Wix app with which the data collection is associated, such as Stores or Bookings. * Empty for all data collections not owned by internal Wix apps. */ displayNamespace?: string | null; /** * The field whose value the Content Manager displays to represent the collection item when referenced in a different collection. * @readonly */ displayField?: string; /** * Capabilities the collection supports. * @readonly */ capabilities?: CollectionCapabilities; /** Collection's field structure. A collection must have at least 1 field. */ fields?: Field[]; /** Levels of permission for accessing and modifying data, defined by lowest role needed to perform each action. */ permissions?: Permissions; /** * Collection's current revision number, which increments each time the collection is updated. For an update operation to succeed, you must pass the latest revision number. * @readonly */ revision?: string | null; /** All plugins the collection uses. Plugins apply additional capabilities to the collection or extend its functionality. */ plugins?: Plugin[]; /** * All paging modes the collection supports. In native collections, offset-based paging is supported by default. * @readonly */ pagingModes?: PagingMode[]; /** * Date the collection was created. * @readonly */ createdDate?: Date; /** * Date the collection was last updated. * @readonly */ updatedDate?: Date; } export declare enum CollectionType { /** User-created collection. */ NATIVE = "NATIVE", /** [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). */ WIX_APP = "WIX_APP", /** Collection created by a Wix Blocks app. */ BLOCKS_APP = "BLOCKS_APP", /** Collection located in externally connected storage. */ EXTERNAL = "EXTERNAL" } export interface Sort { /** Field to sort by. */ fieldKey?: string; /** * Sort order. Use `ASC` for ascending order or `DESC` for descending order. * * Default: `ASC` */ direction?: Direction; } export declare enum Direction { ASC = "ASC", DESC = "DESC" } export interface CollectionCapabilities { /** Data operations the collection supports. */ dataOperations?: DataOperation[]; } export declare enum DataOperation { AGGREGATE = "AGGREGATE", BULK_INSERT = "BULK_INSERT", BULK_REMOVE = "BULK_REMOVE", BULK_SAVE = "BULK_SAVE", BULK_UPDATE = "BULK_UPDATE", COUNT = "COUNT", DISTINCT = "DISTINCT", FIND = "FIND", GET = "GET", INSERT = "INSERT", INSERT_REFERENCE = "INSERT_REFERENCE", IS_REFERENCED = "IS_REFERENCED", QUERY_REFERENCED = "QUERY_REFERENCED", REMOVE = "REMOVE", REMOVE_REFERENCE = "REMOVE_REFERENCE", REPLACE_REFERENCES = "REPLACE_REFERENCES", SAVE = "SAVE", TRUNCATE = "TRUNCATE", UPDATE = "UPDATE" } export interface Field extends FieldRangeValidationsOneOf { /** Range of possible values for a numerical field. */ numberRange?: NumberRange; /** Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. */ stringLengthRange?: StringLengthRange; /** Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. */ arraySizeRange?: ArraySizeRange; /** Unique identifier for the field. For example, `firstName`. */ key?: string; /** Field's display name when shown in the Content Manager. For example, `First Name`. */ displayName?: string; /** Field's data type. */ type?: TypeEnum; /** Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. */ typeMetadata?: TypeMetadata; /** * Whether the field is a system field (created automatically). * @readonly */ systemField?: boolean; /** Capabilities the field supports. */ capabilities?: FieldCapabilities; /** Indicates if field is encrypted. */ encrypted?: boolean; /** Defines reference to router pattern in the site document. */ linkedRouterPage?: string | null; /** Description of the field. */ description?: string | null; plugin?: string | null; /** * Whether the field is read-only. A read-only field can't be changed. * * Default: `false` */ readOnly?: boolean | null; /** * Whether the field is immutable. An immutable field can be set once, but then cannot be updated. * * Default: `false` */ immutable?: boolean | null; /** * Whether the field is required. * * Default: `false` */ required?: boolean | null; } /** @oneof */ export interface FieldRangeValidationsOneOf { /** Range of possible values for a numerical field. */ numberRange?: NumberRange; /** Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. */ stringLengthRange?: StringLengthRange; /** Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. */ arraySizeRange?: ArraySizeRange; } export declare enum TypeEnum { TEXT = "TEXT", NUMBER = "NUMBER", DATE = "DATE", DATETIME = "DATETIME", IMAGE = "IMAGE", BOOLEAN = "BOOLEAN", DOCUMENT = "DOCUMENT", URL = "URL", RICH_TEXT = "RICH_TEXT", VIDEO = "VIDEO", ANY = "ANY", ARRAY_STRING = "ARRAY_STRING", ARRAY_DOCUMENT = "ARRAY_DOCUMENT", AUDIO = "AUDIO", TIME = "TIME", LANGUAGE = "LANGUAGE", RICH_CONTENT = "RICH_CONTENT", MEDIA_GALLERY = "MEDIA_GALLERY", ADDRESS = "ADDRESS", PAGE_LINK = "PAGE_LINK", REFERENCE = "REFERENCE", MULTI_REFERENCE = "MULTI_REFERENCE", OBJECT = "OBJECT", ARRAY = "ARRAY", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_TIME = "LEGACY_TIME", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_BOOK = "LEGACY_BOOK", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_EXTERNAL_URL = "LEGACY_EXTERNAL_URL", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_BROKEN_REFERENCE = "LEGACY_BROKEN_REFERENCE", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_IMAGE = "LEGACY_IMAGE", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_COLOR = "LEGACY_COLOR", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_EXTERNAL_VIDEO = "LEGACY_EXTERNAL_VIDEO" } export interface TypeMetadata extends TypeMetadataMetadataOneOf { /** Metadata for a reference field. */ reference?: Reference; /** Metadata for a multi-reference field. */ multiReference?: MultiReference; /** Metadata for an object field. */ object?: Object; /** Metadata for an array field. */ array?: Array; /** Metadata for a page link field. */ pageLink?: PageLink; } /** @oneof */ export interface TypeMetadataMetadataOneOf { /** Metadata for a reference field. */ reference?: Reference; /** Metadata for a multi-reference field. */ multiReference?: MultiReference; /** Metadata for an object field. */ object?: Object; /** Metadata for an array field. */ array?: Array; /** Metadata for a page link field. */ pageLink?: PageLink; } export interface FieldCapabilities { /** * Whether the collection can be sorted by this field. * * Default: `false` */ sortable?: boolean; /** Query operators that can be used for this field. */ queryOperators?: QueryOperator[]; } export declare enum QueryOperator { EQ = "EQ", LT = "LT", GT = "GT", NE = "NE", LTE = "LTE", GTE = "GTE", STARTS_WITH = "STARTS_WITH", ENDS_WITH = "ENDS_WITH", CONTAINS = "CONTAINS", HAS_SOME = "HAS_SOME", HAS_ALL = "HAS_ALL", EXISTS = "EXISTS", URLIZED = "URLIZED" } export interface ObjectField { /** Field key. */ key?: string; /** Display name for the field. */ displayName?: string; /** Field type. */ type?: TypeEnum; /** Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. */ typeMetadata?: TypeMetadata; /** Capabilities the object field supports. */ capabilities?: FieldCapabilities; } export interface FieldsPattern { pattern?: string; lowercase?: boolean; } export interface UrlizedOnlyPattern { pattern?: string; } export interface Calculator extends CalculatorPatternOneOf { /** Value is calculated according to pattern, whitespaces are replaced with dash [-]. */ fieldsPattern?: FieldsPattern; /** Value is only URL encoded. */ urlizedOnlyPattern?: UrlizedOnlyPattern; id?: string; } /** @oneof */ export interface CalculatorPatternOneOf { /** Value is calculated according to pattern, whitespaces are replaced with dash [-]. */ fieldsPattern?: FieldsPattern; /** Value is only URL encoded. */ urlizedOnlyPattern?: UrlizedOnlyPattern; } export interface Reference { /** Referenced collection ID. */ referencedCollectionId?: string; } export interface MultiReference { /** Referenced collection ID. */ referencedCollectionId?: string; /** Referencing field key. */ referencingFieldKey?: string; /** Display name in the Content Manager for the referenced data. */ referencingDisplayName?: string; } export interface Object { /** Fields within the object. */ fields?: ObjectField[]; } export interface Array { /** Element's data type. */ elementType?: TypeEnum; /** Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. */ typeMetadata?: TypeMetadata; } export interface PageLink { calculator?: Calculator; } export interface NumberRange { /** * Minimum permitted value for a numerical field. * * Default: No validation */ min?: number | null; /** * Maximum permitted value for a numerical field. * * Default: No validation */ max?: number | null; } export interface StringLengthRange { /** * Minimum permitted length for a text field. * * Default: No validation */ minLength?: number | null; /** * Maximum permitted length for a text field. * * Default: No validation */ maxLength?: number | null; } export interface ArraySizeRange { /** * Minimum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. * * Default: No validation */ minSize?: number | null; /** * Maximum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. * * Default: No validation */ maxSize?: number | null; } /** Permissions defined by the lowest role needed to perform each action. */ export interface Permissions { /** Lowest role needed to add a collection. */ insert?: Role; /** Lowest role needed to update a collection. */ update?: Role; /** Lowest role needed to remove a collection. */ remove?: Role; /** Lowest role needed to read a collection. */ read?: Role; } export declare enum Role { /** Site administrator. */ ADMIN = "ADMIN", /** Signed-in user who added content to this collection. */ SITE_MEMBER_AUTHOR = "SITE_MEMBER_AUTHOR", /** Any signed-in user. */ SITE_MEMBER = "SITE_MEMBER", /** Any site visitor. */ ANYONE = "ANYONE" } export interface Plugin extends PluginOptionsOneOf { /** Options for the Publish plugin. */ publishOptions?: PublishPluginOptions; /** Options for the Single Item plugin. */ singleItemOptions?: SingleItemPluginOptions; /** Options for the Urlized plugin. */ urlizedOptions?: UrlizedPluginOptions; /** Options for Gridappless plugin. */ gridapplessOptions?: GridapplessPluginOptions; /** * Plugin types. The following plugins are supported: * * * `PUBLISH`: Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. * * `SINGLE_ITEM`: Ensures the collection can have one item at most. Can only be applied to a new collection. * * `URLIZED`: Generates item URLs for collections used by dynamic pages. * * `GRIDAPPLESS`: This plugin is read-only and can't be manually added. Indicates the collection structure is shared between sandbox and live environments. */ type?: Type; } /** @oneof */ export interface PluginOptionsOneOf { /** Options for the Publish plugin. */ publishOptions?: PublishPluginOptions; /** Options for the Single Item plugin. */ singleItemOptions?: SingleItemPluginOptions; /** Options for the Urlized plugin. */ urlizedOptions?: UrlizedPluginOptions; /** Options for Gridappless plugin. */ gridapplessOptions?: GridapplessPluginOptions; } export declare enum Status { PUBLISHED = "PUBLISHED", DRAFT = "DRAFT" } export declare enum Format { ORIGINAL = "ORIGINAL", PLAIN = "PLAIN" } export declare enum Type { /** Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. */ PUBLISH = "PUBLISH", /** Ensures the collection can have one item at most. Can only be applied to a new collection. */ SINGLE_ITEM = "SINGLE_ITEM", /** Generates item URLs for collections used by dynamic pages. */ URLIZED = "URLIZED", /** This plugin is read-only and can't be manually added. Indicates collection structure is shared between sandbox and live environments. */ GRIDAPPLESS = "GRIDAPPLESS" } export interface PublishPluginOptions { /** Default status. */ defaultStatus?: Status; } export interface SingleItemPluginOptions { /** ID of the single item in this collection. If you insert or update an item, its ID value is always changed to this. */ singleItemId?: string; } export interface UrlizedPluginOptions { /** * Encoding method for generating a URL in ASCII characters. * * * `ORIGINAL`: Letters are converted to lower case and spaces are replaced with dashes before generating the encoded URL. * * `PLAIN`: No changes are made before generating the encoded URL. */ format?: Format; } export interface GridapplessPluginOptions { /** indicates if tenant is migrated to gridappless or initially on it */ migrated?: boolean; } export declare enum PagingMode { /** Offset-based paging. */ OFFSET = "OFFSET", /** Cursor-based paging. */ CURSOR = "CURSOR" } export interface DataCollectionClonedEvent { /** original instance collection is cloned from */ originInstanceId?: string; /** original collection ID, may be same as current one */ originId?: string; } export interface DataCollectionChangedEvent { /** list of new fields */ fieldsAdded?: Field[]; /** list of changed fields */ fieldsUpdated?: Field[]; /** list of removed fields */ fieldsRemoved?: Field[]; /** list of new plugins */ pluginsAdded?: Plugin[]; /** list of changed plugins */ pluginsUpdated?: Plugin[]; /** list of removed plugins */ pluginsRemoved?: Plugin[]; } export interface CreateDataCollectionRequest { /** Collection details. */ collection?: DataCollection; } export interface CreateDataCollectionResponse { /** Details of collection created. */ collection?: DataCollection; } export interface GetDataCollectionRequest { /** ID of the collection to retrieve. */ dataCollectionId: string; /** * Whether to return all collections referenced by the requested collection. * * Default: `false` */ includeReferencedCollections?: boolean; } export interface GetDataCollectionResponse { /** Details of the collection requested. */ collection?: DataCollection; /** * Details of collections referenced by the collection requested. * Only populated when `includeReferencedCollections` is `true` in the request. */ referencedCollections?: DataCollection[]; } export interface ListDataCollectionsRequest extends ListDataCollectionsRequestPagingMethodOneOf { /** Offset-based paging. */ paging?: Paging; /** Cursor-based paging. */ cursorPaging?: CursorPaging; /** * Defines how collections in the response are sorted. * * Default: Ordered by ID in ascending order. */ sort?: Sorting; } /** @oneof */ export interface ListDataCollectionsRequestPagingMethodOneOf { /** Offset-based paging. */ paging?: Paging; /** Cursor-based paging. */ 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 ListDataCollectionsResponse { /** List of collections. */ collections?: DataCollection[]; /** 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 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 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 BulkGetDataCollectionsRequest { /** IDs of the collections to retrieve. */ dataCollectionIds?: string[]; /** * Whether to include deleted collections. * * Default: `false` */ showDeletedCollections?: boolean; /** * Whether the returned collection list should include referenced collections. * * Default: `false` */ includeReferencedCollections?: boolean; /** Sorting preferences. */ sort?: Sorting; } export interface BulkGetDataCollectionsResponse { /** * List of requested collections. * When `include_referenced_collections` is `true` in the request, referenced collections are included here. */ activeCollections?: DataCollection[]; /** List of requested deleted collections. Only populated when `showDeletedCollections` is true in the request. */ deletedCollections?: DataCollection[]; } export interface BulkGetDataCollectionsBySnapshotsRequest { /** Ids of schema snapshot */ snapshotIds?: string[]; } export interface BulkGetDataCollectionsBySnapshotsResponse { /** List of snapshot collection map */ snapshotCollections?: SnapshotDataCollections[]; } export interface SnapshotDataCollections { snapshotId?: string; collections?: DataCollection[]; } export interface UpdateDataCollectionRequest { /** Updated collection details. The existing collection is replaced with this version. */ collection?: DataCollection; } export interface UpdateDataCollectionResponse { /** Updated collection details. */ collection?: DataCollection; } export interface DeleteDataCollectionRequest { /** ID of the collection to delete. */ dataCollectionId: string; } export interface DeleteDataCollectionResponse { }