@algolia/recommend 5.0.0-alpha.8 → 5.0.0-alpha.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/builds/browser.d.ts +5 -5
  2. package/dist/builds/node.d.ts +5 -5
  3. package/dist/model/advancedSyntaxFeatures.d.ts +1 -1
  4. package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
  5. package/dist/model/alternativesAsExact.d.ts +1 -1
  6. package/dist/model/alternativesAsExact.d.ts.map +1 -1
  7. package/dist/model/anchoring.d.ts +5 -0
  8. package/dist/model/anchoring.d.ts.map +1 -0
  9. package/dist/model/aroundPrecision.d.ts +6 -0
  10. package/dist/model/aroundPrecision.d.ts.map +1 -0
  11. package/dist/model/aroundPrecisionFromValueInner.d.ts +5 -0
  12. package/dist/model/aroundPrecisionFromValueInner.d.ts.map +1 -0
  13. package/dist/model/aroundRadius.d.ts +5 -5
  14. package/dist/model/aroundRadius.d.ts.map +1 -1
  15. package/dist/model/aroundRadiusAll.d.ts +1 -1
  16. package/dist/model/aroundRadiusAll.d.ts.map +1 -1
  17. package/dist/model/automaticFacetFilter.d.ts +18 -0
  18. package/dist/model/automaticFacetFilter.d.ts.map +1 -0
  19. package/dist/model/automaticFacetFilters.d.ts +6 -0
  20. package/dist/model/automaticFacetFilters.d.ts.map +1 -0
  21. package/dist/model/baseRecommendRequest.d.ts +14 -17
  22. package/dist/model/baseRecommendRequest.d.ts.map +1 -1
  23. package/dist/model/baseRecommendationsQuery.d.ts +12 -0
  24. package/dist/model/baseRecommendationsQuery.d.ts.map +1 -0
  25. package/dist/model/baseSearchParams.d.ts +3 -3
  26. package/dist/model/baseSearchParams.d.ts.map +1 -1
  27. package/dist/model/baseSearchParamsWithoutQuery.d.ts +118 -122
  28. package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
  29. package/dist/model/baseSearchResponse.d.ts +95 -101
  30. package/dist/model/baseSearchResponse.d.ts.map +1 -1
  31. package/dist/model/baseSearchResponseRedirect.d.ts +8 -0
  32. package/dist/model/baseSearchResponseRedirect.d.ts.map +1 -0
  33. package/dist/model/baseTrendingFacetsQuery.d.ts +9 -0
  34. package/dist/model/baseTrendingFacetsQuery.d.ts.map +1 -0
  35. package/dist/model/baseTrendingItemsQuery.d.ts +16 -0
  36. package/dist/model/baseTrendingItemsQuery.d.ts.map +1 -0
  37. package/dist/model/clientMethodProps.d.ts +127 -60
  38. package/dist/model/clientMethodProps.d.ts.map +1 -1
  39. package/dist/model/condition.d.ts +17 -0
  40. package/dist/model/condition.d.ts.map +1 -0
  41. package/dist/model/consequence.d.ts +26 -0
  42. package/dist/model/consequence.d.ts.map +1 -0
  43. package/dist/model/consequenceHide.d.ts +10 -0
  44. package/dist/model/consequenceHide.d.ts.map +1 -0
  45. package/dist/model/consequenceParams.d.ts +5 -0
  46. package/dist/model/consequenceParams.d.ts.map +1 -0
  47. package/dist/model/consequenceQuery.d.ts +6 -0
  48. package/dist/model/consequenceQuery.d.ts.map +1 -0
  49. package/dist/model/consequenceQueryObject.d.ts +12 -0
  50. package/dist/model/consequenceQueryObject.d.ts.map +1 -0
  51. package/dist/model/deletedAtResponse.d.ts +14 -0
  52. package/dist/model/deletedAtResponse.d.ts.map +1 -0
  53. package/dist/model/distinct.d.ts +4 -4
  54. package/dist/model/distinct.d.ts.map +1 -1
  55. package/dist/model/edit.d.ts +13 -0
  56. package/dist/model/edit.d.ts.map +1 -0
  57. package/dist/model/editType.d.ts +5 -0
  58. package/dist/model/editType.d.ts.map +1 -0
  59. package/dist/model/errorBase.d.ts +6 -6
  60. package/dist/model/errorBase.d.ts.map +1 -1
  61. package/dist/model/exactOnSingleWordQuery.d.ts +4 -4
  62. package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
  63. package/dist/model/facetFilters.d.ts +5 -5
  64. package/dist/model/facetFilters.d.ts.map +1 -1
  65. package/dist/model/facetOrdering.d.ts +12 -12
  66. package/dist/model/facetOrdering.d.ts.map +1 -1
  67. package/dist/model/facets.d.ts +9 -9
  68. package/dist/model/facets.d.ts.map +1 -1
  69. package/dist/model/facetsStats.d.ts +18 -18
  70. package/dist/model/facetsStats.d.ts.map +1 -1
  71. package/dist/model/getRecommendTaskResponse.d.ts +5 -0
  72. package/dist/model/getRecommendTaskResponse.d.ts.map +1 -0
  73. package/dist/model/getRecommendationsParams.d.ts +10 -10
  74. package/dist/model/getRecommendationsParams.d.ts.map +1 -1
  75. package/dist/model/getRecommendationsResponse.d.ts +4 -4
  76. package/dist/model/getRecommendationsResponse.d.ts.map +1 -1
  77. package/dist/model/highlightResult.d.ts +2 -2
  78. package/dist/model/highlightResult.d.ts.map +1 -1
  79. package/dist/model/highlightResultOption.d.ts +19 -19
  80. package/dist/model/highlightResultOption.d.ts.map +1 -1
  81. package/dist/model/ignorePlurals.d.ts +4 -4
  82. package/dist/model/ignorePlurals.d.ts.map +1 -1
  83. package/dist/model/index.d.ts +86 -53
  84. package/dist/model/index.d.ts.map +1 -1
  85. package/dist/model/indexSettingsAsSearchParams.d.ts +166 -160
  86. package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  87. package/dist/model/matchLevel.d.ts +4 -4
  88. package/dist/model/matchLevel.d.ts.map +1 -1
  89. package/dist/model/matchedGeoLocation.d.ts +14 -14
  90. package/dist/model/matchedGeoLocation.d.ts.map +1 -1
  91. package/dist/model/mixedSearchFilters.d.ts +1 -1
  92. package/dist/model/mixedSearchFilters.d.ts.map +1 -1
  93. package/dist/model/mode.d.ts +5 -0
  94. package/dist/model/mode.d.ts.map +1 -0
  95. package/dist/model/numericFilters.d.ts +5 -5
  96. package/dist/model/numericFilters.d.ts.map +1 -1
  97. package/dist/model/optionalFilters.d.ts +5 -5
  98. package/dist/model/optionalFilters.d.ts.map +1 -1
  99. package/dist/model/params.d.ts +13 -0
  100. package/dist/model/params.d.ts.map +1 -0
  101. package/dist/model/personalization.d.ts +14 -14
  102. package/dist/model/personalization.d.ts.map +1 -1
  103. package/dist/model/promote.d.ts +4 -0
  104. package/dist/model/promote.d.ts.map +1 -0
  105. package/dist/model/promoteObjectID.d.ts +14 -0
  106. package/dist/model/promoteObjectID.d.ts.map +1 -0
  107. package/dist/model/promoteObjectIDs.d.ts +14 -0
  108. package/dist/model/promoteObjectIDs.d.ts.map +1 -0
  109. package/dist/model/queryType.d.ts +4 -4
  110. package/dist/model/queryType.d.ts.map +1 -1
  111. package/dist/model/rankingInfo.d.ts +50 -50
  112. package/dist/model/rankingInfo.d.ts.map +1 -1
  113. package/dist/model/reRankingApplyFilter.d.ts +5 -5
  114. package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
  115. package/dist/model/recommendHit.d.ts +26 -26
  116. package/dist/model/recommendHit.d.ts.map +1 -1
  117. package/dist/model/recommendHits.d.ts +12 -4
  118. package/dist/model/recommendHits.d.ts.map +1 -1
  119. package/dist/model/recommendModels.d.ts +2 -0
  120. package/dist/model/recommendModels.d.ts.map +1 -0
  121. package/dist/model/recommendationModels.d.ts +4 -4
  122. package/dist/model/recommendationModels.d.ts.map +1 -1
  123. package/dist/model/recommendationsQuery.d.ts +4 -0
  124. package/dist/model/recommendationsQuery.d.ts.map +1 -0
  125. package/dist/model/recommendationsRequest.d.ts +4 -3
  126. package/dist/model/recommendationsRequest.d.ts.map +1 -1
  127. package/dist/model/recommendationsResponse.d.ts +3 -3
  128. package/dist/model/recommendationsResponse.d.ts.map +1 -1
  129. package/dist/model/redirectRuleIndexMetadata.d.ts +21 -0
  130. package/dist/model/redirectRuleIndexMetadata.d.ts.map +1 -0
  131. package/dist/model/redirectRuleIndexMetadataData.d.ts +7 -0
  132. package/dist/model/redirectRuleIndexMetadataData.d.ts.map +1 -0
  133. package/dist/model/removeStopWords.d.ts +4 -4
  134. package/dist/model/removeStopWords.d.ts.map +1 -1
  135. package/dist/model/removeWordsIfNoResults.d.ts +4 -4
  136. package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
  137. package/dist/model/renderingContent.d.ts +7 -7
  138. package/dist/model/renderingContent.d.ts.map +1 -1
  139. package/dist/model/ruleResponse.d.ts +27 -0
  140. package/dist/model/ruleResponse.d.ts.map +1 -0
  141. package/dist/model/ruleResponseMetadata.d.ts +7 -0
  142. package/dist/model/ruleResponseMetadata.d.ts.map +1 -0
  143. package/dist/model/searchParamsObject.d.ts +3 -3
  144. package/dist/model/searchParamsObject.d.ts.map +1 -1
  145. package/dist/model/searchParamsQuery.d.ts +6 -6
  146. package/dist/model/searchParamsQuery.d.ts.map +1 -1
  147. package/dist/model/searchRecommendRulesParams.d.ts +30 -0
  148. package/dist/model/searchRecommendRulesParams.d.ts.map +1 -0
  149. package/dist/model/searchRecommendRulesResponse.d.ts +20 -0
  150. package/dist/model/searchRecommendRulesResponse.d.ts.map +1 -0
  151. package/dist/model/semanticSearch.d.ts +10 -0
  152. package/dist/model/semanticSearch.d.ts.map +1 -0
  153. package/dist/model/snippetResult.d.ts +2 -2
  154. package/dist/model/snippetResult.d.ts.map +1 -1
  155. package/dist/model/snippetResultOption.d.ts +11 -11
  156. package/dist/model/snippetResultOption.d.ts.map +1 -1
  157. package/dist/model/sortRemainingBy.d.ts +4 -4
  158. package/dist/model/sortRemainingBy.d.ts.map +1 -1
  159. package/dist/model/tagFilters.d.ts +5 -5
  160. package/dist/model/tagFilters.d.ts.map +1 -1
  161. package/dist/model/taskStatus.d.ts +5 -0
  162. package/dist/model/taskStatus.d.ts.map +1 -0
  163. package/dist/model/trendingFacetsModel.d.ts +5 -0
  164. package/dist/model/trendingFacetsModel.d.ts.map +1 -0
  165. package/dist/model/trendingFacetsQuery.d.ts +4 -0
  166. package/dist/model/trendingFacetsQuery.d.ts.map +1 -0
  167. package/dist/model/trendingItemsModel.d.ts +5 -0
  168. package/dist/model/trendingItemsModel.d.ts.map +1 -0
  169. package/dist/model/trendingItemsQuery.d.ts +4 -0
  170. package/dist/model/trendingItemsQuery.d.ts.map +1 -0
  171. package/dist/model/typoTolerance.d.ts +5 -5
  172. package/dist/model/typoTolerance.d.ts.map +1 -1
  173. package/dist/model/typoToleranceEnum.d.ts +1 -1
  174. package/dist/model/typoToleranceEnum.d.ts.map +1 -1
  175. package/dist/model/value.d.ts +8 -8
  176. package/dist/model/value.d.ts.map +1 -1
  177. package/dist/recommend.cjs +381 -0
  178. package/dist/recommend.esm.browser.js +553 -468
  179. package/dist/recommend.esm.node.js +370 -235
  180. package/dist/recommend.umd.js +2 -2
  181. package/dist/src/recommendClient.d.ts +129 -81
  182. package/dist/src/recommendClient.d.ts.map +1 -1
  183. package/index.js +1 -1
  184. package/model/advancedSyntaxFeatures.ts +1 -1
  185. package/model/alternativesAsExact.ts +1 -1
  186. package/model/anchoring.ts +6 -0
  187. package/model/aroundPrecision.ts +8 -0
  188. package/model/aroundPrecisionFromValueInner.ts +7 -0
  189. package/model/aroundRadius.ts +2 -2
  190. package/model/aroundRadiusAll.ts +1 -1
  191. package/model/automaticFacetFilter.ts +21 -0
  192. package/model/automaticFacetFilters.ts +8 -0
  193. package/model/baseRecommendRequest.ts +5 -11
  194. package/model/baseRecommendationsQuery.ts +17 -0
  195. package/model/baseSearchParams.ts +1 -1
  196. package/model/baseSearchParamsWithoutQuery.ts +38 -43
  197. package/model/baseSearchResponse.ts +21 -28
  198. package/model/baseSearchResponseRedirect.ts +10 -0
  199. package/model/baseTrendingFacetsQuery.ts +12 -0
  200. package/model/baseTrendingItemsQuery.ts +22 -0
  201. package/model/clientMethodProps.ts +83 -11
  202. package/model/condition.ts +22 -0
  203. package/model/consequence.ts +32 -0
  204. package/model/consequenceHide.ts +11 -0
  205. package/model/consequenceParams.ts +9 -0
  206. package/model/consequenceQuery.ts +8 -0
  207. package/model/consequenceQueryObject.ts +15 -0
  208. package/model/deletedAtResponse.ts +16 -0
  209. package/model/distinct.ts +2 -2
  210. package/model/edit.ts +17 -0
  211. package/model/editType.ts +6 -0
  212. package/model/errorBase.ts +1 -1
  213. package/model/exactOnSingleWordQuery.ts +2 -2
  214. package/model/facetFilters.ts +2 -2
  215. package/model/facetOrdering.ts +3 -3
  216. package/model/facets.ts +2 -2
  217. package/model/facetsStats.ts +5 -5
  218. package/model/getRecommendTaskResponse.ts +7 -0
  219. package/model/getRecommendationsParams.ts +3 -3
  220. package/model/getRecommendationsResponse.ts +1 -1
  221. package/model/highlightResult.ts +1 -1
  222. package/model/highlightResultOption.ts +2 -2
  223. package/model/ignorePlurals.ts +2 -2
  224. package/model/index.ts +39 -6
  225. package/model/indexSettingsAsSearchParams.ts +53 -44
  226. package/model/matchLevel.ts +1 -1
  227. package/model/matchedGeoLocation.ts +1 -1
  228. package/model/mixedSearchFilters.ts +1 -1
  229. package/model/mode.ts +6 -0
  230. package/model/numericFilters.ts +2 -2
  231. package/model/optionalFilters.ts +2 -2
  232. package/model/params.ts +18 -0
  233. package/model/personalization.ts +1 -1
  234. package/model/promote.ts +6 -0
  235. package/model/promoteObjectID.ts +16 -0
  236. package/model/promoteObjectIDs.ts +16 -0
  237. package/model/queryType.ts +2 -2
  238. package/model/rankingInfo.ts +1 -1
  239. package/model/reRankingApplyFilter.ts +2 -2
  240. package/model/recommendHit.ts +4 -4
  241. package/model/recommendHits.ts +11 -1
  242. package/model/recommendModels.ts +7 -0
  243. package/model/recommendationModels.ts +2 -2
  244. package/model/recommendationsQuery.ts +7 -0
  245. package/model/recommendationsRequest.ts +8 -4
  246. package/model/recommendationsResponse.ts +1 -1
  247. package/model/redirectRuleIndexMetadata.ts +27 -0
  248. package/model/redirectRuleIndexMetadataData.ts +8 -0
  249. package/model/removeStopWords.ts +2 -2
  250. package/model/removeWordsIfNoResults.ts +2 -2
  251. package/model/renderingContent.ts +2 -2
  252. package/model/ruleResponse.ts +34 -0
  253. package/model/ruleResponseMetadata.ts +8 -0
  254. package/model/searchParamsObject.ts +1 -1
  255. package/model/searchParamsQuery.ts +2 -2
  256. package/model/searchRecommendRulesParams.ts +36 -0
  257. package/model/searchRecommendRulesResponse.ts +25 -0
  258. package/model/semanticSearch.ts +11 -0
  259. package/model/snippetResult.ts +1 -1
  260. package/model/snippetResultOption.ts +2 -2
  261. package/model/sortRemainingBy.ts +2 -2
  262. package/model/tagFilters.ts +2 -2
  263. package/model/taskStatus.ts +6 -0
  264. package/model/trendingFacetsModel.ts +6 -0
  265. package/model/trendingFacetsQuery.ts +7 -0
  266. package/model/trendingItemsModel.ts +6 -0
  267. package/model/trendingItemsQuery.ts +6 -0
  268. package/model/typoTolerance.ts +2 -2
  269. package/model/typoToleranceEnum.ts +1 -1
  270. package/model/value.ts +1 -1
  271. package/package.json +30 -13
  272. package/dist/model/baseRecommendationRequest.d.ts +0 -9
  273. package/dist/model/baseRecommendationRequest.d.ts.map +0 -1
  274. package/dist/model/baseTrendingRequest.d.ts +0 -13
  275. package/dist/model/baseTrendingRequest.d.ts.map +0 -1
  276. package/dist/model/recommendationRequest.d.ts +0 -4
  277. package/dist/model/recommendationRequest.d.ts.map +0 -1
  278. package/dist/model/trendingModels.d.ts +0 -5
  279. package/dist/model/trendingModels.d.ts.map +0 -1
  280. package/dist/model/trendingRequest.d.ts +0 -4
  281. package/dist/model/trendingRequest.d.ts.map +0 -1
  282. package/dist/recommend.cjs.js +0 -248
  283. package/model/baseRecommendationRequest.ts +0 -12
  284. package/model/baseTrendingRequest.ts +0 -17
  285. package/model/recommendationRequest.ts +0 -7
  286. package/model/trendingModels.ts +0 -6
  287. package/model/trendingRequest.ts +0 -6
@@ -1,243 +1,378 @@
1
1
  import { createAuth, createTransporter, getAlgoliaAgent, shuffle, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
2
2
  import { createHttpRequester } from '@algolia/requester-node-http';
3
3
 
4
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
5
- const apiClientVersion = '5.0.0-alpha.8';
6
- function getDefaultHosts(appId) {
7
- return [
8
- {
9
- url: `${appId}-dsn.algolia.net`,
10
- accept: 'read',
11
- protocol: 'https',
12
- },
13
- {
14
- url: `${appId}.algolia.net`,
15
- accept: 'write',
16
- protocol: 'https',
17
- },
18
- ].concat(shuffle([
19
- {
20
- url: `${appId}-1.algolianet.com`,
21
- accept: 'readWrite',
22
- protocol: 'https',
23
- },
24
- {
25
- url: `${appId}-2.algolianet.com`,
26
- accept: 'readWrite',
27
- protocol: 'https',
28
- },
29
- {
30
- url: `${appId}-3.algolianet.com`,
31
- accept: 'readWrite',
32
- protocol: 'https',
33
- },
34
- ]));
35
- }
36
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
37
- function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
38
- const auth = createAuth(appIdOption, apiKeyOption, authMode);
39
- const transporter = createTransporter({
40
- hosts: getDefaultHosts(appIdOption),
41
- ...options,
42
- algoliaAgent: getAlgoliaAgent({
43
- algoliaAgents,
44
- client: 'Recommend',
45
- version: apiClientVersion,
46
- }),
47
- baseHeaders: {
48
- 'content-type': 'text/plain',
49
- ...auth.headers(),
50
- ...options.baseHeaders,
51
- },
52
- baseQueryParameters: {
53
- ...auth.queryParameters(),
54
- ...options.baseQueryParameters,
55
- },
56
- });
57
- return {
58
- transporter,
59
- /**
60
- * The `appId` currently in use.
61
- */
62
- appId: appIdOption,
63
- /**
64
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
65
- */
66
- clearCache() {
67
- return Promise.all([
68
- transporter.requestsCache.clear(),
69
- transporter.responsesCache.clear(),
70
- ]).then(() => undefined);
71
- },
72
- /**
73
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
74
- */
75
- get _ua() {
76
- return transporter.algoliaAgent.value;
77
- },
78
- /**
79
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
80
- *
81
- * @param segment - The algolia agent (user-agent) segment to add.
82
- * @param version - The version of the agent.
83
- */
84
- addAlgoliaAgent(segment, version) {
85
- transporter.algoliaAgent.add({ segment, version });
86
- },
87
- /**
88
- * This method allow you to send requests to the Algolia REST API.
89
- *
90
- * @summary Send requests to the Algolia REST API.
91
- * @param del - The del object.
92
- * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
93
- * @param del.parameters - Query parameters to be applied to the current query.
94
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
95
- */
96
- del({ path, parameters }, requestOptions) {
97
- if (!path) {
98
- throw new Error('Parameter `path` is required when calling `del`.');
99
- }
100
- const requestPath = '/1{path}'.replace('{path}', path);
101
- const headers = {};
102
- const queryParameters = parameters ? parameters : {};
103
- const request = {
104
- method: 'DELETE',
105
- path: requestPath,
106
- queryParameters,
107
- headers,
108
- };
109
- return transporter.request(request, requestOptions);
110
- },
111
- /**
112
- * This method allow you to send requests to the Algolia REST API.
113
- *
114
- * @summary Send requests to the Algolia REST API.
115
- * @param get - The get object.
116
- * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
117
- * @param get.parameters - Query parameters to be applied to the current query.
118
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
119
- */
120
- get({ path, parameters }, requestOptions) {
121
- if (!path) {
122
- throw new Error('Parameter `path` is required when calling `get`.');
123
- }
124
- const requestPath = '/1{path}'.replace('{path}', path);
125
- const headers = {};
126
- const queryParameters = parameters ? parameters : {};
127
- const request = {
128
- method: 'GET',
129
- path: requestPath,
130
- queryParameters,
131
- headers,
132
- };
133
- return transporter.request(request, requestOptions);
134
- },
135
- /**
136
- * Returns recommendations or trending results, for a specific model and `objectID`.
137
- *
138
- * @summary Get results.
139
- * @param getRecommendationsParams - The getRecommendationsParams object.
140
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
141
- */
142
- getRecommendations(getRecommendationsParams, requestOptions) {
143
- if (!getRecommendationsParams) {
144
- throw new Error('Parameter `getRecommendationsParams` is required when calling `getRecommendations`.');
145
- }
146
- if (!getRecommendationsParams.requests) {
147
- throw new Error('Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.');
148
- }
149
- const requestPath = '/1/indexes/*/recommendations';
150
- const headers = {};
151
- const queryParameters = {};
152
- const request = {
153
- method: 'POST',
154
- path: requestPath,
155
- queryParameters,
156
- headers,
157
- data: getRecommendationsParams,
158
- useReadTransporter: true,
159
- cacheable: true,
160
- };
161
- return transporter.request(request, requestOptions);
162
- },
163
- /**
164
- * This method allow you to send requests to the Algolia REST API.
165
- *
166
- * @summary Send requests to the Algolia REST API.
167
- * @param post - The post object.
168
- * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
169
- * @param post.parameters - Query parameters to be applied to the current query.
170
- * @param post.body - The parameters to send with the custom request.
171
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
172
- */
173
- post({ path, parameters, body }, requestOptions) {
174
- if (!path) {
175
- throw new Error('Parameter `path` is required when calling `post`.');
176
- }
177
- const requestPath = '/1{path}'.replace('{path}', path);
178
- const headers = {};
179
- const queryParameters = parameters ? parameters : {};
180
- const request = {
181
- method: 'POST',
182
- path: requestPath,
183
- queryParameters,
184
- headers,
185
- data: body ? body : {},
186
- };
187
- return transporter.request(request, requestOptions);
188
- },
189
- /**
190
- * This method allow you to send requests to the Algolia REST API.
191
- *
192
- * @summary Send requests to the Algolia REST API.
193
- * @param put - The put object.
194
- * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
195
- * @param put.parameters - Query parameters to be applied to the current query.
196
- * @param put.body - The parameters to send with the custom request.
197
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
198
- */
199
- put({ path, parameters, body }, requestOptions) {
200
- if (!path) {
201
- throw new Error('Parameter `path` is required when calling `put`.');
202
- }
203
- const requestPath = '/1{path}'.replace('{path}', path);
204
- const headers = {};
205
- const queryParameters = parameters ? parameters : {};
206
- const request = {
207
- method: 'PUT',
208
- path: requestPath,
209
- queryParameters,
210
- headers,
211
- data: body ? body : {},
212
- };
213
- return transporter.request(request, requestOptions);
214
- },
215
- };
4
+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
5
+ const apiClientVersion = '5.0.0-alpha.81';
6
+ function getDefaultHosts(appId) {
7
+ return [
8
+ {
9
+ url: `${appId}-dsn.algolia.net`,
10
+ accept: 'read',
11
+ protocol: 'https',
12
+ },
13
+ {
14
+ url: `${appId}.algolia.net`,
15
+ accept: 'write',
16
+ protocol: 'https',
17
+ },
18
+ ].concat(shuffle([
19
+ {
20
+ url: `${appId}-1.algolianet.com`,
21
+ accept: 'readWrite',
22
+ protocol: 'https',
23
+ },
24
+ {
25
+ url: `${appId}-2.algolianet.com`,
26
+ accept: 'readWrite',
27
+ protocol: 'https',
28
+ },
29
+ {
30
+ url: `${appId}-3.algolianet.com`,
31
+ accept: 'readWrite',
32
+ protocol: 'https',
33
+ },
34
+ ]));
35
+ }
36
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
37
+ function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
38
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
39
+ const transporter = createTransporter({
40
+ hosts: getDefaultHosts(appIdOption),
41
+ ...options,
42
+ algoliaAgent: getAlgoliaAgent({
43
+ algoliaAgents,
44
+ client: 'Recommend',
45
+ version: apiClientVersion,
46
+ }),
47
+ baseHeaders: {
48
+ 'content-type': 'text/plain',
49
+ ...auth.headers(),
50
+ ...options.baseHeaders,
51
+ },
52
+ baseQueryParameters: {
53
+ ...auth.queryParameters(),
54
+ ...options.baseQueryParameters,
55
+ },
56
+ });
57
+ return {
58
+ transporter,
59
+ /**
60
+ * The `appId` currently in use.
61
+ */
62
+ appId: appIdOption,
63
+ /**
64
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
65
+ */
66
+ clearCache() {
67
+ return Promise.all([
68
+ transporter.requestsCache.clear(),
69
+ transporter.responsesCache.clear(),
70
+ ]).then(() => undefined);
71
+ },
72
+ /**
73
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
74
+ */
75
+ get _ua() {
76
+ return transporter.algoliaAgent.value;
77
+ },
78
+ /**
79
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
80
+ *
81
+ * @param segment - The algolia agent (user-agent) segment to add.
82
+ * @param version - The version of the agent.
83
+ */
84
+ addAlgoliaAgent(segment, version) {
85
+ transporter.algoliaAgent.add({ segment, version });
86
+ },
87
+ /**
88
+ * This method allow you to send requests to the Algolia REST API.
89
+ *
90
+ * @summary Send requests to the Algolia REST API.
91
+ * @param del - The del object.
92
+ * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
93
+ * @param del.parameters - Query parameters to apply to the current query.
94
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
95
+ */
96
+ del({ path, parameters }, requestOptions) {
97
+ if (!path) {
98
+ throw new Error('Parameter `path` is required when calling `del`.');
99
+ }
100
+ const requestPath = '/1{path}'.replace('{path}', path);
101
+ const headers = {};
102
+ const queryParameters = parameters ? parameters : {};
103
+ const request = {
104
+ method: 'DELETE',
105
+ path: requestPath,
106
+ queryParameters,
107
+ headers,
108
+ };
109
+ return transporter.request(request, requestOptions);
110
+ },
111
+ /**
112
+ * Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
113
+ *
114
+ * @summary Delete a Recommend rule.
115
+ * @param deleteRecommendRule - The deleteRecommendRule object.
116
+ * @param deleteRecommendRule.indexName - Index on which to perform the request.
117
+ * @param deleteRecommendRule.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
118
+ * @param deleteRecommendRule.objectID - Unique record (object) identifier.
119
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
120
+ */
121
+ deleteRecommendRule({ indexName, model, objectID }, requestOptions) {
122
+ if (!indexName) {
123
+ throw new Error('Parameter `indexName` is required when calling `deleteRecommendRule`.');
124
+ }
125
+ if (!model) {
126
+ throw new Error('Parameter `model` is required when calling `deleteRecommendRule`.');
127
+ }
128
+ if (!objectID) {
129
+ throw new Error('Parameter `objectID` is required when calling `deleteRecommendRule`.');
130
+ }
131
+ const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'
132
+ .replace('{indexName}', encodeURIComponent(indexName))
133
+ .replace('{model}', encodeURIComponent(model))
134
+ .replace('{objectID}', encodeURIComponent(objectID));
135
+ const headers = {};
136
+ const queryParameters = {};
137
+ const request = {
138
+ method: 'DELETE',
139
+ path: requestPath,
140
+ queryParameters,
141
+ headers,
142
+ };
143
+ return transporter.request(request, requestOptions);
144
+ },
145
+ /**
146
+ * This method allow you to send requests to the Algolia REST API.
147
+ *
148
+ * @summary Send requests to the Algolia REST API.
149
+ * @param get - The get object.
150
+ * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
151
+ * @param get.parameters - Query parameters to apply to the current query.
152
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
153
+ */
154
+ get({ path, parameters }, requestOptions) {
155
+ if (!path) {
156
+ throw new Error('Parameter `path` is required when calling `get`.');
157
+ }
158
+ const requestPath = '/1{path}'.replace('{path}', path);
159
+ const headers = {};
160
+ const queryParameters = parameters ? parameters : {};
161
+ const request = {
162
+ method: 'GET',
163
+ path: requestPath,
164
+ queryParameters,
165
+ headers,
166
+ };
167
+ return transporter.request(request, requestOptions);
168
+ },
169
+ /**
170
+ * Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
171
+ *
172
+ * @summary Get a Recommend rule.
173
+ * @param getRecommendRule - The getRecommendRule object.
174
+ * @param getRecommendRule.indexName - Index on which to perform the request.
175
+ * @param getRecommendRule.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
176
+ * @param getRecommendRule.objectID - Unique record (object) identifier.
177
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
178
+ */
179
+ getRecommendRule({ indexName, model, objectID }, requestOptions) {
180
+ if (!indexName) {
181
+ throw new Error('Parameter `indexName` is required when calling `getRecommendRule`.');
182
+ }
183
+ if (!model) {
184
+ throw new Error('Parameter `model` is required when calling `getRecommendRule`.');
185
+ }
186
+ if (!objectID) {
187
+ throw new Error('Parameter `objectID` is required when calling `getRecommendRule`.');
188
+ }
189
+ const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'
190
+ .replace('{indexName}', encodeURIComponent(indexName))
191
+ .replace('{model}', encodeURIComponent(model))
192
+ .replace('{objectID}', encodeURIComponent(objectID));
193
+ const headers = {};
194
+ const queryParameters = {};
195
+ const request = {
196
+ method: 'GET',
197
+ path: requestPath,
198
+ queryParameters,
199
+ headers,
200
+ };
201
+ return transporter.request(request, requestOptions);
202
+ },
203
+ /**
204
+ * Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task.
205
+ *
206
+ * @summary Get a Recommend task\'s status.
207
+ * @param getRecommendStatus - The getRecommendStatus object.
208
+ * @param getRecommendStatus.indexName - Index on which to perform the request.
209
+ * @param getRecommendStatus.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
210
+ * @param getRecommendStatus.taskID - Unique identifier of a task. Numeric value (up to 64bits).
211
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
212
+ */
213
+ getRecommendStatus({ indexName, model, taskID }, requestOptions) {
214
+ if (!indexName) {
215
+ throw new Error('Parameter `indexName` is required when calling `getRecommendStatus`.');
216
+ }
217
+ if (!model) {
218
+ throw new Error('Parameter `model` is required when calling `getRecommendStatus`.');
219
+ }
220
+ if (!taskID) {
221
+ throw new Error('Parameter `taskID` is required when calling `getRecommendStatus`.');
222
+ }
223
+ const requestPath = '/1/indexes/{indexName}/{model}/task/{taskID}'
224
+ .replace('{indexName}', encodeURIComponent(indexName))
225
+ .replace('{model}', encodeURIComponent(model))
226
+ .replace('{taskID}', encodeURIComponent(taskID));
227
+ const headers = {};
228
+ const queryParameters = {};
229
+ const request = {
230
+ method: 'GET',
231
+ path: requestPath,
232
+ queryParameters,
233
+ headers,
234
+ };
235
+ return transporter.request(request, requestOptions);
236
+ },
237
+ /**
238
+ * Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values).
239
+ *
240
+ * @summary Get recommendations and trending items.
241
+ * @param getRecommendationsParams - The getRecommendationsParams object.
242
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
243
+ */
244
+ getRecommendations(getRecommendationsParams, requestOptions) {
245
+ if (!getRecommendationsParams) {
246
+ throw new Error('Parameter `getRecommendationsParams` is required when calling `getRecommendations`.');
247
+ }
248
+ if (!getRecommendationsParams.requests) {
249
+ throw new Error('Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.');
250
+ }
251
+ const requestPath = '/1/indexes/*/recommendations';
252
+ const headers = {};
253
+ const queryParameters = {};
254
+ const request = {
255
+ method: 'POST',
256
+ path: requestPath,
257
+ queryParameters,
258
+ headers,
259
+ data: getRecommendationsParams,
260
+ useReadTransporter: true,
261
+ cacheable: true,
262
+ };
263
+ return transporter.request(request, requestOptions);
264
+ },
265
+ /**
266
+ * This method allow you to send requests to the Algolia REST API.
267
+ *
268
+ * @summary Send requests to the Algolia REST API.
269
+ * @param post - The post object.
270
+ * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
271
+ * @param post.parameters - Query parameters to apply to the current query.
272
+ * @param post.body - Parameters to send with the custom request.
273
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
274
+ */
275
+ post({ path, parameters, body }, requestOptions) {
276
+ if (!path) {
277
+ throw new Error('Parameter `path` is required when calling `post`.');
278
+ }
279
+ const requestPath = '/1{path}'.replace('{path}', path);
280
+ const headers = {};
281
+ const queryParameters = parameters ? parameters : {};
282
+ const request = {
283
+ method: 'POST',
284
+ path: requestPath,
285
+ queryParameters,
286
+ headers,
287
+ data: body ? body : {},
288
+ };
289
+ return transporter.request(request, requestOptions);
290
+ },
291
+ /**
292
+ * This method allow you to send requests to the Algolia REST API.
293
+ *
294
+ * @summary Send requests to the Algolia REST API.
295
+ * @param put - The put object.
296
+ * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
297
+ * @param put.parameters - Query parameters to apply to the current query.
298
+ * @param put.body - Parameters to send with the custom request.
299
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
300
+ */
301
+ put({ path, parameters, body }, requestOptions) {
302
+ if (!path) {
303
+ throw new Error('Parameter `path` is required when calling `put`.');
304
+ }
305
+ const requestPath = '/1{path}'.replace('{path}', path);
306
+ const headers = {};
307
+ const queryParameters = parameters ? parameters : {};
308
+ const request = {
309
+ method: 'PUT',
310
+ path: requestPath,
311
+ queryParameters,
312
+ headers,
313
+ data: body ? body : {},
314
+ };
315
+ return transporter.request(request, requestOptions);
316
+ },
317
+ /**
318
+ * List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
319
+ *
320
+ * @summary List Recommend rules.
321
+ * @param searchRecommendRules - The searchRecommendRules object.
322
+ * @param searchRecommendRules.indexName - Index on which to perform the request.
323
+ * @param searchRecommendRules.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
324
+ * @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.
325
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
326
+ */
327
+ searchRecommendRules({ indexName, model, searchRecommendRulesParams, }, requestOptions) {
328
+ if (!indexName) {
329
+ throw new Error('Parameter `indexName` is required when calling `searchRecommendRules`.');
330
+ }
331
+ if (!model) {
332
+ throw new Error('Parameter `model` is required when calling `searchRecommendRules`.');
333
+ }
334
+ const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/search'
335
+ .replace('{indexName}', encodeURIComponent(indexName))
336
+ .replace('{model}', encodeURIComponent(model));
337
+ const headers = {};
338
+ const queryParameters = {};
339
+ const request = {
340
+ method: 'POST',
341
+ path: requestPath,
342
+ queryParameters,
343
+ headers,
344
+ data: searchRecommendRulesParams ? searchRecommendRulesParams : {},
345
+ useReadTransporter: true,
346
+ cacheable: true,
347
+ };
348
+ return transporter.request(request, requestOptions);
349
+ },
350
+ };
216
351
  }
217
352
 
218
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
219
- function recommendClient(appId, apiKey, options) {
220
- if (!appId || typeof appId !== 'string') {
221
- throw new Error('`appId` is missing.');
222
- }
223
- if (!apiKey || typeof apiKey !== 'string') {
224
- throw new Error('`apiKey` is missing.');
225
- }
226
- return createRecommendClient({
227
- appId,
228
- apiKey,
229
- timeouts: {
230
- connect: DEFAULT_CONNECT_TIMEOUT_NODE,
231
- read: DEFAULT_READ_TIMEOUT_NODE,
232
- write: DEFAULT_WRITE_TIMEOUT_NODE,
233
- },
234
- requester: createHttpRequester(),
235
- algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
236
- responsesCache: createNullCache(),
237
- requestsCache: createNullCache(),
238
- hostsCache: createMemoryCache(),
239
- ...options,
240
- });
353
+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
354
+ function recommendClient(appId, apiKey, options) {
355
+ if (!appId || typeof appId !== 'string') {
356
+ throw new Error('`appId` is missing.');
357
+ }
358
+ if (!apiKey || typeof apiKey !== 'string') {
359
+ throw new Error('`apiKey` is missing.');
360
+ }
361
+ return createRecommendClient({
362
+ appId,
363
+ apiKey,
364
+ timeouts: {
365
+ connect: DEFAULT_CONNECT_TIMEOUT_NODE,
366
+ read: DEFAULT_READ_TIMEOUT_NODE,
367
+ write: DEFAULT_WRITE_TIMEOUT_NODE,
368
+ },
369
+ requester: createHttpRequester(),
370
+ algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
371
+ responsesCache: createNullCache(),
372
+ requestsCache: createNullCache(),
373
+ hostsCache: createMemoryCache(),
374
+ ...options,
375
+ });
241
376
  }
242
377
 
243
378
  export { apiClientVersion, recommendClient };