UNPKG

5.02 kBTypeScriptView Raw
1/* eslint-disable */
2/**
3 * This file was automatically generated by json-schema-to-typescript.
4 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5 * and run json-schema-to-typescript to regenerate this file.
6 */
7
8/**
9 * Title of the group, where a group consists of all the filters that share an ID.
10 */
11export type GroupTitle = string | null;
12/**
13 * Whether the filter group should be expanded by default or not.
14 */
15export type GroupExpanded = boolean | null;
16/**
17 * Type of filter.
18 */
19export type Type = "radio" | "checkbox" | "checkbox-grid" | "checkbox-color";
20/**
21 * Selectable values
22 */
23export type Values = (
24 | ("true" | "false")
25 | number
26 | number
27 | string
28 | [string, string]
29 | [string, number]
30 | [number, string]
31 | [number, number]
32 )[];
33/**
34 * Counts for values
35 */
36export type Counts = number[];
37/**
38 * Names for values. This is what should be displayed along with the UI item for the value.
39 */
40export type Names = string[] | null;
41/**
42 * 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.
43 */
44export type Swatches = (string | null)[] | null;
45/**
46 * Title of the group, where a group consists of all the filters that share an ID.
47 */
48export type GroupTitle1 = string | null;
49/**
50 * Whether the filter group should be expanded by default or not.
51 */
52export type GroupExpanded1 = boolean | null;
53export type Type1 = "checkbox-hierarchical";
54/**
55 * Selectable hierarchical values
56 */
57export type Values1 = string[][];
58/**
59 * Counts for values
60 */
61export type Counts1 = number[];
62/**
63 * Names for hierarchical values, this is what you should display in the UI (not values)
64 */
65export type Names1 = string[] | null;
66export type SortingOrder = "asc" | "desc";
67
68export interface BaseSearchRequestV3 {
69 market: string;
70 /**
71 * List of filters to apply to the results.
72 */
73 filters?: SearchFilter[];
74 sort?: SortModel;
75 /**
76 * Session identifier
77 */
78 session_id?: string;
79 /**
80 * Metadata that can be used to modify the behaviour of the search.
81 */
82 metadata?: {
83 [k: string]: string;
84 };
85 merchant: string;
86 locale: string;
87 /**
88 * The search query.
89 */
90 query?: string;
91}
92export interface SearchFilter {
93 /**
94 * The field to filter by.
95 */
96 field: string;
97 /**
98 * The operation used for filtering. The filtering should be read as `field op data`, for example `brand in ["Nike", "Adidas"]`.
99 */
100 op: "eq" | "neq" | "in" | "nin" | "leq" | "geq" | "inrange";
101 /**
102 * Data for the filter.
103 */
104 data?:
105 | ("true" | "false")
106 | number
107 | number
108 | string
109 | [string, string]
110 | [string, number]
111 | [number, string]
112 | [number, number]
113 | (
114 | ("true" | "false")
115 | number
116 | number
117 | string
118 | [string, string]
119 | [string, number]
120 | [number, string]
121 | [number, number]
122 )[]
123 | string[][];
124 /**
125 * 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.
126 */
127 meta?: RangeFilterMeta | ValuesFilterMeta | HierarchicalValuesFilterMeta;
128 /**
129 * ID of the filter. If multiple filters share the same ID, they should be grouped together in the UI.
130 */
131 id?: string;
132}
133export interface RangeFilterMeta {
134 /**
135 * Title of the group, where a group consists of all the filters that share an ID.
136 */
137 group_title?: string;
138 /**
139 * Whether the filter group should be expanded by default or not.
140 */
141 group_expanded?: boolean;
142 type: "range";
143 /**
144 * The minimum value that can be selected in the range.
145 */
146 min: number;
147 /**
148 * The maximum value that can be selected in the range.
149 */
150 max: number;
151 /**
152 * The unit of the range values.
153 */
154 unit?: string;
155 /**
156 * The currency of the range values.
157 */
158 currency?: string;
159}
160export interface ValuesFilterMeta {
161 group_title?: GroupTitle;
162 group_expanded?: GroupExpanded;
163 type: Type;
164 values: Values;
165 counts: Counts;
166 names?: Names;
167 swatches?: Swatches;
168}
169export interface HierarchicalValuesFilterMeta {
170 group_title?: GroupTitle1;
171 group_expanded?: GroupExpanded1;
172 type: Type1;
173 values: Values1;
174 counts: Counts1;
175 names?: Names1;
176}
177/**
178 * 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.
179 */
180export interface SortModel {
181 /**
182 * The field to sort by.
183 */
184 field: string;
185 /**
186 * The order to sort by.
187 */
188 order: SortingOrder;
189 meta?: SortMeta;
190}
191/**
192 * Metadata about the sort that can be used for rendering.
193 */
194export interface SortMeta {
195 title: string;
196 /**
197 * Selectable values
198 */
199 values?: SortingOrder[];
200 /**
201 * Names for orders (this is what you should display in the UI, not values)
202 */
203 names?: string[];
204}