@depict-ai/types
Version:
Autogenerated types of API responses used across Depict UI packages
221 lines (218 loc) • 5.5 kB
TypeScript
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Title of the group, where a group consists of all the filters that share an ID.
*/
export type GroupTitle = string | null;
/**
* Whether the filter group should be expanded by default or not.
*/
export type GroupExpanded = boolean | null;
/**
* Type of filter.
*/
export type Type = "radio" | "checkbox" | "checkbox-grid" | "checkbox-color";
/**
* Selectable values
*/
export type Values = (
| ("true" | "false")
| number
| number
| string
| [string, string]
| [string, number]
| [number, string]
| [number, number]
)[];
/**
* Counts for values
*/
export type Counts = number[];
/**
* Names for values. This is what should be displayed along with the UI item for the value.
*/
export type Names = string[] | null;
/**
* Swatches for values. This is what should be displayed along with the UI item for the value.The values in this list are meant to be used as [CSS background](https://developer.mozilla.org/en-US/docs/Web/CSS/background) values.
*/
export type Swatches = (string | null)[] | null;
/**
* Title of the group, where a group consists of all the filters that share an ID.
*/
export type GroupTitle1 = string | null;
/**
* Whether the filter group should be expanded by default or not.
*/
export type GroupExpanded1 = boolean | null;
export type Type1 = "checkbox-hierarchical";
/**
* Selectable hierarchical values
*/
export type Values1 = string[][];
/**
* Counts for values
*/
export type Counts1 = number[];
/**
* Names for hierarchical values, this is what you should display in the UI (not values)
*/
export type Names1 = string[] | null;
export type SortingOrder = "asc" | "desc";
export interface SearchRequestV3 {
/**
* Used for cursor-based pagination. Set it to the cursor from the last response. If not set, will return the first results.
*/
cursor?: string;
/**
* Used for cursor-based pagination. Maximum number of results per response.
*/
limit?: number;
/**
* Used for Page-based pagination. 1-based index
*/
page?: number;
/**
* Used for Page-based pagination. If using page-based pagination, this is a required field.
*/
hits_per_page?: number;
market: string;
/**
* List of filters to apply to the results.
*/
filters?: SearchFilter[];
sort?: SortModel;
/**
* Session identifier
*/
session_id?: string;
/**
* Metadata that can be used to modify the behaviour of the search.
*/
metadata?: {
[k: string]: string;
};
merchant: string;
locale: string;
/**
* The search query.
*/
query?: string;
}
export interface SearchFilter {
/**
* The field to filter by.
*/
field: string;
/**
* The operation used for filtering. The filtering should be read as `field op data`, for example `brand in ["Nike", "Adidas"]`.
*/
op: "eq" | "neq" | "in" | "nin" | "leq" | "geq" | "inrange";
/**
* Data for the filter.
*/
data?:
| ("true" | "false")
| number
| number
| string
| [string, string]
| [string, number]
| [number, string]
| [number, number]
| (
| ("true" | "false")
| number
| number
| string
| [string, string]
| [string, number]
| [number, string]
| [number, number]
)[]
| string[][];
/**
* Metadata about the filter that can be used for rendering. For example, this could contain the possible values to filter by and their counts in the results.
*/
meta?: RangeFilterMeta | ValuesFilterMeta | HierarchicalValuesFilterMeta;
/**
* ID of the filter. If multiple filters share the same ID, they should be grouped together in the UI.
*/
id?: string;
}
export interface RangeFilterMeta {
/**
* Title of the group, where a group consists of all the filters that share an ID.
*/
group_title?: string;
/**
* Whether the filter group should be expanded by default or not.
*/
group_expanded?: boolean;
type: "range";
/**
* The minimum value that can be selected in the range.
*/
min: number;
/**
* The maximum value that can be selected in the range.
*/
max: number;
/**
* The unit of the range values.
*/
unit?: string;
/**
* The currency of the range values.
*/
currency?: string;
}
export interface ValuesFilterMeta {
group_title?: GroupTitle;
group_expanded?: GroupExpanded;
type: Type;
values: Values;
counts: Counts;
names?: Names;
swatches?: Swatches;
}
export interface HierarchicalValuesFilterMeta {
group_title?: GroupTitle1;
group_expanded?: GroupExpanded1;
type: Type1;
values: Values1;
counts: Counts1;
names?: Names1;
}
/**
* Specifies the sorting method. By default, the results are ordered by relevance. To find the possible values for this field, query the endpoint and look at the `sorts` field.
*/
export interface SortModel {
/**
* The field to sort by.
*/
field: string;
/**
* The order to sort by.
*/
order: SortingOrder;
meta?: SortMeta;
}
/**
* Metadata about the sort that can be used for rendering.
*/
export interface SortMeta {
title: string;
/**
* Selectable values
*/
values?: SortingOrder[];
/**
* Names for orders (this is what you should display in the UI, not values)
*/
names?: string[];
}