mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[algoliasearch]: add missing types to response (#36859)
* [algoliasearch]: add missing types to response * add stuff i missed * chore: fix test & add queryID
This commit is contained in:
parent
de2dc5e9e0
commit
e711a2f5cb
@ -22,6 +22,8 @@ let _algoliaResponse: Response = {
|
||||
query: '',
|
||||
params: '',
|
||||
index: '',
|
||||
exhaustiveFacetsCount: true,
|
||||
exhaustiveNbHits: false,
|
||||
};
|
||||
|
||||
let _clientOptions: ClientOptions = {
|
||||
|
||||
108
types/algoliasearch/index.d.ts
vendored
108
types/algoliasearch/index.d.ts
vendored
@ -1595,41 +1595,120 @@ declare namespace algoliasearch {
|
||||
}
|
||||
|
||||
interface Response<T=any> {
|
||||
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
*/
|
||||
hits: T[];
|
||||
|
||||
/**
|
||||
* Current page
|
||||
*/
|
||||
page: number;
|
||||
|
||||
/**
|
||||
* Number of total hits matching the query
|
||||
*/
|
||||
nbHits: number;
|
||||
|
||||
/**
|
||||
* Number of pages
|
||||
*/
|
||||
nbPages: number;
|
||||
|
||||
/**
|
||||
* Number of hits per pages
|
||||
*/
|
||||
hitsPerPage: number;
|
||||
|
||||
/**
|
||||
* Engine processing time (excluding network transfer)
|
||||
*/
|
||||
processingTimeMS: number;
|
||||
|
||||
/**
|
||||
* Query used to perform the search
|
||||
*/
|
||||
query: string;
|
||||
|
||||
/**
|
||||
* A markup text indicating which parts of the original query have been removed
|
||||
* in order to retrieve a non-empty result set.
|
||||
* The removed parts are surrounded by <em> tags.
|
||||
* Only returned when removeWordsIfNoResults is set to lastWords or firstWords.
|
||||
*/
|
||||
queryAfterRemoval?: string;
|
||||
|
||||
/**
|
||||
* GET parameters used to perform the search
|
||||
*/
|
||||
params: string;
|
||||
|
||||
/**
|
||||
* Used to return warnings about the query.
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
/**
|
||||
* The computed geo location. Warning: for legacy reasons, this parameter is
|
||||
* a string and not an object. Format: ${lat},${lng}, where the latitude and
|
||||
* longitude are expressed as decimal floating point numbers.
|
||||
* Only returned when aroundLatLngViaIP or aroundLatLng is set.
|
||||
*/
|
||||
aroundLatLng?: string;
|
||||
|
||||
/**
|
||||
* The automatically computed radius. For legacy reasons, this parameter is a
|
||||
* string and not an integer.
|
||||
* Only returned for geo queries without an explicitly specified radius (see aroundRadius).
|
||||
*/
|
||||
automaticRadius?: string;
|
||||
|
||||
/**
|
||||
* Actual host name of the server that processed the request. Our DNS
|
||||
* supports automatic failover and load balancing, so this may differ from
|
||||
* the host name used in the request.
|
||||
* Returned only if getRankingInfo is set to true.
|
||||
*/
|
||||
serverUsed?: string;
|
||||
|
||||
/**
|
||||
* Index name used for the query. In the case of an A/B test, the targeted
|
||||
* index isn’t always the index used by the query.
|
||||
* Returned only if getRankingInfo is set to true.
|
||||
*/
|
||||
indexUsed?: string;
|
||||
|
||||
/**
|
||||
* If a search encounters an index that is being A/B tested, abTestVariantID
|
||||
* reports the variant ID of the index used (note, this is the ID not the name).
|
||||
* The variant ID is the position in the array of variants (starting at 1).
|
||||
*
|
||||
* For example, abTestVariantID=1 is variant A (the main index), abTestVariantID=2
|
||||
* is variant B (the replica you chose when creating the A/B test , or the queries
|
||||
* with the changed query parameters if the A/B test is based on query parameters).
|
||||
* Returned only if getRankingInfo is set to true.
|
||||
*/
|
||||
abTestVariantID?: number;
|
||||
|
||||
/**
|
||||
* The query string that will be searched, after normalization. Normalization
|
||||
* includes removing stop words (if removeStopWords is enabled), and transforming
|
||||
* portions of the query string into phrase queries (see advancedSyntax).
|
||||
* Returned only if getRankingInfo is set to true.
|
||||
*/
|
||||
parsedQuery?: string;
|
||||
|
||||
/**
|
||||
* A mapping of each facet name to the corresponding facet counts.
|
||||
*/
|
||||
facets?: {
|
||||
[facetName: string]: { [facetValue: string]: number };
|
||||
};
|
||||
|
||||
/**
|
||||
* Statistics for numerical facets.
|
||||
*/
|
||||
facets_stats?: {
|
||||
[facetName: string]: {
|
||||
avg: number,
|
||||
@ -1638,14 +1717,43 @@ declare namespace algoliasearch {
|
||||
sum: number,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* The index name is only set when searching multiple indices.
|
||||
*/
|
||||
index?: string;
|
||||
|
||||
/**
|
||||
* Whether the query was processed. Only returned when strategy: stopIfEnoughmatches.
|
||||
*/
|
||||
processed?: boolean;
|
||||
|
||||
/**
|
||||
* The cursor is only set when browsing the index.
|
||||
*/
|
||||
cursor?: string;
|
||||
|
||||
/**
|
||||
* Whether the nbHits is exhaustive (true) or approximate (false).
|
||||
* An approximation is done when the query takes more than 50ms to be processed
|
||||
* (this can happen when using complex filters on millions on records).
|
||||
*/
|
||||
exhaustiveNbHits: boolean;
|
||||
|
||||
/**
|
||||
* Whether the facet count is exhaustive (true) or approximate (false).
|
||||
*/
|
||||
exhaustiveFacetsCount: boolean;
|
||||
|
||||
/**
|
||||
* user data is returned if a matching query rule was set up to do so
|
||||
*/
|
||||
userData?: Array<{ [key: string]: any }>;
|
||||
|
||||
/**
|
||||
* The unique identifier of this search, only returned if clickAnalytics: true
|
||||
*/
|
||||
queryID?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse<T=any> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user