import { NonNullablePaths } from '@wix/sdk-types'; /** A semantic model that defines the measures, dimensions, and parameters available for querying site performance data, such as traffic, revenue, and engagement metrics. */ interface SemanticModel { /** * Semantic model ID or slug. Mirrors the `id` in the model definition and is the canonical identifier used in `model_id` parameters for `Get Model` and `Query Model Data`. * @readonly * @maxLength 5120 */ _id?: string; /** Semantic model definition, including its available measures, dimensions, and parameters. */ definition?: Model; } /** A semantic data model that defines the available measures, dimensions, and parameters for querying site analytics data. */ interface Model { /** * Model ID. * @readonly * @maxLength 5120 */ _id?: string; /** * URL-friendly identifier for the model. * @maxLength 5120 */ slug?: string; /** Model version number. */ version?: number; /** * Quantitative fields available for aggregation, such as revenue, page views, or order count. * @maxSize 1000 */ measures?: ModelField[]; /** * Categorical fields available for grouping data, such as traffic source, country, or product name. * @maxSize 1000 */ dimensions?: ModelField[]; /** * Optional inputs that customize query behavior, such as currency or date granularity. * @maxSize 1000 */ parameters?: ModelField[]; /** * Human-readable description of the model. * @maxLength 5120 */ description?: string | null; /** * Keywords associated with the model for search and discovery. * @maxSize 100 * @maxLength 5120 */ keywords?: string[] | null; } /** Modifier applied to a filter condition. Combine with `ModelFilterConditionEnum` to create expressions such as "is equal" or "is not equal". */ declare enum ModelFilterPrefixEnum { /** Positive match. For example, `IS` + `EQUAL` means "is equal to". */ IS = "IS", /** Negated match. For example, `NOT` + `EQUAL` means "is not equal to". */ NOT = "NOT" } /** @enumType */ type ModelFilterPrefixEnumWithLiterals = ModelFilterPrefixEnum | 'IS' | 'NOT'; /** Comparison condition for a filter. Used together with `ModelFilterPrefixEnum` to build filter expressions. */ declare enum ModelFilterConditionEnum { /** Value equals the filter value. */ EQUAL = "EQUAL", /** Value is greater than the filter value. */ GREATER_THAN = "GREATER_THAN", /** Value is greater than or equal to the filter value. */ GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL", /** Value is less than the filter value. */ LESS_THAN = "LESS_THAN", /** Value is less than or equal to the filter value. */ LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL", /** Value is null. */ NULL = "NULL", /** Value is an empty string. */ EMPTY = "EMPTY", /** String value starts with the filter value. */ START_WITH = "START_WITH", /** String value ends with the filter value. */ END_WITH = "END_WITH", /** For strings, matches if any of the filter values appear as a substring. For arrays, matches if any of the filter values are present in the array. */ CONTAINS_ANY = "CONTAINS_ANY", /** Inclusive start, inclusive end range. The value must fall within `[a, b]`. */ RANGE_II = "RANGE_II", /** Inclusive start, exclusive end range. The value must fall within `[a, b)`. */ RANGE_IE = "RANGE_IE", /** Exclusive start, inclusive end range. The value must fall within `(a, b]`. */ RANGE_EI = "RANGE_EI", /** Exclusive start, exclusive end range. The value must fall within `(a, b)`. */ RANGE_EE = "RANGE_EE", /** For strings, matches if all filter values appear as substrings. For arrays, matches if all filter values are present in the array. */ CONTAINS_ALL = "CONTAINS_ALL" } /** @enumType */ type ModelFilterConditionEnumWithLiterals = ModelFilterConditionEnum | 'EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'NULL' | 'EMPTY' | 'START_WITH' | 'END_WITH' | 'CONTAINS_ANY' | 'RANGE_II' | 'RANGE_IE' | 'RANGE_EI' | 'RANGE_EE' | 'CONTAINS_ALL'; /** Value of a single field in a data row. Contains both the raw typed value and an optional formatted string representation. */ interface ModelFieldValue extends ModelFieldValueValueOneOf { /** Numeric value. */ numericValue?: number | null; /** Date and time value. */ timestampValue?: Date | null; /** Boolean value. */ booleanValue?: boolean | null; /** * String value. * @maxLength 5120 */ stringValue?: string | null; /** Array value. */ arrayValue?: any[] | null; /** Object value with key-value pairs. */ objectValue?: Record | null; /** * Human-readable string representation of the value. Populated when `formattingEnabled` is `true` in the request. * @maxLength 5120 */ formattedValue?: string | null; } /** @oneof */ interface ModelFieldValueValueOneOf { /** Numeric value. */ numericValue?: number | null; /** Date and time value. */ timestampValue?: Date | null; /** Boolean value. */ booleanValue?: boolean | null; /** * String value. * @maxLength 5120 */ stringValue?: string | null; /** Array value. */ arrayValue?: any[] | null; /** Object value with key-value pairs. */ objectValue?: Record | null; } /** Data type of a model field. */ declare enum ModelFieldTypeEnum { /** Unknown field type. */ UNKNOWN = "UNKNOWN", /** String. */ STRING = "STRING", /** Number. */ NUMBER = "NUMBER", /** Boolean. */ BOOLEAN = "BOOLEAN", /** Date without time. */ DATE = "DATE", /** Date and time. */ DATE_TIME = "DATE_TIME", /** Structured object with key-value pairs. */ OBJECT = "OBJECT", /** Array of values. */ ARRAY = "ARRAY" } /** @enumType */ type ModelFieldTypeEnumWithLiterals = ModelFieldTypeEnum | 'UNKNOWN' | 'STRING' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATE_TIME' | 'OBJECT' | 'ARRAY'; /** Supported filter operations for a model field. */ interface ModelFieldFilters { /** * Supported prefix modifiers for this field. * @maxSize 100 */ prefixes?: ModelFilterPrefixEnumWithLiterals[]; /** * Supported comparison conditions for this field. * @maxSize 100 */ conditions?: ModelFilterConditionEnumWithLiterals[]; } /** Exposure (or visibility) */ declare enum FieldVisibilityEnum { /** Visible for all */ ALL = "ALL", /** Visible to API only */ API = "API", /** Users */ USERS = "USERS" } /** @enumType */ type FieldVisibilityEnumWithLiterals = FieldVisibilityEnum | 'ALL' | 'API' | 'USERS'; /** Definition of a single field within a semantic model, including its type, supported filters, and formatting options. */ interface ModelField { /** * Field name. Use this value in the `fields` array of a query request to retrieve this field's data. * @maxLength 5120 */ name?: string; /** Data type of the field. */ type?: ModelFieldTypeEnumWithLiterals; /** Supported filter operations for this field. */ filters?: ModelFieldFilters; /** Formatting configuration for the field's values, compatible with the JavaScript `Intl` API. */ format?: Record | null; /** * Grouping identifier. Fields with the same `groupSlug` are logically related. * @maxLength 5120 */ groupSlug?: string | null; /** * Human-readable description of what this field represents. * @maxLength 5120 */ description?: string | null; /** * Fields that must also be included in the query for this field to return data. If the dependencies aren't met, this field is silently omitted from results. * @maxSize 100 * @maxLength 5120 */ dependsOn?: string[] | null; } /** Request for querying data from a semantic model. */ interface QueryModelDataRequest { /** * ID or slug of the model to query. Call `List Models` to retrieve available model IDs. * @maxLength 5120 */ modelId: string; /** Time interval for the data query. */ interval: DateTimeInterval; /** * List of field names to retrieve from the model. Call `Get Model` to retrieve the model's available fields. Fields with unmet dependencies (see the `depends_on` property in the model schema) are silently omitted from results. * @maxSize 60 * @maxLength 5120 */ fields: string[] | null; /** Sort order for the results. Supports sorting by a single field only. */ sort?: Sorting; /** * Filters to apply to the data query. Supported conditions: `EQUAL`, `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, `LESS_THAN`, `LESS_THAN_OR_EQUAL`, `NULL`, `EMPTY`, `START_WITH`, `END_WITH`, `CONTAINS_ANY`, `CONTAINS_ALL`, `RANGE_II` (inclusive start, inclusive end), `RANGE_IE` (inclusive start, exclusive end), `RANGE_EI` (exclusive start, inclusive end), and `RANGE_EE` (exclusive start, exclusive end). * @maxSize 60 */ filters?: FieldFilter[]; /** Pagination options. */ paging?: Paging; /** * Whether to format numeric values as human-readable strings. For example, `1500` displays as `$1,500.00` or `1.5K` when enabled. * * Default: `false` */ formattingEnabled?: boolean | null; /** Cache control settings. */ cacheControl?: Control; /** * Whether to include a totals row in the response. When `true`, the `totals` field contains the sum of all numeric fields across the full (unpaginated) result set. * * Default: `false` */ totalsIncluded?: boolean | null; } /** Date time interval */ interface DateTimeInterval { /** Period start date in UTC. */ start?: Date | null; /** Period end date in UTC. */ end?: Date | null; /** * Timezone * @maxLength 1024 */ timezone?: string | null; } /** Sorting options. */ interface Sorting { /** * Order by field * @maxLength 5120 */ fieldName?: string; /** Order direction */ order?: SortOrderWithLiterals; /** Place NULL values last in the result set (relevant for DESC order) */ nullsLast?: boolean | null; } /** Order direction. */ declare enum SortOrder { /** Ascending order. */ ASC = "ASC", /** Descending order. */ DESC = "DESC" } /** @enumType */ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC'; /** Filter to apply to a specific field when querying model data. */ interface FieldFilter { /** * Name of the field to filter by. Must match a field name from the model's measures or dimensions. * @maxLength 5120 */ field?: string; /** * Values to compare against. For range conditions, provide exactly 2 values representing the start and end of the range. * @maxLength 5120 * @maxSize 100 */ values?: string[]; /** * Whether to match or negate the condition. * * Default: `IS` */ prefix?: ModelFilterPrefixEnumWithLiterals; /** * Comparison condition to apply. * * Default: `EQUAL` */ condition?: ModelFilterConditionEnumWithLiterals; } /** Paging */ interface Paging { /** * Number of items to load. * @max 5000 */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } /** Cache control. */ interface Control { /** Cache control. */ cacheControl?: CacheControlEnumWithLiterals; /** Max age in seconds. */ maxAge?: number | null; } /** Cache control options. */ declare enum CacheControlEnum { /** Allow stale cache, returns data even if greater than max age. */ ALLOW_STALE = "ALLOW_STALE", /** Like stale, but if result is stale, update in background. */ UPDATE_AFTER = "UPDATE_AFTER", /** Use cache, but refresh data if stale before returning. */ NO_STALE = "NO_STALE", /** No cache. */ NO_CACHE = "NO_CACHE" } /** @enumType */ type CacheControlEnumWithLiterals = CacheControlEnum | 'ALLOW_STALE' | 'UPDATE_AFTER' | 'NO_STALE' | 'NO_CACHE'; /** Response for querying data from a semantic model. */ interface QueryModelDataResponse { /** * Retrieved data rows. * @readonly * @maxSize 1000 */ results?: ModelFieldDataRow[]; /** Cache status of the response. */ cacheStatus?: Status; /** * Pagination metadata. * @readonly */ pagingMetadata?: PagingMetadata; /** * Totals row with the sum of all numeric fields across the full result set. * * Returned only when `totalsIncluded` is `true`. * @readonly */ totals?: ModelFieldDataRow; } /** Single row of query results. Each entry maps a field name to its value. */ interface ModelFieldDataRow { /** * Map of field name to its value for this row. * @maxSize 100 */ fields?: Record; } /** Cache status. */ interface Status { /** Cache status. */ status?: CacheSatusEnumWithLiterals; /** Updated at. */ createdAt?: Date | null; /** Expires at. */ expiresAt?: Date | null; } /** Cache status. */ declare enum CacheSatusEnum { /** Missed cache. */ MISS = "MISS", /** Served from cache. */ HIT = "HIT", /** Found in cache but expired. */ STALE = "STALE" } /** @enumType */ type CacheSatusEnumWithLiterals = CacheSatusEnum | 'MISS' | 'HIT' | 'STALE'; /** PagingMetadata */ interface PagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; } /** Request for retrieving a semantic model by ID or slug. */ interface GetModelRequest { /** * ID or slug of the model to retrieve. Call `List Models` to retrieve available model IDs. * @maxLength 5120 */ modelId: string; } /** Response for retrieving a semantic model. */ interface GetModelResponse { /** Retrieved semantic model. */ model?: Model; } /** Request for listing all available semantic models. */ interface ListModelsRequest { } /** Response for listing all available semantic models. */ interface ListModelsResponse { /** * Available semantic models. * @maxSize 100 */ models?: Model[]; } /** @docsIgnore */ type QueryModelDataApplicationErrors = { code?: 'NO_ACCOUNT_IDENTITY'; description?: string; data?: Record; }; /** @docsIgnore */ type GetModelApplicationErrors = { code?: 'NO_ACCOUNT_IDENTITY'; description?: string; data?: Record; } | { code?: 'MODEL_NOT_FOUND'; description?: string; data?: Record; }; /** @docsIgnore */ type ListModelsApplicationErrors = { code?: 'NO_ACCOUNT_IDENTITY'; description?: string; data?: Record; }; /** * Retrieves data from a semantic model, given the provided fields, filters, sorting, and paging. * * * Query Model Data runs with these defaults, which you can override: * * - `paging.limit` is `50` * - `paging.offset` is `0` * * To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection). * @param modelId - ID or slug of the model to query. Call `List Models` to retrieve available model IDs. * @public * @documentationMaturity preview * @requiredField modelId * @requiredField options.fields * @requiredField options.interval * @permissionId analytics:model:v3:model:query_model_data * @applicableIdentity APP * @returns Response for querying data from a semantic model. * @fqn wix.analytics.model.v3.SemanticModelsService.QueryModelData */ declare function queryModelData(modelId: string, options?: NonNullablePaths): Promise & { __applicationErrorsType?: QueryModelDataApplicationErrors; }>; interface QueryModelDataOptions { /** Time interval for the data query. */ interval: DateTimeInterval; /** * List of field names to retrieve from the model. Call `Get Model` to retrieve the model's available fields. Fields with unmet dependencies (see the `depends_on` property in the model schema) are silently omitted from results. * @maxSize 60 * @maxLength 5120 */ fields: string[] | null; /** Sort order for the results. Supports sorting by a single field only. */ sort?: Sorting; /** * Filters to apply to the data query. Supported conditions: `EQUAL`, `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, `LESS_THAN`, `LESS_THAN_OR_EQUAL`, `NULL`, `EMPTY`, `START_WITH`, `END_WITH`, `CONTAINS_ANY`, `CONTAINS_ALL`, `RANGE_II` (inclusive start, inclusive end), `RANGE_IE` (inclusive start, exclusive end), `RANGE_EI` (exclusive start, inclusive end), and `RANGE_EE` (exclusive start, exclusive end). * @maxSize 60 */ filters?: FieldFilter[]; /** Pagination options. */ paging?: Paging; /** * Whether to format numeric values as human-readable strings. For example, `1500` displays as `$1,500.00` or `1.5K` when enabled. * * Default: `false` */ formattingEnabled?: boolean | null; /** Cache control settings. */ cacheControl?: Control; /** * Whether to include a totals row in the response. When `true`, the `totals` field contains the sum of all numeric fields across the full (unpaginated) result set. * * Default: `false` */ totalsIncluded?: boolean | null; } /** * Retrieves a semantic model by ID or slug. * @param modelId - ID or slug of the model to retrieve. Call `List Models` to retrieve available model IDs. * @public * @documentationMaturity preview * @requiredField modelId * @permissionId analytics:model:v3:model:get_model * @applicableIdentity APP * @returns Response for retrieving a semantic model. * @fqn wix.analytics.model.v3.SemanticModelsService.GetModel */ declare function getModel(modelId: string): Promise & { __applicationErrorsType?: GetModelApplicationErrors; }>; /** * Retrieves a list of all available semantic models. * @public * @documentationMaturity preview * @permissionId analytics:model:v3:model:list_models * @applicableIdentity APP * @returns Response for listing all available semantic models. * @fqn wix.analytics.model.v3.SemanticModelsService.ListModels */ declare function listModels(): Promise & { __applicationErrorsType?: ListModelsApplicationErrors; }>; export { CacheControlEnum, type CacheControlEnumWithLiterals, CacheSatusEnum, type CacheSatusEnumWithLiterals, type Control, type DateTimeInterval, type FieldFilter, FieldVisibilityEnum, type FieldVisibilityEnumWithLiterals, type GetModelApplicationErrors, type GetModelRequest, type GetModelResponse, type ListModelsApplicationErrors, type ListModelsRequest, type ListModelsResponse, type Model, type ModelField, type ModelFieldDataRow, type ModelFieldFilters, ModelFieldTypeEnum, type ModelFieldTypeEnumWithLiterals, type ModelFieldValue, type ModelFieldValueValueOneOf, ModelFilterConditionEnum, type ModelFilterConditionEnumWithLiterals, ModelFilterPrefixEnum, type ModelFilterPrefixEnumWithLiterals, type Paging, type PagingMetadata, type QueryModelDataApplicationErrors, type QueryModelDataOptions, type QueryModelDataRequest, type QueryModelDataResponse, type SemanticModel, SortOrder, type SortOrderWithLiterals, type Sorting, type Status, getModel, listModels, queryModelData };