From 2375677b23cee6bc85ac2d2cb78c32eb52991dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20CG?= Date: Mon, 28 Oct 2024 10:35:29 +0100 Subject: [PATCH 1/2] feat: add stats to search response --- packages/x-types/src/index.ts | 1 + packages/x-types/src/response/search-response.model.ts | 2 ++ packages/x-types/src/stats.model.ts | 8 ++++++++ 3 files changed, 11 insertions(+) create mode 100644 packages/x-types/src/stats.model.ts diff --git a/packages/x-types/src/index.ts b/packages/x-types/src/index.ts index b27bf45166..a3e60230e5 100644 --- a/packages/x-types/src/index.ts +++ b/packages/x-types/src/index.ts @@ -12,6 +12,7 @@ export * from './previewable.model'; export * from './promoted.model'; export * from './redirection.model'; export * from './sort.model'; +export * from './stats.model'; export * from './suggestion.model'; export * from './tagging.model'; export * from './user-info.model'; diff --git a/packages/x-types/src/response/search-response.model.ts b/packages/x-types/src/response/search-response.model.ts index 7b6a32ff36..b467297fd8 100644 --- a/packages/x-types/src/response/search-response.model.ts +++ b/packages/x-types/src/response/search-response.model.ts @@ -5,6 +5,7 @@ import { Promoted } from '../promoted.model'; import { TaggingRequest } from '../request/tagging-request.model'; import { Redirection } from '../redirection.model'; import { Result } from '../result/result.model'; +import { Stats } from '../stats.model'; /** * Response for the search endpoint. @@ -21,5 +22,6 @@ export interface SearchResponse { redirections?: Redirection[]; results: Result[]; spellcheck?: string; + stats?: Stats; totalResults: number; } diff --git a/packages/x-types/src/stats.model.ts b/packages/x-types/src/stats.model.ts new file mode 100644 index 0000000000..6fc5733c38 --- /dev/null +++ b/packages/x-types/src/stats.model.ts @@ -0,0 +1,8 @@ +/** + * The stats model. + * + * @public + */ +export interface Stats { + price: { min: number; max: number }; +} From ad916c403526b1562b4f1ee2b8d51e19b0217ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20CG?= Date: Thu, 31 Oct 2024 14:39:58 +0100 Subject: [PATCH 2/2] doc: add context for stats model --- packages/x-types/src/stats.model.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/x-types/src/stats.model.ts b/packages/x-types/src/stats.model.ts index 6fc5733c38..ec67ed2fb2 100644 --- a/packages/x-types/src/stats.model.ts +++ b/packages/x-types/src/stats.model.ts @@ -1,5 +1,7 @@ /** - * The stats model. + * Statistics for the current search results. + * + * Price - interval of the prices of the results. * * @public */