Skip to content

Commit e282cdd

Browse files
refactor(specs): re-organise response for Composition API (generated)
algolia/api-clients-automation#5744 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clara Muller <5667350+ClaraMuller@users.noreply.github.com>
1 parent 4975684 commit e282cdd

10 files changed

+34
-37
lines changed

packages/composition/model/compositionBaseSearchResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import type { CompositionsSearchResponse } from './compositionsSearchResponse';
44

5-
export type CompositionBaseSearchResponse = Record<string, any> & {
5+
export type CompositionBaseSearchResponse = {
66
compositions?: CompositionsSearchResponse | undefined;
77
};

packages/composition/model/compositionRunAppliedRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export type CompositionRunAppliedRules = {
44
/**
5-
* Unique record identifier.
5+
* The objectID of the applied composition rule on this query.
66
*/
77
objectID: string;
88
};

packages/composition/model/compositionRunSearchResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { CompositionRunAppliedRules } from './compositionRunAppliedRules';
44

55
export type CompositionRunSearchResponse = Record<string, any> & {
66
/**
7-
* Unique record identifier.
7+
* The objectID of the composition which generated this result set.
88
*/
99
objectID: string;
1010

packages/composition/model/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,11 @@ export * from './rulesMultipleBatchResponse';
9595
export * from './search';
9696
export * from './searchCompositionRulesParams';
9797
export * from './searchCompositionRulesResponse';
98+
export * from './searchFields';
9899
export * from './searchForFacetValuesParams';
99100
export * from './searchForFacetValuesRequest';
100101
export * from './searchForFacetValuesResponse';
101102
export * from './searchForFacetValuesResults';
102-
export * from './searchHits';
103-
export * from './searchPagination';
104103
export * from './searchResponse';
105104
export * from './searchResults';
106105
export * from './searchResultsItem';

packages/composition/model/resultsCompositionsResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import type { ResultsCompositionInfoResponse } from './resultsCompositionInfoResponse';
44

5-
export type ResultsCompositionsResponse = Record<string, any> & {
5+
export type ResultsCompositionsResponse = {
66
compositions: { [key: string]: ResultsCompositionInfoResponse };
77
};

packages/composition/model/resultsInjectedItemAppliedRulesInfoResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export type ResultsInjectedItemAppliedRulesInfoResponse = {
44
/**
5-
* Unique record identifier.
5+
* The objectID of the applied index level rule on this injected group.
66
*/
77
objectID: string;
88
};

packages/composition/model/resultsInjectedItemInfoResponse.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import type { ResultsInjectedItemAppliedRulesInfoResponse } from './resultsInjectedItemAppliedRulesInfoResponse';
44

55
export type ResultsInjectedItemInfoResponse = Record<string, any> & {
6+
/**
7+
* The key of the injected group.
8+
*/
69
key: string;
710

811
appliedRules?: Array<ResultsInjectedItemAppliedRulesInfoResponse> | undefined;

packages/composition/model/searchHits.ts renamed to packages/composition/model/searchFields.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,39 @@
22

33
import type { Hit } from './hit';
44

5-
export type SearchHits<T = Record<string, unknown>> = Record<string, any> & {
5+
export type SearchFields<T = Record<string, unknown>> = {
66
/**
77
* Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
88
*/
99
hits: Hit<T>[];
1010

1111
/**
12-
* The search query string.
12+
* Number of hits returned per page.
1313
*/
14-
query: string;
14+
hitsPerPage: number;
15+
16+
/**
17+
* Number of results (hits).
18+
*/
19+
nbHits: number;
20+
21+
/**
22+
* Number of pages of results.
23+
*/
24+
nbPages: number;
25+
26+
/**
27+
* The current page of the results.
28+
*/
29+
page: number;
1530

1631
/**
1732
* URL-encoded string of all search parameters.
1833
*/
1934
params: string;
35+
36+
/**
37+
* The search query string.
38+
*/
39+
query: string;
2040
};

packages/composition/model/searchPagination.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/composition/model/searchResultsItem.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
import type { BaseSearchResponse } from './baseSearchResponse';
44
import type { ResultsCompositionsResponse } from './resultsCompositionsResponse';
5-
import type { SearchHits } from './searchHits';
6-
import type { SearchPagination } from './searchPagination';
5+
import type { SearchFields } from './searchFields';
76

87
export type SearchResultsItem<T = Record<string, unknown>> = BaseSearchResponse &
9-
SearchPagination &
10-
SearchHits<T> &
8+
SearchFields<T> &
119
ResultsCompositionsResponse;

0 commit comments

Comments
 (0)