@algolia/client-search 5.0.0-alpha.8 → 5.0.0-alpha.80

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 (502) hide show
  1. package/dist/builds/browser.d.ts +5 -5
  2. package/dist/builds/node.d.ts +5 -5
  3. package/dist/{client-search.cjs.js → client-search.cjs} +2001 -1991
  4. package/dist/client-search.esm.browser.js +2193 -2235
  5. package/dist/client-search.esm.node.js +2001 -1989
  6. package/dist/client-search.umd.js +2 -2
  7. package/dist/model/acl.d.ts +4 -4
  8. package/dist/model/acl.d.ts.map +1 -1
  9. package/dist/model/action.d.ts +4 -4
  10. package/dist/model/action.d.ts.map +1 -1
  11. package/dist/model/addApiKeyResponse.d.ts +10 -10
  12. package/dist/model/addApiKeyResponse.d.ts.map +1 -1
  13. package/dist/model/advancedSyntaxFeatures.d.ts +1 -1
  14. package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
  15. package/dist/model/alternativesAsExact.d.ts +1 -1
  16. package/dist/model/alternativesAsExact.d.ts.map +1 -1
  17. package/dist/model/anchoring.d.ts +4 -4
  18. package/dist/model/anchoring.d.ts.map +1 -1
  19. package/dist/model/apiKey.d.ts +38 -38
  20. package/dist/model/apiKey.d.ts.map +1 -1
  21. package/dist/model/aroundPrecision.d.ts +6 -0
  22. package/dist/model/aroundPrecision.d.ts.map +1 -0
  23. package/dist/model/aroundPrecisionFromValueInner.d.ts +5 -0
  24. package/dist/model/aroundPrecisionFromValueInner.d.ts.map +1 -0
  25. package/dist/model/aroundRadius.d.ts +5 -5
  26. package/dist/model/aroundRadius.d.ts.map +1 -1
  27. package/dist/model/aroundRadiusAll.d.ts +1 -1
  28. package/dist/model/aroundRadiusAll.d.ts.map +1 -1
  29. package/dist/model/assignUserIdParams.d.ts +9 -9
  30. package/dist/model/assignUserIdParams.d.ts.map +1 -1
  31. package/dist/model/attributeToUpdate.d.ts +2 -2
  32. package/dist/model/attributeToUpdate.d.ts.map +1 -1
  33. package/dist/model/automaticFacetFilter.d.ts +17 -17
  34. package/dist/model/automaticFacetFilter.d.ts.map +1 -1
  35. package/dist/model/automaticFacetFilters.d.ts +5 -5
  36. package/dist/model/automaticFacetFilters.d.ts.map +1 -1
  37. package/dist/model/baseGetApiKeyResponse.d.ts +10 -10
  38. package/dist/model/baseGetApiKeyResponse.d.ts.map +1 -1
  39. package/dist/model/baseIndexSettings.d.ts +62 -58
  40. package/dist/model/baseIndexSettings.d.ts.map +1 -1
  41. package/dist/model/baseSearchParams.d.ts +3 -3
  42. package/dist/model/baseSearchParams.d.ts.map +1 -1
  43. package/dist/model/baseSearchParamsWithoutQuery.d.ts +118 -122
  44. package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
  45. package/dist/model/baseSearchResponse.d.ts +95 -101
  46. package/dist/model/baseSearchResponse.d.ts.map +1 -1
  47. package/dist/model/baseSearchResponseRedirect.d.ts +8 -0
  48. package/dist/model/baseSearchResponseRedirect.d.ts.map +1 -0
  49. package/dist/model/batchAssignUserIdsParams.d.ts +13 -13
  50. package/dist/model/batchAssignUserIdsParams.d.ts.map +1 -1
  51. package/dist/model/batchDictionaryEntriesParams.d.ts +14 -14
  52. package/dist/model/batchDictionaryEntriesParams.d.ts.map +1 -1
  53. package/dist/model/batchDictionaryEntriesRequest.d.ts +6 -6
  54. package/dist/model/batchDictionaryEntriesRequest.d.ts.map +1 -1
  55. package/dist/model/batchParams.d.ts +7 -7
  56. package/dist/model/batchParams.d.ts.map +1 -1
  57. package/dist/model/batchRequest.d.ts +8 -8
  58. package/dist/model/batchRequest.d.ts.map +1 -1
  59. package/dist/model/batchResponse.d.ts +10 -10
  60. package/dist/model/batchResponse.d.ts.map +1 -1
  61. package/dist/model/batchWriteParams.d.ts +7 -7
  62. package/dist/model/batchWriteParams.d.ts.map +1 -1
  63. package/dist/model/browseParams.d.ts +3 -3
  64. package/dist/model/browseParams.d.ts.map +1 -1
  65. package/dist/model/browseParamsObject.d.ts +3 -3
  66. package/dist/model/browseParamsObject.d.ts.map +1 -1
  67. package/dist/model/browseResponse.d.ts +4 -4
  68. package/dist/model/browseResponse.d.ts.map +1 -1
  69. package/dist/model/builtInOperation.d.ts +11 -11
  70. package/dist/model/builtInOperation.d.ts.map +1 -1
  71. package/dist/model/builtInOperationType.d.ts +4 -4
  72. package/dist/model/builtInOperationType.d.ts.map +1 -1
  73. package/dist/model/clientMethodProps.d.ts +719 -714
  74. package/dist/model/clientMethodProps.d.ts.map +1 -1
  75. package/dist/model/condition.d.ts +16 -16
  76. package/dist/model/condition.d.ts.map +1 -1
  77. package/dist/model/consequence.d.ts +25 -25
  78. package/dist/model/consequence.d.ts.map +1 -1
  79. package/dist/model/consequenceHide.d.ts +9 -9
  80. package/dist/model/consequenceHide.d.ts.map +1 -1
  81. package/dist/model/consequenceParams.d.ts +4 -4
  82. package/dist/model/consequenceParams.d.ts.map +1 -1
  83. package/dist/model/consequenceQuery.d.ts +5 -5
  84. package/dist/model/consequenceQuery.d.ts.map +1 -1
  85. package/dist/model/consequenceQueryObject.d.ts +11 -11
  86. package/dist/model/consequenceQueryObject.d.ts.map +1 -1
  87. package/dist/model/createdAtResponse.d.ts +9 -9
  88. package/dist/model/createdAtResponse.d.ts.map +1 -1
  89. package/dist/model/cursor.d.ts +6 -6
  90. package/dist/model/cursor.d.ts.map +1 -1
  91. package/dist/model/deleteApiKeyResponse.d.ts +6 -6
  92. package/dist/model/deleteApiKeyResponse.d.ts.map +1 -1
  93. package/dist/model/deleteByParams.d.ts +27 -0
  94. package/dist/model/deleteByParams.d.ts.map +1 -0
  95. package/dist/model/deleteSourceResponse.d.ts +6 -6
  96. package/dist/model/deleteSourceResponse.d.ts.map +1 -1
  97. package/dist/model/deletedAtResponse.d.ts +13 -13
  98. package/dist/model/deletedAtResponse.d.ts.map +1 -1
  99. package/dist/model/dictionaryAction.d.ts +4 -4
  100. package/dist/model/dictionaryAction.d.ts.map +1 -1
  101. package/dist/model/dictionaryEntry.d.ts +27 -27
  102. package/dist/model/dictionaryEntry.d.ts.map +1 -1
  103. package/dist/model/dictionaryEntryState.d.ts +4 -4
  104. package/dist/model/dictionaryEntryState.d.ts.map +1 -1
  105. package/dist/model/dictionaryLanguage.d.ts +9 -9
  106. package/dist/model/dictionaryLanguage.d.ts.map +1 -1
  107. package/dist/model/dictionarySettingsParams.d.ts +7 -7
  108. package/dist/model/dictionarySettingsParams.d.ts.map +1 -1
  109. package/dist/model/dictionaryType.d.ts +1 -1
  110. package/dist/model/dictionaryType.d.ts.map +1 -1
  111. package/dist/model/distinct.d.ts +4 -4
  112. package/dist/model/distinct.d.ts.map +1 -1
  113. package/dist/model/edit.d.ts +12 -12
  114. package/dist/model/edit.d.ts.map +1 -1
  115. package/dist/model/editType.d.ts +4 -4
  116. package/dist/model/editType.d.ts.map +1 -1
  117. package/dist/model/errorBase.d.ts +6 -6
  118. package/dist/model/errorBase.d.ts.map +1 -1
  119. package/dist/model/exactOnSingleWordQuery.d.ts +4 -4
  120. package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
  121. package/dist/model/facetFilters.d.ts +5 -5
  122. package/dist/model/facetFilters.d.ts.map +1 -1
  123. package/dist/model/facetHits.d.ts +14 -14
  124. package/dist/model/facetHits.d.ts.map +1 -1
  125. package/dist/model/facetOrdering.d.ts +12 -12
  126. package/dist/model/facetOrdering.d.ts.map +1 -1
  127. package/dist/model/facets.d.ts +9 -9
  128. package/dist/model/facets.d.ts.map +1 -1
  129. package/dist/model/facetsStats.d.ts +18 -18
  130. package/dist/model/facetsStats.d.ts.map +1 -1
  131. package/dist/model/fetchedIndex.d.ts +46 -46
  132. package/dist/model/fetchedIndex.d.ts.map +1 -1
  133. package/dist/model/getApiKeyResponse.d.ts +3 -3
  134. package/dist/model/getApiKeyResponse.d.ts.map +1 -1
  135. package/dist/model/getDictionarySettingsResponse.d.ts +4 -4
  136. package/dist/model/getDictionarySettingsResponse.d.ts.map +1 -1
  137. package/dist/model/getLogsResponse.d.ts +4 -4
  138. package/dist/model/getLogsResponse.d.ts.map +1 -1
  139. package/dist/model/getObjectsParams.d.ts +7 -7
  140. package/dist/model/getObjectsParams.d.ts.map +1 -1
  141. package/dist/model/getObjectsRequest.d.ts +17 -17
  142. package/dist/model/getObjectsRequest.d.ts.map +1 -1
  143. package/dist/model/getObjectsResponse.d.ts +6 -6
  144. package/dist/model/getObjectsResponse.d.ts.map +1 -1
  145. package/dist/model/getTaskResponse.d.ts +4 -4
  146. package/dist/model/getTaskResponse.d.ts.map +1 -1
  147. package/dist/model/getTopUserIdsResponse.d.ts +10 -10
  148. package/dist/model/getTopUserIdsResponse.d.ts.map +1 -1
  149. package/dist/model/hasPendingMappingsResponse.d.ts +10 -10
  150. package/dist/model/hasPendingMappingsResponse.d.ts.map +1 -1
  151. package/dist/model/highlightResult.d.ts +2 -2
  152. package/dist/model/highlightResult.d.ts.map +1 -1
  153. package/dist/model/highlightResultOption.d.ts +19 -19
  154. package/dist/model/highlightResultOption.d.ts.map +1 -1
  155. package/dist/model/hit.d.ts +22 -22
  156. package/dist/model/hit.d.ts.map +1 -1
  157. package/dist/model/ignorePlurals.d.ts +4 -4
  158. package/dist/model/ignorePlurals.d.ts.map +1 -1
  159. package/dist/model/index.d.ts +162 -154
  160. package/dist/model/index.d.ts.map +1 -1
  161. package/dist/model/indexSettings.d.ts +6 -6
  162. package/dist/model/indexSettings.d.ts.map +1 -1
  163. package/dist/model/indexSettingsAsSearchParams.d.ts +166 -160
  164. package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  165. package/dist/model/languages.d.ts +9 -9
  166. package/dist/model/languages.d.ts.map +1 -1
  167. package/dist/model/listApiKeysResponse.d.ts +7 -7
  168. package/dist/model/listApiKeysResponse.d.ts.map +1 -1
  169. package/dist/model/listClustersResponse.d.ts +9 -9
  170. package/dist/model/listClustersResponse.d.ts.map +1 -1
  171. package/dist/model/listIndicesResponse.d.ts +11 -11
  172. package/dist/model/listIndicesResponse.d.ts.map +1 -1
  173. package/dist/model/listUserIdsResponse.d.ts +10 -10
  174. package/dist/model/listUserIdsResponse.d.ts.map +1 -1
  175. package/dist/model/log.d.ts +63 -63
  176. package/dist/model/log.d.ts.map +1 -1
  177. package/dist/model/logQuery.d.ts +14 -14
  178. package/dist/model/logQuery.d.ts.map +1 -1
  179. package/dist/model/logType.d.ts +1 -1
  180. package/dist/model/logType.d.ts.map +1 -1
  181. package/dist/model/matchLevel.d.ts +4 -4
  182. package/dist/model/matchLevel.d.ts.map +1 -1
  183. package/dist/model/matchedGeoLocation.d.ts +14 -14
  184. package/dist/model/matchedGeoLocation.d.ts.map +1 -1
  185. package/dist/model/mixedSearchFilters.d.ts +1 -1
  186. package/dist/model/mixedSearchFilters.d.ts.map +1 -1
  187. package/dist/model/mode.d.ts +5 -0
  188. package/dist/model/mode.d.ts.map +1 -0
  189. package/dist/model/multipleBatchRequest.d.ts +12 -12
  190. package/dist/model/multipleBatchRequest.d.ts.map +1 -1
  191. package/dist/model/multipleBatchResponse.d.ts +10 -10
  192. package/dist/model/multipleBatchResponse.d.ts.map +1 -1
  193. package/dist/model/numericFilters.d.ts +5 -5
  194. package/dist/model/numericFilters.d.ts.map +1 -1
  195. package/dist/model/operationIndexParams.d.ts +13 -13
  196. package/dist/model/operationIndexParams.d.ts.map +1 -1
  197. package/dist/model/operationType.d.ts +4 -4
  198. package/dist/model/operationType.d.ts.map +1 -1
  199. package/dist/model/optionalFilters.d.ts +5 -5
  200. package/dist/model/optionalFilters.d.ts.map +1 -1
  201. package/dist/model/params.d.ts +12 -12
  202. package/dist/model/params.d.ts.map +1 -1
  203. package/dist/model/personalization.d.ts +14 -14
  204. package/dist/model/personalization.d.ts.map +1 -1
  205. package/dist/model/promote.d.ts +3 -3
  206. package/dist/model/promote.d.ts.map +1 -1
  207. package/dist/model/promoteObjectID.d.ts +13 -13
  208. package/dist/model/promoteObjectID.d.ts.map +1 -1
  209. package/dist/model/promoteObjectIDs.d.ts +13 -13
  210. package/dist/model/promoteObjectIDs.d.ts.map +1 -1
  211. package/dist/model/queryType.d.ts +4 -4
  212. package/dist/model/queryType.d.ts.map +1 -1
  213. package/dist/model/rankingInfo.d.ts +50 -50
  214. package/dist/model/rankingInfo.d.ts.map +1 -1
  215. package/dist/model/reRankingApplyFilter.d.ts +5 -5
  216. package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
  217. package/dist/model/redirectRuleIndexMetadata.d.ts +21 -0
  218. package/dist/model/redirectRuleIndexMetadata.d.ts.map +1 -0
  219. package/dist/model/redirectRuleIndexMetadataData.d.ts +7 -0
  220. package/dist/model/redirectRuleIndexMetadataData.d.ts.map +1 -0
  221. package/dist/model/removeStopWords.d.ts +4 -4
  222. package/dist/model/removeStopWords.d.ts.map +1 -1
  223. package/dist/model/removeUserIdResponse.d.ts +6 -6
  224. package/dist/model/removeUserIdResponse.d.ts.map +1 -1
  225. package/dist/model/removeWordsIfNoResults.d.ts +4 -4
  226. package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
  227. package/dist/model/renderingContent.d.ts +7 -7
  228. package/dist/model/renderingContent.d.ts.map +1 -1
  229. package/dist/model/replaceSourceResponse.d.ts +6 -6
  230. package/dist/model/replaceSourceResponse.d.ts.map +1 -1
  231. package/dist/model/rule.d.ts +29 -29
  232. package/dist/model/rule.d.ts.map +1 -1
  233. package/dist/model/saveObjectResponse.d.ts +14 -11
  234. package/dist/model/saveObjectResponse.d.ts.map +1 -1
  235. package/dist/model/saveSynonymResponse.d.ts +14 -14
  236. package/dist/model/saveSynonymResponse.d.ts.map +1 -1
  237. package/dist/model/scopeType.d.ts +1 -1
  238. package/dist/model/scopeType.d.ts.map +1 -1
  239. package/dist/model/searchDictionaryEntriesParams.d.ts +21 -21
  240. package/dist/model/searchDictionaryEntriesParams.d.ts.map +1 -1
  241. package/dist/model/searchForFacetValuesRequest.d.ts +14 -14
  242. package/dist/model/searchForFacetValuesRequest.d.ts.map +1 -1
  243. package/dist/model/searchForFacetValuesResponse.d.ts +4 -4
  244. package/dist/model/searchForFacetValuesResponse.d.ts.map +1 -1
  245. package/dist/model/searchForFacets.d.ts +3 -3
  246. package/dist/model/searchForFacets.d.ts.map +1 -1
  247. package/dist/model/searchForFacetsOptions.d.ts +20 -20
  248. package/dist/model/searchForFacetsOptions.d.ts.map +1 -1
  249. package/dist/model/searchForHits.d.ts +3 -3
  250. package/dist/model/searchForHits.d.ts.map +1 -1
  251. package/dist/model/searchForHitsOptions.d.ts +12 -12
  252. package/dist/model/searchForHitsOptions.d.ts.map +1 -1
  253. package/dist/model/searchHits.d.ts +12 -4
  254. package/dist/model/searchHits.d.ts.map +1 -1
  255. package/dist/model/searchMethodParams.d.ts +6 -6
  256. package/dist/model/searchMethodParams.d.ts.map +1 -1
  257. package/dist/model/searchParams.d.ts +3 -3
  258. package/dist/model/searchParams.d.ts.map +1 -1
  259. package/dist/model/searchParamsObject.d.ts +3 -3
  260. package/dist/model/searchParamsObject.d.ts.map +1 -1
  261. package/dist/model/searchParamsQuery.d.ts +6 -6
  262. package/dist/model/searchParamsQuery.d.ts.map +1 -1
  263. package/dist/model/searchParamsString.d.ts +6 -6
  264. package/dist/model/searchParamsString.d.ts.map +1 -1
  265. package/dist/model/searchQuery.d.ts +3 -3
  266. package/dist/model/searchQuery.d.ts.map +1 -1
  267. package/dist/model/searchResponse.d.ts +3 -3
  268. package/dist/model/searchResponse.d.ts.map +1 -1
  269. package/dist/model/searchResponses.d.ts +4 -4
  270. package/dist/model/searchResponses.d.ts.map +1 -1
  271. package/dist/model/searchResult.d.ts +4 -0
  272. package/dist/model/searchResult.d.ts.map +1 -0
  273. package/dist/model/searchRulesParams.d.ts +31 -31
  274. package/dist/model/searchRulesParams.d.ts.map +1 -1
  275. package/dist/model/searchRulesResponse.d.ts +19 -19
  276. package/dist/model/searchRulesResponse.d.ts.map +1 -1
  277. package/dist/model/searchStrategy.d.ts +4 -1
  278. package/dist/model/searchStrategy.d.ts.map +1 -1
  279. package/dist/model/searchSynonymsParams.d.ts +6 -6
  280. package/dist/model/searchSynonymsParams.d.ts.map +1 -1
  281. package/dist/model/searchSynonymsResponse.d.ts +11 -11
  282. package/dist/model/searchSynonymsResponse.d.ts.map +1 -1
  283. package/dist/model/searchTypeDefault.d.ts +4 -4
  284. package/dist/model/searchTypeDefault.d.ts.map +1 -1
  285. package/dist/model/searchTypeFacet.d.ts +4 -4
  286. package/dist/model/searchTypeFacet.d.ts.map +1 -1
  287. package/dist/model/searchUserIdsParams.d.ts +21 -21
  288. package/dist/model/searchUserIdsParams.d.ts.map +1 -1
  289. package/dist/model/searchUserIdsResponse.d.ts +26 -26
  290. package/dist/model/searchUserIdsResponse.d.ts.map +1 -1
  291. package/dist/model/semanticSearch.d.ts +10 -0
  292. package/dist/model/semanticSearch.d.ts.map +1 -0
  293. package/dist/model/snippetResult.d.ts +2 -2
  294. package/dist/model/snippetResult.d.ts.map +1 -1
  295. package/dist/model/snippetResultOption.d.ts +11 -11
  296. package/dist/model/snippetResultOption.d.ts.map +1 -1
  297. package/dist/model/sortRemainingBy.d.ts +4 -4
  298. package/dist/model/sortRemainingBy.d.ts.map +1 -1
  299. package/dist/model/source.d.ts +13 -13
  300. package/dist/model/source.d.ts.map +1 -1
  301. package/dist/model/standardEntries.d.ts +17 -17
  302. package/dist/model/standardEntries.d.ts.map +1 -1
  303. package/dist/model/synonymHit.d.ts +35 -37
  304. package/dist/model/synonymHit.d.ts.map +1 -1
  305. package/dist/model/synonymType.d.ts +4 -4
  306. package/dist/model/synonymType.d.ts.map +1 -1
  307. package/dist/model/tagFilters.d.ts +5 -5
  308. package/dist/model/tagFilters.d.ts.map +1 -1
  309. package/dist/model/taskStatus.d.ts +4 -1
  310. package/dist/model/taskStatus.d.ts.map +1 -1
  311. package/dist/model/timeRange.d.ts +10 -10
  312. package/dist/model/timeRange.d.ts.map +1 -1
  313. package/dist/model/typoTolerance.d.ts +5 -5
  314. package/dist/model/typoTolerance.d.ts.map +1 -1
  315. package/dist/model/typoToleranceEnum.d.ts +1 -1
  316. package/dist/model/typoToleranceEnum.d.ts.map +1 -1
  317. package/dist/model/updateApiKeyResponse.d.ts +10 -10
  318. package/dist/model/updateApiKeyResponse.d.ts.map +1 -1
  319. package/dist/model/updatedAtResponse.d.ts +13 -13
  320. package/dist/model/updatedAtResponse.d.ts.map +1 -1
  321. package/dist/model/updatedAtWithObjectIdResponse.d.ts +17 -17
  322. package/dist/model/updatedAtWithObjectIdResponse.d.ts.map +1 -1
  323. package/dist/model/updatedRuleResponse.d.ts +14 -14
  324. package/dist/model/updatedRuleResponse.d.ts.map +1 -1
  325. package/dist/model/userHighlightResult.d.ts +11 -11
  326. package/dist/model/userHighlightResult.d.ts.map +1 -1
  327. package/dist/model/userHit.d.ts +24 -24
  328. package/dist/model/userHit.d.ts.map +1 -1
  329. package/dist/model/userId.d.ts +21 -21
  330. package/dist/model/userId.d.ts.map +1 -1
  331. package/dist/model/value.d.ts +8 -8
  332. package/dist/model/value.d.ts.map +1 -1
  333. package/dist/src/searchClient.d.ts +724 -723
  334. package/dist/src/searchClient.d.ts.map +1 -1
  335. package/index.js +1 -1
  336. package/model/acl.ts +2 -2
  337. package/model/action.ts +2 -2
  338. package/model/addApiKeyResponse.ts +3 -3
  339. package/model/advancedSyntaxFeatures.ts +1 -1
  340. package/model/alternativesAsExact.ts +1 -1
  341. package/model/anchoring.ts +2 -2
  342. package/model/apiKey.ts +10 -10
  343. package/model/aroundPrecision.ts +8 -0
  344. package/model/aroundPrecisionFromValueInner.ts +7 -0
  345. package/model/aroundRadius.ts +2 -2
  346. package/model/aroundRadiusAll.ts +1 -1
  347. package/model/assignUserIdParams.ts +2 -2
  348. package/model/attributeToUpdate.ts +1 -1
  349. package/model/automaticFacetFilter.ts +1 -1
  350. package/model/automaticFacetFilters.ts +1 -1
  351. package/model/baseGetApiKeyResponse.ts +3 -3
  352. package/model/baseIndexSettings.ts +19 -14
  353. package/model/baseSearchParams.ts +1 -1
  354. package/model/baseSearchParamsWithoutQuery.ts +38 -43
  355. package/model/baseSearchResponse.ts +21 -28
  356. package/model/baseSearchResponseRedirect.ts +10 -0
  357. package/model/batchAssignUserIdsParams.ts +3 -3
  358. package/model/batchDictionaryEntriesParams.ts +4 -4
  359. package/model/batchDictionaryEntriesRequest.ts +1 -1
  360. package/model/batchParams.ts +2 -2
  361. package/model/batchRequest.ts +2 -2
  362. package/model/batchResponse.ts +3 -3
  363. package/model/batchWriteParams.ts +2 -2
  364. package/model/browseParams.ts +1 -1
  365. package/model/browseParamsObject.ts +1 -1
  366. package/model/browseResponse.ts +1 -1
  367. package/model/builtInOperation.ts +2 -2
  368. package/model/builtInOperationType.ts +2 -2
  369. package/model/clientMethodProps.ts +91 -86
  370. package/model/condition.ts +1 -1
  371. package/model/consequence.ts +5 -5
  372. package/model/consequenceHide.ts +3 -3
  373. package/model/consequenceParams.ts +1 -1
  374. package/model/consequenceQuery.ts +1 -1
  375. package/model/consequenceQueryObject.ts +1 -1
  376. package/model/createdAtResponse.ts +3 -3
  377. package/model/cursor.ts +2 -2
  378. package/model/deleteApiKeyResponse.ts +2 -2
  379. package/model/deleteByParams.ts +36 -0
  380. package/model/deleteSourceResponse.ts +2 -2
  381. package/model/deletedAtResponse.ts +4 -4
  382. package/model/dictionaryAction.ts +1 -1
  383. package/model/dictionaryEntry.ts +7 -7
  384. package/model/dictionaryEntryState.ts +2 -2
  385. package/model/dictionaryLanguage.ts +3 -3
  386. package/model/dictionarySettingsParams.ts +2 -2
  387. package/model/dictionaryType.ts +1 -1
  388. package/model/distinct.ts +2 -2
  389. package/model/edit.ts +1 -1
  390. package/model/editType.ts +1 -1
  391. package/model/errorBase.ts +1 -1
  392. package/model/exactOnSingleWordQuery.ts +2 -2
  393. package/model/facetFilters.ts +2 -2
  394. package/model/facetHits.ts +4 -4
  395. package/model/facetOrdering.ts +3 -3
  396. package/model/facets.ts +2 -2
  397. package/model/facetsStats.ts +5 -5
  398. package/model/fetchedIndex.ts +3 -3
  399. package/model/getApiKeyResponse.ts +1 -1
  400. package/model/getDictionarySettingsResponse.ts +1 -1
  401. package/model/getLogsResponse.ts +1 -1
  402. package/model/getObjectsParams.ts +2 -2
  403. package/model/getObjectsRequest.ts +5 -5
  404. package/model/getObjectsResponse.ts +2 -2
  405. package/model/getTaskResponse.ts +1 -1
  406. package/model/getTopUserIdsResponse.ts +3 -3
  407. package/model/hasPendingMappingsResponse.ts +3 -3
  408. package/model/highlightResult.ts +1 -1
  409. package/model/highlightResultOption.ts +2 -2
  410. package/model/hit.ts +2 -2
  411. package/model/ignorePlurals.ts +2 -2
  412. package/model/index.ts +10 -2
  413. package/model/indexSettings.ts +2 -2
  414. package/model/indexSettingsAsSearchParams.ts +53 -44
  415. package/model/languages.ts +2 -2
  416. package/model/listApiKeysResponse.ts +2 -2
  417. package/model/listClustersResponse.ts +3 -3
  418. package/model/listIndicesResponse.ts +2 -2
  419. package/model/listUserIdsResponse.ts +3 -3
  420. package/model/log.ts +8 -8
  421. package/model/logQuery.ts +2 -2
  422. package/model/logType.ts +1 -1
  423. package/model/matchLevel.ts +1 -1
  424. package/model/matchedGeoLocation.ts +1 -1
  425. package/model/mixedSearchFilters.ts +1 -1
  426. package/model/mode.ts +6 -0
  427. package/model/multipleBatchRequest.ts +2 -2
  428. package/model/multipleBatchResponse.ts +3 -3
  429. package/model/numericFilters.ts +2 -2
  430. package/model/operationIndexParams.ts +3 -3
  431. package/model/operationType.ts +2 -2
  432. package/model/optionalFilters.ts +2 -2
  433. package/model/params.ts +2 -2
  434. package/model/personalization.ts +1 -1
  435. package/model/promote.ts +1 -1
  436. package/model/promoteObjectID.ts +4 -4
  437. package/model/promoteObjectIDs.ts +4 -4
  438. package/model/queryType.ts +2 -2
  439. package/model/rankingInfo.ts +1 -1
  440. package/model/reRankingApplyFilter.ts +2 -2
  441. package/model/redirectRuleIndexMetadata.ts +27 -0
  442. package/model/redirectRuleIndexMetadataData.ts +8 -0
  443. package/model/removeStopWords.ts +2 -2
  444. package/model/removeUserIdResponse.ts +2 -2
  445. package/model/removeWordsIfNoResults.ts +2 -2
  446. package/model/renderingContent.ts +2 -2
  447. package/model/replaceSourceResponse.ts +2 -2
  448. package/model/rule.ts +6 -6
  449. package/model/saveObjectResponse.ts +6 -3
  450. package/model/saveSynonymResponse.ts +4 -4
  451. package/model/scopeType.ts +1 -1
  452. package/model/searchDictionaryEntriesParams.ts +6 -6
  453. package/model/searchForFacetValuesRequest.ts +3 -3
  454. package/model/searchForFacetValuesResponse.ts +1 -1
  455. package/model/searchForFacets.ts +1 -1
  456. package/model/searchForFacetsOptions.ts +4 -4
  457. package/model/searchForHits.ts +1 -1
  458. package/model/searchForHitsOptions.ts +2 -2
  459. package/model/searchHits.ts +11 -1
  460. package/model/searchMethodParams.ts +1 -1
  461. package/model/searchParams.ts +1 -1
  462. package/model/searchParamsObject.ts +1 -1
  463. package/model/searchParamsQuery.ts +2 -2
  464. package/model/searchParamsString.ts +2 -2
  465. package/model/searchQuery.ts +1 -1
  466. package/model/searchResponse.ts +1 -1
  467. package/model/searchResponses.ts +3 -3
  468. package/model/searchResult.ts +8 -0
  469. package/model/searchRulesParams.ts +9 -9
  470. package/model/searchRulesResponse.ts +1 -1
  471. package/model/searchStrategy.ts +4 -1
  472. package/model/searchSynonymsParams.ts +2 -2
  473. package/model/searchSynonymsResponse.ts +3 -3
  474. package/model/searchTypeDefault.ts +2 -2
  475. package/model/searchTypeFacet.ts +2 -2
  476. package/model/searchUserIdsParams.ts +5 -5
  477. package/model/searchUserIdsResponse.ts +6 -6
  478. package/model/semanticSearch.ts +11 -0
  479. package/model/snippetResult.ts +1 -1
  480. package/model/snippetResultOption.ts +2 -2
  481. package/model/sortRemainingBy.ts +2 -2
  482. package/model/source.ts +4 -4
  483. package/model/standardEntries.ts +5 -5
  484. package/model/synonymHit.ts +7 -10
  485. package/model/synonymType.ts +2 -2
  486. package/model/tagFilters.ts +2 -2
  487. package/model/taskStatus.ts +4 -1
  488. package/model/timeRange.ts +1 -1
  489. package/model/typoTolerance.ts +2 -2
  490. package/model/typoToleranceEnum.ts +1 -1
  491. package/model/updateApiKeyResponse.ts +3 -3
  492. package/model/updatedAtResponse.ts +4 -4
  493. package/model/updatedAtWithObjectIdResponse.ts +5 -5
  494. package/model/updatedRuleResponse.ts +4 -4
  495. package/model/userHighlightResult.ts +1 -1
  496. package/model/userHit.ts +2 -2
  497. package/model/userId.ts +3 -3
  498. package/model/value.ts +1 -1
  499. package/package.json +30 -13
  500. package/dist/model/synonymHitHighlightResult.d.ts +0 -12
  501. package/dist/model/synonymHitHighlightResult.d.ts.map +0 -1
  502. package/model/synonymHitHighlightResult.ts +0 -15
@@ -7,23 +7,21 @@ function createAuth(appId, apiKey, authMode = 'WithinHeaders') {
7
7
  headers() {
8
8
  return authMode === 'WithinHeaders' ? credentials : {};
9
9
  },
10
-
11
10
  queryParameters() {
12
11
  return authMode === 'WithinQueryParameters' ? credentials : {};
13
12
  }
14
-
15
13
  };
16
14
  }
17
15
 
18
- /**
19
- * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
20
- *
21
- * @param createIterator - The createIterator options.
22
- * @param createIterator.func - The function to run, which returns a promise.
23
- * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
24
- * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
25
- * @param createIterator.error - The `validate` condition to throw an error, and its message.
26
- * @param createIterator.timeout - The function to decide how long to wait between iterations.
16
+ /**
17
+ * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
18
+ *
19
+ * @param createIterator - The createIterator options.
20
+ * @param createIterator.func - The function to run, which returns a promise.
21
+ * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
22
+ * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
23
+ * @param createIterator.error - The `validate` condition to throw an error, and its message.
24
+ * @param createIterator.timeout - The function to decide how long to wait between iterations.
27
25
  */
28
26
  function createIterablePromise({
29
27
  func,
@@ -38,15 +36,12 @@ function createIterablePromise({
38
36
  if (aggregator) {
39
37
  aggregator(response);
40
38
  }
41
-
42
39
  if (validate(response)) {
43
40
  return resolve(response);
44
41
  }
45
-
46
42
  if (error && error.validate(response)) {
47
43
  return reject(new Error(error.message(response)));
48
44
  }
49
-
50
45
  return setTimeout(() => {
51
46
  retry(response).then(resolve).catch(reject);
52
47
  }, timeout());
@@ -55,27 +50,22 @@ function createIterablePromise({
55
50
  });
56
51
  });
57
52
  };
58
-
59
53
  return retry();
60
54
  }
61
55
 
62
56
  function createBrowserLocalStorageCache(options) {
63
- let storage; // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change
64
-
57
+ let storage;
58
+ // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change
65
59
  const namespaceKey = `algolia-client-js-${options.key}`;
66
-
67
60
  function getStorage() {
68
61
  if (storage === undefined) {
69
62
  storage = options.localStorage || window.localStorage;
70
63
  }
71
-
72
64
  return storage;
73
65
  }
74
-
75
66
  function getNamespace() {
76
67
  return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
77
68
  }
78
-
79
69
  return {
80
70
  get(key, defaultValue, events = {
81
71
  miss: () => Promise.resolve()
@@ -88,7 +78,6 @@ function createBrowserLocalStorageCache(options) {
88
78
  return Promise.all([value, exists || events.miss(value)]);
89
79
  }).then(([value]) => value);
90
80
  },
91
-
92
81
  set(key, value) {
93
82
  return Promise.resolve().then(() => {
94
83
  const namespace = getNamespace();
@@ -97,7 +86,6 @@ function createBrowserLocalStorageCache(options) {
97
86
  return value;
98
87
  });
99
88
  },
100
-
101
89
  delete(key) {
102
90
  return Promise.resolve().then(() => {
103
91
  const namespace = getNamespace();
@@ -105,13 +93,11 @@ function createBrowserLocalStorageCache(options) {
105
93
  getStorage().setItem(namespaceKey, JSON.stringify(namespace));
106
94
  });
107
95
  },
108
-
109
96
  clear() {
110
97
  return Promise.resolve().then(() => {
111
98
  getStorage().removeItem(namespaceKey);
112
99
  });
113
100
  }
114
-
115
101
  };
116
102
  }
117
103
 
@@ -123,30 +109,24 @@ function createNullCache() {
123
109
  const value = defaultValue();
124
110
  return value.then(result => Promise.all([result, events.miss(result)])).then(([result]) => result);
125
111
  },
126
-
127
112
  set(_key, value) {
128
113
  return Promise.resolve(value);
129
114
  },
130
-
131
115
  delete(_key) {
132
116
  return Promise.resolve();
133
117
  },
134
-
135
118
  clear() {
136
119
  return Promise.resolve();
137
120
  }
138
-
139
121
  };
140
122
  }
141
123
 
142
124
  function createFallbackableCache(options) {
143
125
  const caches = [...options.caches];
144
126
  const current = caches.shift();
145
-
146
127
  if (current === undefined) {
147
128
  return createNullCache();
148
129
  }
149
-
150
130
  return {
151
131
  get(key, defaultValue, events = {
152
132
  miss: () => Promise.resolve()
@@ -157,7 +137,6 @@ function createFallbackableCache(options) {
157
137
  }).get(key, defaultValue, events);
158
138
  });
159
139
  },
160
-
161
140
  set(key, value) {
162
141
  return current.set(key, value).catch(() => {
163
142
  return createFallbackableCache({
@@ -165,7 +144,6 @@ function createFallbackableCache(options) {
165
144
  }).set(key, value);
166
145
  });
167
146
  },
168
-
169
147
  delete(key) {
170
148
  return current.delete(key).catch(() => {
171
149
  return createFallbackableCache({
@@ -173,7 +151,6 @@ function createFallbackableCache(options) {
173
151
  }).delete(key);
174
152
  });
175
153
  },
176
-
177
154
  clear() {
178
155
  return current.clear().catch(() => {
179
156
  return createFallbackableCache({
@@ -181,7 +158,6 @@ function createFallbackableCache(options) {
181
158
  }).clear();
182
159
  });
183
160
  }
184
-
185
161
  };
186
162
  }
187
163
 
@@ -194,30 +170,24 @@ function createMemoryCache(options = {
194
170
  miss: () => Promise.resolve()
195
171
  }) {
196
172
  const keyAsString = JSON.stringify(key);
197
-
198
173
  if (keyAsString in cache) {
199
174
  return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
200
175
  }
201
-
202
176
  const promise = defaultValue();
203
177
  return promise.then(value => events.miss(value)).then(() => promise);
204
178
  },
205
-
206
179
  set(key, value) {
207
180
  cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
208
181
  return Promise.resolve(value);
209
182
  },
210
-
211
183
  delete(key) {
212
184
  delete cache[JSON.stringify(key)];
213
185
  return Promise.resolve();
214
186
  },
215
-
216
187
  clear() {
217
188
  cache = {};
218
189
  return Promise.resolve();
219
190
  }
220
-
221
191
  };
222
192
  }
223
193
 
@@ -226,16 +196,14 @@ function createMemoryCache(options = {
226
196
  const EXPIRATION_DELAY = 2 * 60 * 1000;
227
197
  function createStatefulHost(host, status = 'up') {
228
198
  const lastUpdate = Date.now();
229
-
230
199
  function isUp() {
231
200
  return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;
232
201
  }
233
-
234
202
  function isTimedOut() {
235
203
  return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;
236
204
  }
237
-
238
- return { ...host,
205
+ return {
206
+ ...host,
239
207
  status,
240
208
  lastUpdate,
241
209
  isUp,
@@ -244,6 +212,7 @@ function createStatefulHost(host, status = 'up') {
244
212
  }
245
213
 
246
214
  function _defineProperty(obj, key, value) {
215
+ key = _toPropertyKey(key);
247
216
  if (key in obj) {
248
217
  Object.defineProperty(obj, key, {
249
218
  value: value,
@@ -254,92 +223,96 @@ function _defineProperty(obj, key, value) {
254
223
  } else {
255
224
  obj[key] = value;
256
225
  }
257
-
258
226
  return obj;
259
227
  }
228
+ function _toPrimitive(input, hint) {
229
+ if (typeof input !== "object" || input === null) return input;
230
+ var prim = input[Symbol.toPrimitive];
231
+ if (prim !== undefined) {
232
+ var res = prim.call(input, hint || "default");
233
+ if (typeof res !== "object") return res;
234
+ throw new TypeError("@@toPrimitive must return a primitive value.");
235
+ }
236
+ return (hint === "string" ? String : Number)(input);
237
+ }
238
+ function _toPropertyKey(arg) {
239
+ var key = _toPrimitive(arg, "string");
240
+ return typeof key === "symbol" ? key : String(key);
241
+ }
260
242
 
261
243
  class AlgoliaError extends Error {
262
244
  constructor(message, name) {
263
245
  super(message);
264
-
265
246
  _defineProperty(this, "name", 'AlgoliaError');
266
-
267
247
  if (name) {
268
248
  this.name = name;
269
249
  }
270
250
  }
271
-
272
251
  }
273
252
  class ErrorWithStackTrace extends AlgoliaError {
274
253
  constructor(message, stackTrace, name) {
275
- super(message, name); // the array and object should be frozen to reflect the stackTrace at the time of the error
276
-
254
+ super(message, name);
255
+ // the array and object should be frozen to reflect the stackTrace at the time of the error
277
256
  _defineProperty(this, "stackTrace", void 0);
278
-
279
257
  this.stackTrace = stackTrace;
280
258
  }
281
-
282
259
  }
283
260
  class RetryError extends ErrorWithStackTrace {
284
261
  constructor(stackTrace) {
285
262
  super('Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', stackTrace, 'RetryError');
286
263
  }
287
-
288
264
  }
289
265
  class ApiError extends ErrorWithStackTrace {
290
- constructor(message, status, stackTrace) {
291
- super(message, stackTrace, 'ApiError');
292
-
266
+ constructor(message, status, stackTrace, name = 'ApiError') {
267
+ super(message, stackTrace, name);
293
268
  _defineProperty(this, "status", void 0);
294
-
295
269
  this.status = status;
296
270
  }
297
-
298
271
  }
299
272
  class DeserializationError extends AlgoliaError {
300
273
  constructor(message, response) {
301
274
  super(message, 'DeserializationError');
302
-
303
275
  _defineProperty(this, "response", void 0);
304
-
305
276
  this.response = response;
306
277
  }
307
-
278
+ }
279
+ // DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.
280
+ class DetailedApiError extends ApiError {
281
+ constructor(message, status, error, stackTrace) {
282
+ super(message, status, stackTrace, 'DetailedApiError');
283
+ _defineProperty(this, "error", void 0);
284
+ this.error = error;
285
+ }
308
286
  }
309
287
 
310
288
  function shuffle(array) {
311
289
  const shuffledArray = array;
312
-
313
290
  for (let c = array.length - 1; c > 0; c--) {
314
291
  const b = Math.floor(Math.random() * (c + 1));
315
292
  const a = array[c];
316
293
  shuffledArray[c] = array[b];
317
294
  shuffledArray[b] = a;
318
295
  }
319
-
320
296
  return shuffledArray;
321
297
  }
322
298
  function serializeUrl(host, path, queryParameters) {
323
299
  const queryParametersAsString = serializeQueryParameters(queryParameters);
324
300
  let url = `${host.protocol}://${host.url}/${path.charAt(0) === '/' ? path.substr(1) : path}`;
325
-
326
301
  if (queryParametersAsString.length) {
327
302
  url += `?${queryParametersAsString}`;
328
303
  }
329
-
330
304
  return url;
331
305
  }
332
306
  function serializeQueryParameters(parameters) {
333
307
  const isObjectOrArray = value => Object.prototype.toString.call(value) === '[object Object]' || Object.prototype.toString.call(value) === '[object Array]';
334
-
335
- return Object.keys(parameters).map(key => `${key}=${isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]}`).join('&');
308
+ return Object.keys(parameters).map(key => `${key}=${encodeURIComponent(isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key])}`).join('&');
336
309
  }
337
310
  function serializeData(request, requestOptions) {
338
311
  if (request.method === 'GET' || request.data === undefined && requestOptions.data === undefined) {
339
312
  return undefined;
340
313
  }
341
-
342
- const data = Array.isArray(request.data) ? request.data : { ...request.data,
314
+ const data = Array.isArray(request.data) ? request.data : {
315
+ ...request.data,
343
316
  ...requestOptions.data
344
317
  };
345
318
  return JSON.stringify(data);
@@ -369,14 +342,16 @@ function deserializeFailure({
369
342
  content,
370
343
  status
371
344
  }, stackFrame) {
372
- let message = content;
373
-
374
345
  try {
375
- message = JSON.parse(content).message;
376
- } catch (e) {// ..
346
+ const parsed = JSON.parse(content);
347
+ if ('error' in parsed) {
348
+ return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);
349
+ }
350
+ return new ApiError(parsed.message, status, stackFrame);
351
+ } catch (e) {
352
+ // ..
377
353
  }
378
-
379
- return new ApiError(message, status, stackFrame);
354
+ return new ApiError(content, status, stackFrame);
380
355
  }
381
356
 
382
357
  function isNetworkError({
@@ -407,9 +382,12 @@ function stackFrameWithoutCredentials(stackFrame) {
407
382
  const modifiedHeaders = stackFrame.request.headers['x-algolia-api-key'] ? {
408
383
  'x-algolia-api-key': '*****'
409
384
  } : {};
410
- return { ...stackFrame,
411
- request: { ...stackFrame.request,
412
- headers: { ...stackFrame.request.headers,
385
+ return {
386
+ ...stackFrame,
387
+ request: {
388
+ ...stackFrame.request,
389
+ headers: {
390
+ ...stackFrame.request.headers,
413
391
  ...modifiedHeaders
414
392
  }
415
393
  }
@@ -434,51 +412,49 @@ function createTransporter({
434
412
  });
435
413
  }));
436
414
  const hostsUp = statefulHosts.filter(host => host.isUp());
437
- const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut()); // Note, we put the hosts that previously timed out on the end of the list.
438
-
415
+ const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
416
+ // Note, we put the hosts that previously timed out on the end of the list.
439
417
  const hostsAvailable = [...hostsUp, ...hostsTimedOut];
440
418
  const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;
441
419
  return {
442
420
  hosts: compatibleHostsAvailable,
443
-
444
421
  getTimeout(timeoutsCount, baseTimeout) {
445
- /**
446
- * Imagine that you have 4 hosts, if timeouts will increase
447
- * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
448
- *
449
- * Note that, the very next request, we start from the previous timeout.
450
- *
451
- * 5 (timed out) > 6 (timed out) > 7 ...
452
- *
453
- * This strategy may need to be reviewed, but is the strategy on the our
454
- * current v3 version.
422
+ /**
423
+ * Imagine that you have 4 hosts, if timeouts will increase
424
+ * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
425
+ *
426
+ * Note that, the very next request, we start from the previous timeout.
427
+ *
428
+ * 5 (timed out) > 6 (timed out) > 7 ...
429
+ *
430
+ * This strategy may need to be reviewed, but is the strategy on the our
431
+ * current v3 version.
455
432
  */
456
433
  const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
457
434
  return timeoutMultiplier * baseTimeout;
458
435
  }
459
-
460
436
  };
461
437
  }
462
-
463
438
  async function retryableRequest(request, requestOptions, isRead = true) {
464
439
  const stackTrace = [];
465
- /**
466
- * First we prepare the payload that do not depend from hosts.
440
+ /**
441
+ * First we prepare the payload that do not depend from hosts.
467
442
  */
468
-
469
443
  const data = serializeData(request, requestOptions);
470
- const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers); // On `GET`, the data is proxied to query parameters.
471
-
472
- const dataQueryParameters = request.method === 'GET' ? { ...request.data,
444
+ const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
445
+ // On `GET`, the data is proxied to query parameters.
446
+ const dataQueryParameters = request.method === 'GET' ? {
447
+ ...request.data,
473
448
  ...requestOptions.data
474
449
  } : {};
475
450
  const queryParameters = {
476
- 'x-algolia-agent': algoliaAgent.value,
477
451
  ...baseQueryParameters,
478
452
  ...request.queryParameters,
479
453
  ...dataQueryParameters
480
454
  };
481
-
455
+ if (algoliaAgent.value) {
456
+ queryParameters['x-algolia-agent'] = algoliaAgent.value;
457
+ }
482
458
  if (requestOptions && requestOptions.queryParameters) {
483
459
  for (const key of Object.keys(requestOptions.queryParameters)) {
484
460
  // We want to keep `undefined` and `null` values,
@@ -491,25 +467,19 @@ function createTransporter({
491
467
  }
492
468
  }
493
469
  }
494
-
495
470
  let timeoutsCount = 0;
496
-
497
471
  const retry = async (retryableHosts, getTimeout) => {
498
- /**
499
- * We iterate on each host, until there is no host left.
472
+ /**
473
+ * We iterate on each host, until there is no host left.
500
474
  */
501
475
  const host = retryableHosts.pop();
502
-
503
476
  if (host === undefined) {
504
477
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
505
478
  }
506
-
507
479
  let responseTimeout = requestOptions.timeout;
508
-
509
480
  if (responseTimeout === undefined) {
510
481
  responseTimeout = isRead ? timeouts.read : timeouts.write;
511
482
  }
512
-
513
483
  const payload = {
514
484
  data,
515
485
  headers,
@@ -518,12 +488,11 @@ function createTransporter({
518
488
  connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
519
489
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
520
490
  };
521
- /**
522
- * The stackFrame is pushed to the stackTrace so we
523
- * can have information about onRetry and onFailure
524
- * decisions.
491
+ /**
492
+ * The stackFrame is pushed to the stackTrace so we
493
+ * can have information about onRetry and onFailure
494
+ * decisions.
525
495
  */
526
-
527
496
  const pushToStackTrace = response => {
528
497
  const stackFrame = {
529
498
  request: payload,
@@ -534,102 +503,85 @@ function createTransporter({
534
503
  stackTrace.push(stackFrame);
535
504
  return stackFrame;
536
505
  };
537
-
538
506
  const response = await requester.send(payload);
539
-
540
507
  if (isRetryable(response)) {
541
- const stackFrame = pushToStackTrace(response); // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
542
-
508
+ const stackFrame = pushToStackTrace(response);
509
+ // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
543
510
  if (response.isTimedOut) {
544
511
  timeoutsCount++;
545
512
  }
546
- /**
547
- * Failures are individually sent to the logger, allowing
548
- * the end user to debug / store stack frames even
549
- * when a retry error does not happen.
513
+ /**
514
+ * Failures are individually sent to the logger, allowing
515
+ * the end user to debug / store stack frames even
516
+ * when a retry error does not happen.
550
517
  */
551
518
  // eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
552
-
553
-
554
519
  console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
555
- /**
556
- * We also store the state of the host in failure cases. If the host, is
557
- * down it will remain down for the next 2 minutes. In a timeout situation,
558
- * this host will be added end of the list of hosts on the next request.
520
+ /**
521
+ * We also store the state of the host in failure cases. If the host, is
522
+ * down it will remain down for the next 2 minutes. In a timeout situation,
523
+ * this host will be added end of the list of hosts on the next request.
559
524
  */
560
-
561
525
  await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
562
526
  return retry(retryableHosts, getTimeout);
563
527
  }
564
-
565
528
  if (isSuccess(response)) {
566
529
  return deserializeSuccess(response);
567
530
  }
568
-
569
531
  pushToStackTrace(response);
570
532
  throw deserializeFailure(response, stackTrace);
571
533
  };
572
- /**
573
- * Finally, for each retryable host perform request until we got a non
574
- * retryable response. Some notes here:
575
- *
576
- * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
577
- * 2. We also get from the retryable options a timeout multiplier that is tailored
578
- * for the current context.
534
+ /**
535
+ * Finally, for each retryable host perform request until we got a non
536
+ * retryable response. Some notes here:
537
+ *
538
+ * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
539
+ * 2. We also get from the retryable options a timeout multiplier that is tailored
540
+ * for the current context.
579
541
  */
580
-
581
-
582
542
  const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
583
543
  const options = await createRetryableOptions(compatibleHosts);
584
544
  return retry([...options.hosts].reverse(), options.getTimeout);
585
545
  }
586
-
587
546
  function createRequest(request, requestOptions = {}) {
588
- /**
589
- * A read request is either a `GET` request, or a request that we make
590
- * via the `read` transporter (e.g. `search`).
547
+ /**
548
+ * A read request is either a `GET` request, or a request that we make
549
+ * via the `read` transporter (e.g. `search`).
591
550
  */
592
551
  const isRead = request.useReadTransporter || request.method === 'GET';
593
-
594
552
  if (!isRead) {
595
- /**
596
- * On write requests, no cache mechanisms are applied, and we
597
- * proxy the request immediately to the requester.
553
+ /**
554
+ * On write requests, no cache mechanisms are applied, and we
555
+ * proxy the request immediately to the requester.
598
556
  */
599
557
  return retryableRequest(request, requestOptions, isRead);
600
558
  }
601
-
602
559
  const createRetryableRequest = () => {
603
- /**
604
- * Then, we prepare a function factory that contains the construction of
605
- * the retryable request. At this point, we may *not* perform the actual
606
- * request. But we want to have the function factory ready.
560
+ /**
561
+ * Then, we prepare a function factory that contains the construction of
562
+ * the retryable request. At this point, we may *not* perform the actual
563
+ * request. But we want to have the function factory ready.
607
564
  */
608
565
  return retryableRequest(request, requestOptions);
609
566
  };
610
- /**
611
- * Once we have the function factory ready, we need to determine of the
612
- * request is "cacheable" - should be cached. Note that, once again,
613
- * the user can force this option.
567
+ /**
568
+ * Once we have the function factory ready, we need to determine of the
569
+ * request is "cacheable" - should be cached. Note that, once again,
570
+ * the user can force this option.
614
571
  */
615
-
616
-
617
572
  const cacheable = requestOptions.cacheable || request.cacheable;
618
- /**
619
- * If is not "cacheable", we immediately trigger the retryable request, no
620
- * need to check cache implementations.
573
+ /**
574
+ * If is not "cacheable", we immediately trigger the retryable request, no
575
+ * need to check cache implementations.
621
576
  */
622
-
623
577
  if (cacheable !== true) {
624
578
  return createRetryableRequest();
625
579
  }
626
- /**
627
- * If the request is "cacheable", we need to first compute the key to ask
628
- * the cache implementations if this request is on progress or if the
629
- * response already exists on the cache.
580
+ /**
581
+ * If the request is "cacheable", we need to first compute the key to ask
582
+ * the cache implementations if this request is on progress or if the
583
+ * response already exists on the cache.
630
584
  */
631
-
632
-
633
585
  const key = {
634
586
  request,
635
587
  requestOptions,
@@ -638,33 +590,31 @@ function createTransporter({
638
590
  headers: baseHeaders
639
591
  }
640
592
  };
641
- /**
642
- * With the computed key, we first ask the responses cache
643
- * implementation if this request was been resolved before.
593
+ /**
594
+ * With the computed key, we first ask the responses cache
595
+ * implementation if this request was been resolved before.
644
596
  */
645
-
646
597
  return responsesCache.get(key, () => {
647
- /**
648
- * If the request has never resolved before, we actually ask if there
649
- * is a current request with the same key on progress.
598
+ /**
599
+ * If the request has never resolved before, we actually ask if there
600
+ * is a current request with the same key on progress.
650
601
  */
651
602
  return requestsCache.get(key, () =>
652
- /**
653
- * Finally, if there is no request in progress with the same key,
654
- * this `createRetryableRequest()` will actually trigger the
655
- * retryable request.
603
+ /**
604
+ * Finally, if there is no request in progress with the same key,
605
+ * this `createRetryableRequest()` will actually trigger the
606
+ * retryable request.
656
607
  */
657
608
  requestsCache.set(key, createRetryableRequest()).then(response => Promise.all([requestsCache.delete(key), response]), err => Promise.all([requestsCache.delete(key), Promise.reject(err)])).then(([_, response]) => response));
658
609
  }, {
659
- /**
660
- * Of course, once we get this response back from the server, we
661
- * tell response cache to actually store the received response
662
- * to be used later.
610
+ /**
611
+ * Of course, once we get this response back from the server, we
612
+ * tell response cache to actually store the received response
613
+ * to be used later.
663
614
  */
664
615
  miss: response => responsesCache.set(key, response)
665
616
  });
666
617
  }
667
-
668
618
  return {
669
619
  hostsCache,
670
620
  requester,
@@ -682,17 +632,13 @@ function createTransporter({
682
632
  function createAlgoliaAgent(version) {
683
633
  const algoliaAgent = {
684
634
  value: `Algolia for JavaScript (${version})`,
685
-
686
635
  add(options) {
687
636
  const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;
688
-
689
637
  if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {
690
638
  algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;
691
639
  }
692
-
693
640
  return algoliaAgent;
694
641
  }
695
-
696
642
  };
697
643
  return algoliaAgent;
698
644
  }
@@ -714,2055 +660,2067 @@ const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;
714
660
  const DEFAULT_READ_TIMEOUT_BROWSER = 2000;
715
661
  const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
716
662
 
717
- function createXhrRequester() {
718
- function send(request) {
719
- return new Promise((resolve) => {
720
- const baseRequester = new XMLHttpRequest();
721
- baseRequester.open(request.method, request.url, true);
722
- Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));
723
- const createTimeout = (timeout, content) => {
724
- return setTimeout(() => {
725
- baseRequester.abort();
726
- resolve({
727
- status: 0,
728
- content,
729
- isTimedOut: true,
730
- });
731
- }, timeout);
732
- };
733
- const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
734
- let responseTimeout;
735
- baseRequester.onreadystatechange = () => {
736
- if (baseRequester.readyState > baseRequester.OPENED &&
737
- responseTimeout === undefined) {
738
- clearTimeout(connectTimeout);
739
- responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
740
- }
741
- };
742
- baseRequester.onerror = () => {
743
- // istanbul ignore next
744
- if (baseRequester.status === 0) {
745
- clearTimeout(connectTimeout);
746
- clearTimeout(responseTimeout);
747
- resolve({
748
- content: baseRequester.responseText || 'Network request failed',
749
- status: baseRequester.status,
750
- isTimedOut: false,
751
- });
752
- }
753
- };
754
- baseRequester.onload = () => {
755
- clearTimeout(connectTimeout);
756
- clearTimeout(responseTimeout);
757
- resolve({
758
- content: baseRequester.responseText,
759
- status: baseRequester.status,
760
- isTimedOut: false,
761
- });
762
- };
763
- baseRequester.send(request.data);
764
- });
765
- }
766
- return { send };
663
+ function createXhrRequester() {
664
+ function send(request) {
665
+ return new Promise((resolve) => {
666
+ const baseRequester = new XMLHttpRequest();
667
+ baseRequester.open(request.method, request.url, true);
668
+ Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));
669
+ const createTimeout = (timeout, content) => {
670
+ return setTimeout(() => {
671
+ baseRequester.abort();
672
+ resolve({
673
+ status: 0,
674
+ content,
675
+ isTimedOut: true,
676
+ });
677
+ }, timeout);
678
+ };
679
+ const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
680
+ let responseTimeout;
681
+ baseRequester.onreadystatechange = () => {
682
+ if (baseRequester.readyState > baseRequester.OPENED &&
683
+ responseTimeout === undefined) {
684
+ clearTimeout(connectTimeout);
685
+ responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
686
+ }
687
+ };
688
+ baseRequester.onerror = () => {
689
+ // istanbul ignore next
690
+ if (baseRequester.status === 0) {
691
+ clearTimeout(connectTimeout);
692
+ clearTimeout(responseTimeout);
693
+ resolve({
694
+ content: baseRequester.responseText || 'Network request failed',
695
+ status: baseRequester.status,
696
+ isTimedOut: false,
697
+ });
698
+ }
699
+ };
700
+ baseRequester.onload = () => {
701
+ clearTimeout(connectTimeout);
702
+ clearTimeout(responseTimeout);
703
+ resolve({
704
+ content: baseRequester.responseText,
705
+ status: baseRequester.status,
706
+ isTimedOut: false,
707
+ });
708
+ };
709
+ baseRequester.send(request.data);
710
+ });
711
+ }
712
+ return { send };
767
713
  }
768
714
 
769
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
770
- const apiClientVersion = '5.0.0-alpha.8';
771
- function getDefaultHosts(appId) {
772
- return [
773
- {
774
- url: `${appId}-dsn.algolia.net`,
775
- accept: 'read',
776
- protocol: 'https',
777
- },
778
- {
779
- url: `${appId}.algolia.net`,
780
- accept: 'write',
781
- protocol: 'https',
782
- },
783
- ].concat(shuffle([
784
- {
785
- url: `${appId}-1.algolianet.com`,
786
- accept: 'readWrite',
787
- protocol: 'https',
788
- },
789
- {
790
- url: `${appId}-2.algolianet.com`,
791
- accept: 'readWrite',
792
- protocol: 'https',
793
- },
794
- {
795
- url: `${appId}-3.algolianet.com`,
796
- accept: 'readWrite',
797
- protocol: 'https',
798
- },
799
- ]));
800
- }
801
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
802
- function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
803
- const auth = createAuth(appIdOption, apiKeyOption, authMode);
804
- const transporter = createTransporter({
805
- hosts: getDefaultHosts(appIdOption),
806
- ...options,
807
- algoliaAgent: getAlgoliaAgent({
808
- algoliaAgents,
809
- client: 'Search',
810
- version: apiClientVersion,
811
- }),
812
- baseHeaders: {
813
- 'content-type': 'text/plain',
814
- ...auth.headers(),
815
- ...options.baseHeaders,
816
- },
817
- baseQueryParameters: {
818
- ...auth.queryParameters(),
819
- ...options.baseQueryParameters,
820
- },
821
- });
822
- return {
823
- transporter,
824
- /**
825
- * The `appId` currently in use.
826
- */
827
- appId: appIdOption,
828
- /**
829
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
830
- */
831
- clearCache() {
832
- return Promise.all([
833
- transporter.requestsCache.clear(),
834
- transporter.responsesCache.clear(),
835
- ]).then(() => undefined);
836
- },
837
- /**
838
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
839
- */
840
- get _ua() {
841
- return transporter.algoliaAgent.value;
842
- },
843
- /**
844
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
845
- *
846
- * @param segment - The algolia agent (user-agent) segment to add.
847
- * @param version - The version of the agent.
848
- */
849
- addAlgoliaAgent(segment, version) {
850
- transporter.algoliaAgent.add({ segment, version });
851
- },
852
- /**
853
- * Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
854
- *
855
- * @summary Helper method that waits for a task to be published (completed).
856
- * @param waitForTaskOptions - The waitForTaskOptions object.
857
- * @param waitForTaskOptions.indexName - The `indexName` where the operation was performed.
858
- * @param waitForTaskOptions.taskID - The `taskID` returned in the method response.
859
- * @param waitForTaskOptions.maxRetries - The maximum number of retries. 50 by default.
860
- * @param waitForTaskOptions.timeout - The function to decide how long to wait between retries.
861
- * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
862
- */
863
- waitForTask({ indexName, taskID, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
864
- let retryCount = 0;
865
- return createIterablePromise({
866
- func: () => this.getTask({ indexName, taskID }, requestOptions),
867
- validate: (response) => response.status === 'published',
868
- aggregator: () => (retryCount += 1),
869
- error: {
870
- validate: () => retryCount >= maxRetries,
871
- message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
872
- },
873
- timeout: () => timeout(retryCount),
874
- });
875
- },
876
- /**
877
- * Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
878
- *
879
- * @summary Helper method that waits for an API key task to be processed.
880
- * @param waitForApiKeyOptions - The waitForApiKeyOptions object.
881
- * @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`.
882
- * @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated.
883
- * @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it.
884
- * @param waitForApiKeyOptions.maxRetries - The maximum number of retries. 50 by default.
885
- * @param waitForApiKeyOptions.timeout - The function to decide how long to wait between retries.
886
- * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
887
- */
888
- waitForApiKey({ operation, key, apiKey, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
889
- let retryCount = 0;
890
- const baseIteratorOptions = {
891
- aggregator: () => (retryCount += 1),
892
- error: {
893
- validate: () => retryCount >= maxRetries,
894
- message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
895
- },
896
- timeout: () => timeout(retryCount),
897
- };
898
- if (operation === 'update') {
899
- if (!apiKey) {
900
- throw new Error('`apiKey` is required when waiting for an `update` operation.');
901
- }
902
- return createIterablePromise({
903
- ...baseIteratorOptions,
904
- func: () => this.getApiKey({ key }, requestOptions),
905
- validate: (response) => {
906
- for (const field of Object.keys(apiKey)) {
907
- if (Array.isArray(apiKey[field])) {
908
- if (apiKey[field].length !== response[field].length ||
909
- apiKey[field].some((value, index) => value !== response[field][index])) {
910
- return false;
911
- }
912
- }
913
- else if (response[field] !== apiKey[field]) {
914
- return false;
915
- }
916
- }
917
- return true;
918
- },
919
- });
920
- }
921
- return createIterablePromise({
922
- ...baseIteratorOptions,
923
- func: () => this.getApiKey({ key }, requestOptions).catch((error) => error),
924
- validate: (error) => operation === 'add' ? error.status !== 404 : error.status === 404,
925
- });
926
- },
927
- /**
928
- * Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
929
- *
930
- * @summary Helper method that iterates on the `browse` method.
931
- * @param browseObjects - The browseObjects object.
932
- * @param browseObjects.indexName - The index in which to perform the request.
933
- * @param browseObjects.browseParams - The `browse` parameters.
934
- * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is no `cursor` in the response.
935
- * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
936
- * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `browse` method and merged with the transporter requestOptions.
937
- */
938
- browseObjects({ indexName, browseParams, ...browseObjectsOptions }, requestOptions) {
939
- return createIterablePromise({
940
- func: (previousResponse) => {
941
- return this.browse({
942
- indexName,
943
- browseParams: {
944
- cursor: previousResponse ? previousResponse.cursor : undefined,
945
- ...browseParams,
946
- },
947
- }, requestOptions);
948
- },
949
- validate: (response) => response.cursor === undefined,
950
- ...browseObjectsOptions,
951
- });
952
- },
953
- /**
954
- * Helper: Iterate on the `searchRules` method of the client to allow aggregating rules of an index.
955
- *
956
- * @summary Helper method that iterates on the `searchRules` method.
957
- * @param browseObjects - The browseObjects object.
958
- * @param browseObjects.indexName - The index in which to perform the request.
959
- * @param browseObjects.searchRulesParams - The `searchRules` method parameters.
960
- * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
961
- * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
962
- * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchRules` method and merged with the transporter requestOptions.
963
- */
964
- browseRules({ indexName, searchRulesParams, ...browseRulesOptions }, requestOptions) {
965
- const params = {
966
- hitsPerPage: 1000,
967
- ...searchRulesParams,
968
- };
969
- return createIterablePromise({
970
- func: (previousResponse) => {
971
- return this.searchRules({
972
- indexName,
973
- searchRulesParams: {
974
- ...params,
975
- page: previousResponse
976
- ? previousResponse.page + 1
977
- : params.page || 0,
978
- },
979
- }, requestOptions);
980
- },
981
- validate: (response) => response.nbHits < params.hitsPerPage,
982
- ...browseRulesOptions,
983
- });
984
- },
985
- /**
986
- * Helper: Iterate on the `searchSynonyms` method of the client to allow aggregating rules of an index.
987
- *
988
- * @summary Helper method that iterates on the `searchSynonyms` method.
989
- * @param browseObjects - The browseObjects object.
990
- * @param browseObjects.indexName - The index in which to perform the request.
991
- * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
992
- * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
993
- * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions.
994
- */
995
- browseSynonyms({ indexName, validate, aggregator, ...browseSynonymsOptions }, requestOptions) {
996
- const params = {
997
- hitsPerPage: 1000,
998
- ...browseSynonymsOptions,
999
- };
1000
- return createIterablePromise({
1001
- func: (previousResponse) => {
1002
- return this.searchSynonyms({
1003
- ...params,
1004
- indexName,
1005
- page: previousResponse
1006
- ? previousResponse.page + 1
1007
- : browseSynonymsOptions.page || 0,
1008
- }, requestOptions);
1009
- },
1010
- validate: (response) => response.nbHits < params.hitsPerPage,
1011
- ...browseSynonymsOptions,
1012
- });
1013
- },
1014
- /**
1015
- * Add a new API Key with specific permissions/restrictions.
1016
- *
1017
- * @summary Create an API key.
1018
- * @param apiKey - The apiKey object.
1019
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1020
- */
1021
- addApiKey(apiKey, requestOptions) {
1022
- if (!apiKey) {
1023
- throw new Error('Parameter `apiKey` is required when calling `addApiKey`.');
1024
- }
1025
- if (!apiKey.acl) {
1026
- throw new Error('Parameter `apiKey.acl` is required when calling `addApiKey`.');
1027
- }
1028
- const requestPath = '/1/keys';
1029
- const headers = {};
1030
- const queryParameters = {};
1031
- const request = {
1032
- method: 'POST',
1033
- path: requestPath,
1034
- queryParameters,
1035
- headers,
1036
- data: apiKey,
1037
- };
1038
- return transporter.request(request, requestOptions);
1039
- },
1040
- /**
1041
- * Add or replace an object with a given object ID. If the object does not exist, it will be created. If it already exists, it will be replaced.
1042
- *
1043
- * @summary Add or replace an object.
1044
- * @param addOrUpdateObject - The addOrUpdateObject object.
1045
- * @param addOrUpdateObject.indexName - The index in which to perform the request.
1046
- * @param addOrUpdateObject.objectID - Unique identifier of an object.
1047
- * @param addOrUpdateObject.body - The Algolia object.
1048
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1049
- */
1050
- addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
1051
- if (!indexName) {
1052
- throw new Error('Parameter `indexName` is required when calling `addOrUpdateObject`.');
1053
- }
1054
- if (!objectID) {
1055
- throw new Error('Parameter `objectID` is required when calling `addOrUpdateObject`.');
1056
- }
1057
- if (!body) {
1058
- throw new Error('Parameter `body` is required when calling `addOrUpdateObject`.');
1059
- }
1060
- const requestPath = '/1/indexes/{indexName}/{objectID}'
1061
- .replace('{indexName}', encodeURIComponent(indexName))
1062
- .replace('{objectID}', encodeURIComponent(objectID));
1063
- const headers = {};
1064
- const queryParameters = {};
1065
- const request = {
1066
- method: 'PUT',
1067
- path: requestPath,
1068
- queryParameters,
1069
- headers,
1070
- data: body,
1071
- };
1072
- return transporter.request(request, requestOptions);
1073
- },
1074
- /**
1075
- * Add a single source to the list of allowed sources.
1076
- *
1077
- * @summary Add a single source.
1078
- * @param source - The source to add.
1079
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1080
- */
1081
- appendSource(source, requestOptions) {
1082
- if (!source) {
1083
- throw new Error('Parameter `source` is required when calling `appendSource`.');
1084
- }
1085
- const requestPath = '/1/security/sources/append';
1086
- const headers = {};
1087
- const queryParameters = {};
1088
- const request = {
1089
- method: 'POST',
1090
- path: requestPath,
1091
- queryParameters,
1092
- headers,
1093
- data: source,
1094
- };
1095
- return transporter.request(request, requestOptions);
1096
- },
1097
- /**
1098
- * Assign or Move a userID to a cluster. The time it takes to migrate (move) a user is proportional to the amount of data linked to the userID. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userID is directly usable.
1099
- *
1100
- * @summary Assign or Move userID.
1101
- * @param assignUserId - The assignUserId object.
1102
- * @param assignUserId.xAlgoliaUserID - UserID to assign.
1103
- * @param assignUserId.assignUserIdParams - The assignUserIdParams object.
1104
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1105
- */
1106
- assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
1107
- if (!xAlgoliaUserID) {
1108
- throw new Error('Parameter `xAlgoliaUserID` is required when calling `assignUserId`.');
1109
- }
1110
- if (!assignUserIdParams) {
1111
- throw new Error('Parameter `assignUserIdParams` is required when calling `assignUserId`.');
1112
- }
1113
- if (!assignUserIdParams.cluster) {
1114
- throw new Error('Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.');
1115
- }
1116
- const requestPath = '/1/clusters/mapping';
1117
- const headers = {};
1118
- const queryParameters = {};
1119
- if (xAlgoliaUserID !== undefined) {
1120
- headers['X-Algolia-User-ID'] = xAlgoliaUserID.toString();
1121
- }
1122
- const request = {
1123
- method: 'POST',
1124
- path: requestPath,
1125
- queryParameters,
1126
- headers,
1127
- data: assignUserIdParams,
1128
- };
1129
- return transporter.request(request, requestOptions);
1130
- },
1131
- /**
1132
- * Perform multiple write operations targeting one index, in a single API call.
1133
- *
1134
- * @summary Batch operations to one index.
1135
- * @param batch - The batch object.
1136
- * @param batch.indexName - The index in which to perform the request.
1137
- * @param batch.batchWriteParams - The batchWriteParams object.
1138
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1139
- */
1140
- batch({ indexName, batchWriteParams }, requestOptions) {
1141
- if (!indexName) {
1142
- throw new Error('Parameter `indexName` is required when calling `batch`.');
1143
- }
1144
- if (!batchWriteParams) {
1145
- throw new Error('Parameter `batchWriteParams` is required when calling `batch`.');
1146
- }
1147
- if (!batchWriteParams.requests) {
1148
- throw new Error('Parameter `batchWriteParams.requests` is required when calling `batch`.');
1149
- }
1150
- const requestPath = '/1/indexes/{indexName}/batch'.replace('{indexName}', encodeURIComponent(indexName));
1151
- const headers = {};
1152
- const queryParameters = {};
1153
- const request = {
1154
- method: 'POST',
1155
- path: requestPath,
1156
- queryParameters,
1157
- headers,
1158
- data: batchWriteParams,
1159
- };
1160
- return transporter.request(request, requestOptions);
1161
- },
1162
- /**
1163
- * Assign multiple userIDs to a cluster. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable.
1164
- *
1165
- * @summary Batch assign userIDs.
1166
- * @param batchAssignUserIds - The batchAssignUserIds object.
1167
- * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign.
1168
- * @param batchAssignUserIds.batchAssignUserIdsParams - The batchAssignUserIdsParams object.
1169
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1170
- */
1171
- batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
1172
- if (!xAlgoliaUserID) {
1173
- throw new Error('Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.');
1174
- }
1175
- if (!batchAssignUserIdsParams) {
1176
- throw new Error('Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.');
1177
- }
1178
- if (!batchAssignUserIdsParams.cluster) {
1179
- throw new Error('Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.');
1180
- }
1181
- if (!batchAssignUserIdsParams.users) {
1182
- throw new Error('Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.');
1183
- }
1184
- const requestPath = '/1/clusters/mapping/batch';
1185
- const headers = {};
1186
- const queryParameters = {};
1187
- if (xAlgoliaUserID !== undefined) {
1188
- headers['X-Algolia-User-ID'] = xAlgoliaUserID.toString();
1189
- }
1190
- const request = {
1191
- method: 'POST',
1192
- path: requestPath,
1193
- queryParameters,
1194
- headers,
1195
- data: batchAssignUserIdsParams,
1196
- };
1197
- return transporter.request(request, requestOptions);
1198
- },
1199
- /**
1200
- * Send a batch of dictionary entries.
1201
- *
1202
- * @summary Batch dictionary entries.
1203
- * @param batchDictionaryEntries - The batchDictionaryEntries object.
1204
- * @param batchDictionaryEntries.dictionaryName - The dictionary to search in.
1205
- * @param batchDictionaryEntries.batchDictionaryEntriesParams - The batchDictionaryEntriesParams object.
1206
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1207
- */
1208
- batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams, }, requestOptions) {
1209
- if (!dictionaryName) {
1210
- throw new Error('Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.');
1211
- }
1212
- if (!batchDictionaryEntriesParams) {
1213
- throw new Error('Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.');
1214
- }
1215
- if (!batchDictionaryEntriesParams.requests) {
1216
- throw new Error('Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.');
1217
- }
1218
- const requestPath = '/1/dictionaries/{dictionaryName}/batch'.replace('{dictionaryName}', encodeURIComponent(dictionaryName));
1219
- const headers = {};
1220
- const queryParameters = {};
1221
- const request = {
1222
- method: 'POST',
1223
- path: requestPath,
1224
- queryParameters,
1225
- headers,
1226
- data: batchDictionaryEntriesParams,
1227
- };
1228
- return transporter.request(request, requestOptions);
1229
- },
1230
- /**
1231
- * This method allows you to retrieve all index content. It can retrieve up to 1,000 records per call and supports full text search and filters. For performance reasons, some features are not supported, including `distinct`, sorting by `typos`, `words` or `geo distance`. When there is more content to be browsed, the response contains a cursor field. This cursor has to be passed to the subsequent call to browse in order to get the next page of results. When the end of the index has been reached, the cursor field is absent from the response.
1232
- *
1233
- * @summary Retrieve all index content.
1234
- * @param browse - The browse object.
1235
- * @param browse.indexName - The index in which to perform the request.
1236
- * @param browse.browseParams - The browseParams object.
1237
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1238
- */
1239
- browse({ indexName, browseParams }, requestOptions) {
1240
- if (!indexName) {
1241
- throw new Error('Parameter `indexName` is required when calling `browse`.');
1242
- }
1243
- const requestPath = '/1/indexes/{indexName}/browse'.replace('{indexName}', encodeURIComponent(indexName));
1244
- const headers = {};
1245
- const queryParameters = {};
1246
- const request = {
1247
- method: 'POST',
1248
- path: requestPath,
1249
- queryParameters,
1250
- headers,
1251
- data: browseParams ? browseParams : {},
1252
- };
1253
- return transporter.request(request, requestOptions);
1254
- },
1255
- /**
1256
- * Remove all synonyms from an index.
1257
- *
1258
- * @summary Clear all synonyms.
1259
- * @param clearAllSynonyms - The clearAllSynonyms object.
1260
- * @param clearAllSynonyms.indexName - The index in which to perform the request.
1261
- * @param clearAllSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
1262
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1263
- */
1264
- clearAllSynonyms({ indexName, forwardToReplicas }, requestOptions) {
1265
- if (!indexName) {
1266
- throw new Error('Parameter `indexName` is required when calling `clearAllSynonyms`.');
1267
- }
1268
- const requestPath = '/1/indexes/{indexName}/synonyms/clear'.replace('{indexName}', encodeURIComponent(indexName));
1269
- const headers = {};
1270
- const queryParameters = {};
1271
- if (forwardToReplicas !== undefined) {
1272
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
1273
- }
1274
- const request = {
1275
- method: 'POST',
1276
- path: requestPath,
1277
- queryParameters,
1278
- headers,
1279
- };
1280
- return transporter.request(request, requestOptions);
1281
- },
1282
- /**
1283
- * Delete an index\'s content, but leave settings and index-specific API keys untouched.
1284
- *
1285
- * @summary Clear all objects from an index.
1286
- * @param clearObjects - The clearObjects object.
1287
- * @param clearObjects.indexName - The index in which to perform the request.
1288
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1289
- */
1290
- clearObjects({ indexName }, requestOptions) {
1291
- if (!indexName) {
1292
- throw new Error('Parameter `indexName` is required when calling `clearObjects`.');
1293
- }
1294
- const requestPath = '/1/indexes/{indexName}/clear'.replace('{indexName}', encodeURIComponent(indexName));
1295
- const headers = {};
1296
- const queryParameters = {};
1297
- const request = {
1298
- method: 'POST',
1299
- path: requestPath,
1300
- queryParameters,
1301
- headers,
1302
- };
1303
- return transporter.request(request, requestOptions);
1304
- },
1305
- /**
1306
- * Delete all Rules in the index.
1307
- *
1308
- * @summary Clear Rules.
1309
- * @param clearRules - The clearRules object.
1310
- * @param clearRules.indexName - The index in which to perform the request.
1311
- * @param clearRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
1312
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1313
- */
1314
- clearRules({ indexName, forwardToReplicas }, requestOptions) {
1315
- if (!indexName) {
1316
- throw new Error('Parameter `indexName` is required when calling `clearRules`.');
1317
- }
1318
- const requestPath = '/1/indexes/{indexName}/rules/clear'.replace('{indexName}', encodeURIComponent(indexName));
1319
- const headers = {};
1320
- const queryParameters = {};
1321
- if (forwardToReplicas !== undefined) {
1322
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
1323
- }
1324
- const request = {
1325
- method: 'POST',
1326
- path: requestPath,
1327
- queryParameters,
1328
- headers,
1329
- };
1330
- return transporter.request(request, requestOptions);
1331
- },
1332
- /**
1333
- * This method allow you to send requests to the Algolia REST API.
1334
- *
1335
- * @summary Send requests to the Algolia REST API.
1336
- * @param del - The del object.
1337
- * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
1338
- * @param del.parameters - Query parameters to be applied to the current query.
1339
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1340
- */
1341
- del({ path, parameters }, requestOptions) {
1342
- if (!path) {
1343
- throw new Error('Parameter `path` is required when calling `del`.');
1344
- }
1345
- const requestPath = '/1{path}'.replace('{path}', path);
1346
- const headers = {};
1347
- const queryParameters = parameters ? parameters : {};
1348
- const request = {
1349
- method: 'DELETE',
1350
- path: requestPath,
1351
- queryParameters,
1352
- headers,
1353
- };
1354
- return transporter.request(request, requestOptions);
1355
- },
1356
- /**
1357
- * Delete an existing API Key.
1358
- *
1359
- * @summary Delete an API key.
1360
- * @param deleteApiKey - The deleteApiKey object.
1361
- * @param deleteApiKey.key - API Key string.
1362
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1363
- */
1364
- deleteApiKey({ key }, requestOptions) {
1365
- if (!key) {
1366
- throw new Error('Parameter `key` is required when calling `deleteApiKey`.');
1367
- }
1368
- const requestPath = '/1/keys/{key}'.replace('{key}', encodeURIComponent(key));
1369
- const headers = {};
1370
- const queryParameters = {};
1371
- const request = {
1372
- method: 'DELETE',
1373
- path: requestPath,
1374
- queryParameters,
1375
- headers,
1376
- };
1377
- return transporter.request(request, requestOptions);
1378
- },
1379
- /**
1380
- * Remove all objects matching a filter (including geo filters). This method enables you to delete one or more objects based on filters (numeric, facet, tag or geo queries). It doesn\'t accept empty filters or a query.
1381
- *
1382
- * @summary Delete all records matching the query.
1383
- * @param deleteBy - The deleteBy object.
1384
- * @param deleteBy.indexName - The index in which to perform the request.
1385
- * @param deleteBy.searchParams - The searchParams object.
1386
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1387
- */
1388
- deleteBy({ indexName, searchParams }, requestOptions) {
1389
- if (!indexName) {
1390
- throw new Error('Parameter `indexName` is required when calling `deleteBy`.');
1391
- }
1392
- if (!searchParams) {
1393
- throw new Error('Parameter `searchParams` is required when calling `deleteBy`.');
1394
- }
1395
- const requestPath = '/1/indexes/{indexName}/deleteByQuery'.replace('{indexName}', encodeURIComponent(indexName));
1396
- const headers = {};
1397
- const queryParameters = {};
1398
- const request = {
1399
- method: 'POST',
1400
- path: requestPath,
1401
- queryParameters,
1402
- headers,
1403
- data: searchParams,
1404
- };
1405
- return transporter.request(request, requestOptions);
1406
- },
1407
- /**
1408
- * Delete an existing index.
1409
- *
1410
- * @summary Delete index.
1411
- * @param deleteIndex - The deleteIndex object.
1412
- * @param deleteIndex.indexName - The index in which to perform the request.
1413
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1414
- */
1415
- deleteIndex({ indexName }, requestOptions) {
1416
- if (!indexName) {
1417
- throw new Error('Parameter `indexName` is required when calling `deleteIndex`.');
1418
- }
1419
- const requestPath = '/1/indexes/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
1420
- const headers = {};
1421
- const queryParameters = {};
1422
- const request = {
1423
- method: 'DELETE',
1424
- path: requestPath,
1425
- queryParameters,
1426
- headers,
1427
- };
1428
- return transporter.request(request, requestOptions);
1429
- },
1430
- /**
1431
- * Delete an existing object.
1432
- *
1433
- * @summary Delete an object.
1434
- * @param deleteObject - The deleteObject object.
1435
- * @param deleteObject.indexName - The index in which to perform the request.
1436
- * @param deleteObject.objectID - Unique identifier of an object.
1437
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1438
- */
1439
- deleteObject({ indexName, objectID }, requestOptions) {
1440
- if (!indexName) {
1441
- throw new Error('Parameter `indexName` is required when calling `deleteObject`.');
1442
- }
1443
- if (!objectID) {
1444
- throw new Error('Parameter `objectID` is required when calling `deleteObject`.');
1445
- }
1446
- const requestPath = '/1/indexes/{indexName}/{objectID}'
1447
- .replace('{indexName}', encodeURIComponent(indexName))
1448
- .replace('{objectID}', encodeURIComponent(objectID));
1449
- const headers = {};
1450
- const queryParameters = {};
1451
- const request = {
1452
- method: 'DELETE',
1453
- path: requestPath,
1454
- queryParameters,
1455
- headers,
1456
- };
1457
- return transporter.request(request, requestOptions);
1458
- },
1459
- /**
1460
- * Delete the Rule with the specified objectID.
1461
- *
1462
- * @summary Delete a rule.
1463
- * @param deleteRule - The deleteRule object.
1464
- * @param deleteRule.indexName - The index in which to perform the request.
1465
- * @param deleteRule.objectID - Unique identifier of an object.
1466
- * @param deleteRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
1467
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1468
- */
1469
- deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
1470
- if (!indexName) {
1471
- throw new Error('Parameter `indexName` is required when calling `deleteRule`.');
1472
- }
1473
- if (!objectID) {
1474
- throw new Error('Parameter `objectID` is required when calling `deleteRule`.');
1475
- }
1476
- const requestPath = '/1/indexes/{indexName}/rules/{objectID}'
1477
- .replace('{indexName}', encodeURIComponent(indexName))
1478
- .replace('{objectID}', encodeURIComponent(objectID));
1479
- const headers = {};
1480
- const queryParameters = {};
1481
- if (forwardToReplicas !== undefined) {
1482
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
1483
- }
1484
- const request = {
1485
- method: 'DELETE',
1486
- path: requestPath,
1487
- queryParameters,
1488
- headers,
1489
- };
1490
- return transporter.request(request, requestOptions);
1491
- },
1492
- /**
1493
- * Remove a single source from the list of allowed sources.
1494
- *
1495
- * @summary Remove a single source.
1496
- * @param deleteSource - The deleteSource object.
1497
- * @param deleteSource.source - The IP range of the source.
1498
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1499
- */
1500
- deleteSource({ source }, requestOptions) {
1501
- if (!source) {
1502
- throw new Error('Parameter `source` is required when calling `deleteSource`.');
1503
- }
1504
- const requestPath = '/1/security/sources/{source}'.replace('{source}', encodeURIComponent(source));
1505
- const headers = {};
1506
- const queryParameters = {};
1507
- const request = {
1508
- method: 'DELETE',
1509
- path: requestPath,
1510
- queryParameters,
1511
- headers,
1512
- };
1513
- return transporter.request(request, requestOptions);
1514
- },
1515
- /**
1516
- * Delete a single synonyms set, identified by the given objectID.
1517
- *
1518
- * @summary Delete synonym.
1519
- * @param deleteSynonym - The deleteSynonym object.
1520
- * @param deleteSynonym.indexName - The index in which to perform the request.
1521
- * @param deleteSynonym.objectID - Unique identifier of an object.
1522
- * @param deleteSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
1523
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1524
- */
1525
- deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
1526
- if (!indexName) {
1527
- throw new Error('Parameter `indexName` is required when calling `deleteSynonym`.');
1528
- }
1529
- if (!objectID) {
1530
- throw new Error('Parameter `objectID` is required when calling `deleteSynonym`.');
1531
- }
1532
- const requestPath = '/1/indexes/{indexName}/synonyms/{objectID}'
1533
- .replace('{indexName}', encodeURIComponent(indexName))
1534
- .replace('{objectID}', encodeURIComponent(objectID));
1535
- const headers = {};
1536
- const queryParameters = {};
1537
- if (forwardToReplicas !== undefined) {
1538
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
1539
- }
1540
- const request = {
1541
- method: 'DELETE',
1542
- path: requestPath,
1543
- queryParameters,
1544
- headers,
1545
- };
1546
- return transporter.request(request, requestOptions);
1547
- },
1548
- /**
1549
- * This method allow you to send requests to the Algolia REST API.
1550
- *
1551
- * @summary Send requests to the Algolia REST API.
1552
- * @param get - The get object.
1553
- * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
1554
- * @param get.parameters - Query parameters to be applied to the current query.
1555
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1556
- */
1557
- get({ path, parameters }, requestOptions) {
1558
- if (!path) {
1559
- throw new Error('Parameter `path` is required when calling `get`.');
1560
- }
1561
- const requestPath = '/1{path}'.replace('{path}', path);
1562
- const headers = {};
1563
- const queryParameters = parameters ? parameters : {};
1564
- const request = {
1565
- method: 'GET',
1566
- path: requestPath,
1567
- queryParameters,
1568
- headers,
1569
- };
1570
- return transporter.request(request, requestOptions);
1571
- },
1572
- /**
1573
- * Get the permissions of an API key.
1574
- *
1575
- * @summary Get an API key.
1576
- * @param getApiKey - The getApiKey object.
1577
- * @param getApiKey.key - API Key string.
1578
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1579
- */
1580
- getApiKey({ key }, requestOptions) {
1581
- if (!key) {
1582
- throw new Error('Parameter `key` is required when calling `getApiKey`.');
1583
- }
1584
- const requestPath = '/1/keys/{key}'.replace('{key}', encodeURIComponent(key));
1585
- const headers = {};
1586
- const queryParameters = {};
1587
- const request = {
1588
- method: 'GET',
1589
- path: requestPath,
1590
- queryParameters,
1591
- headers,
1592
- };
1593
- return transporter.request(request, requestOptions);
1594
- },
1595
- /**
1596
- * List dictionaries supported per language.
1597
- *
1598
- * @summary List available languages.
1599
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1600
- */
1601
- getDictionaryLanguages(requestOptions) {
1602
- const requestPath = '/1/dictionaries/*/languages';
1603
- const headers = {};
1604
- const queryParameters = {};
1605
- const request = {
1606
- method: 'GET',
1607
- path: requestPath,
1608
- queryParameters,
1609
- headers,
1610
- };
1611
- return transporter.request(request, requestOptions);
1612
- },
1613
- /**
1614
- * Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values.
1615
- *
1616
- * @summary Retrieve dictionaries settings.
1617
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1618
- */
1619
- getDictionarySettings(requestOptions) {
1620
- const requestPath = '/1/dictionaries/*/settings';
1621
- const headers = {};
1622
- const queryParameters = {};
1623
- const request = {
1624
- method: 'GET',
1625
- path: requestPath,
1626
- queryParameters,
1627
- headers,
1628
- };
1629
- return transporter.request(request, requestOptions);
1630
- },
1631
- /**
1632
- * Return the latest log entries.
1633
- *
1634
- * @summary Return the latest log entries.
1635
- * @param getLogs - The getLogs object.
1636
- * @param getLogs.offset - First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry.
1637
- * @param getLogs.length - Maximum number of entries to retrieve. The maximum allowed value is 1000.
1638
- * @param getLogs.indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices.
1639
- * @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved.
1640
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1641
- */
1642
- getLogs({ offset, length, indexName, type }, requestOptions) {
1643
- const requestPath = '/1/logs';
1644
- const headers = {};
1645
- const queryParameters = {};
1646
- if (offset !== undefined) {
1647
- queryParameters.offset = offset.toString();
1648
- }
1649
- if (length !== undefined) {
1650
- queryParameters.length = length.toString();
1651
- }
1652
- if (indexName !== undefined) {
1653
- queryParameters.indexName = indexName.toString();
1654
- }
1655
- if (type !== undefined) {
1656
- queryParameters.type = type.toString();
1657
- }
1658
- const request = {
1659
- method: 'GET',
1660
- path: requestPath,
1661
- queryParameters,
1662
- headers,
1663
- };
1664
- return transporter.request(request, requestOptions);
1665
- },
1666
- /**
1667
- * Retrieve one object from the index.
1668
- *
1669
- * @summary Retrieve an object.
1670
- * @param getObject - The getObject object.
1671
- * @param getObject.indexName - The index in which to perform the request.
1672
- * @param getObject.objectID - Unique identifier of an object.
1673
- * @param getObject.attributesToRetrieve - List of attributes to retrieve. If not specified, all retrievable attributes are returned.
1674
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1675
- */
1676
- getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
1677
- if (!indexName) {
1678
- throw new Error('Parameter `indexName` is required when calling `getObject`.');
1679
- }
1680
- if (!objectID) {
1681
- throw new Error('Parameter `objectID` is required when calling `getObject`.');
1682
- }
1683
- const requestPath = '/1/indexes/{indexName}/{objectID}'
1684
- .replace('{indexName}', encodeURIComponent(indexName))
1685
- .replace('{objectID}', encodeURIComponent(objectID));
1686
- const headers = {};
1687
- const queryParameters = {};
1688
- if (attributesToRetrieve !== undefined) {
1689
- queryParameters.attributesToRetrieve = attributesToRetrieve.toString();
1690
- }
1691
- const request = {
1692
- method: 'GET',
1693
- path: requestPath,
1694
- queryParameters,
1695
- headers,
1696
- };
1697
- return transporter.request(request, requestOptions);
1698
- },
1699
- /**
1700
- * Retrieve one or more objects, potentially from different indices, in a single API call.
1701
- *
1702
- * @summary Retrieve one or more objects.
1703
- * @param getObjectsParams - The Algolia object.
1704
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1705
- */
1706
- getObjects(getObjectsParams, requestOptions) {
1707
- if (!getObjectsParams) {
1708
- throw new Error('Parameter `getObjectsParams` is required when calling `getObjects`.');
1709
- }
1710
- if (!getObjectsParams.requests) {
1711
- throw new Error('Parameter `getObjectsParams.requests` is required when calling `getObjects`.');
1712
- }
1713
- const requestPath = '/1/indexes/*/objects';
1714
- const headers = {};
1715
- const queryParameters = {};
1716
- const request = {
1717
- method: 'POST',
1718
- path: requestPath,
1719
- queryParameters,
1720
- headers,
1721
- data: getObjectsParams,
1722
- useReadTransporter: true,
1723
- cacheable: true,
1724
- };
1725
- return transporter.request(request, requestOptions);
1726
- },
1727
- /**
1728
- * Retrieve the Rule with the specified objectID.
1729
- *
1730
- * @summary Get a rule.
1731
- * @param getRule - The getRule object.
1732
- * @param getRule.indexName - The index in which to perform the request.
1733
- * @param getRule.objectID - Unique identifier of an object.
1734
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1735
- */
1736
- getRule({ indexName, objectID }, requestOptions) {
1737
- if (!indexName) {
1738
- throw new Error('Parameter `indexName` is required when calling `getRule`.');
1739
- }
1740
- if (!objectID) {
1741
- throw new Error('Parameter `objectID` is required when calling `getRule`.');
1742
- }
1743
- const requestPath = '/1/indexes/{indexName}/rules/{objectID}'
1744
- .replace('{indexName}', encodeURIComponent(indexName))
1745
- .replace('{objectID}', encodeURIComponent(objectID));
1746
- const headers = {};
1747
- const queryParameters = {};
1748
- const request = {
1749
- method: 'GET',
1750
- path: requestPath,
1751
- queryParameters,
1752
- headers,
1753
- };
1754
- return transporter.request(request, requestOptions);
1755
- },
1756
- /**
1757
- * Retrieve settings of an index.
1758
- *
1759
- * @summary Retrieve settings of an index.
1760
- * @param getSettings - The getSettings object.
1761
- * @param getSettings.indexName - The index in which to perform the request.
1762
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1763
- */
1764
- getSettings({ indexName }, requestOptions) {
1765
- if (!indexName) {
1766
- throw new Error('Parameter `indexName` is required when calling `getSettings`.');
1767
- }
1768
- const requestPath = '/1/indexes/{indexName}/settings'.replace('{indexName}', encodeURIComponent(indexName));
1769
- const headers = {};
1770
- const queryParameters = {};
1771
- const request = {
1772
- method: 'GET',
1773
- path: requestPath,
1774
- queryParameters,
1775
- headers,
1776
- };
1777
- return transporter.request(request, requestOptions);
1778
- },
1779
- /**
1780
- * List all allowed sources.
1781
- *
1782
- * @summary List all allowed sources.
1783
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1784
- */
1785
- getSources(requestOptions) {
1786
- const requestPath = '/1/security/sources';
1787
- const headers = {};
1788
- const queryParameters = {};
1789
- const request = {
1790
- method: 'GET',
1791
- path: requestPath,
1792
- queryParameters,
1793
- headers,
1794
- };
1795
- return transporter.request(request, requestOptions);
1796
- },
1797
- /**
1798
- * Fetch a synonym object identified by its objectID.
1799
- *
1800
- * @summary Get synonym.
1801
- * @param getSynonym - The getSynonym object.
1802
- * @param getSynonym.indexName - The index in which to perform the request.
1803
- * @param getSynonym.objectID - Unique identifier of an object.
1804
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1805
- */
1806
- getSynonym({ indexName, objectID }, requestOptions) {
1807
- if (!indexName) {
1808
- throw new Error('Parameter `indexName` is required when calling `getSynonym`.');
1809
- }
1810
- if (!objectID) {
1811
- throw new Error('Parameter `objectID` is required when calling `getSynonym`.');
1812
- }
1813
- const requestPath = '/1/indexes/{indexName}/synonyms/{objectID}'
1814
- .replace('{indexName}', encodeURIComponent(indexName))
1815
- .replace('{objectID}', encodeURIComponent(objectID));
1816
- const headers = {};
1817
- const queryParameters = {};
1818
- const request = {
1819
- method: 'GET',
1820
- path: requestPath,
1821
- queryParameters,
1822
- headers,
1823
- };
1824
- return transporter.request(request, requestOptions);
1825
- },
1826
- /**
1827
- * Check the current status of a given task.
1828
- *
1829
- * @summary Check the status of a task.
1830
- * @param getTask - The getTask object.
1831
- * @param getTask.indexName - The index in which to perform the request.
1832
- * @param getTask.taskID - Unique identifier of an task. Numeric value (up to 64bits).
1833
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1834
- */
1835
- getTask({ indexName, taskID }, requestOptions) {
1836
- if (!indexName) {
1837
- throw new Error('Parameter `indexName` is required when calling `getTask`.');
1838
- }
1839
- if (!taskID) {
1840
- throw new Error('Parameter `taskID` is required when calling `getTask`.');
1841
- }
1842
- const requestPath = '/1/indexes/{indexName}/task/{taskID}'
1843
- .replace('{indexName}', encodeURIComponent(indexName))
1844
- .replace('{taskID}', encodeURIComponent(taskID));
1845
- const headers = {};
1846
- const queryParameters = {};
1847
- const request = {
1848
- method: 'GET',
1849
- path: requestPath,
1850
- queryParameters,
1851
- headers,
1852
- };
1853
- return transporter.request(request, requestOptions);
1854
- },
1855
- /**
1856
- * Get the top 10 userIDs with the highest number of records per cluster. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following array of userIDs and clusters.
1857
- *
1858
- * @summary Get top userID.
1859
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1860
- */
1861
- getTopUserIds(requestOptions) {
1862
- const requestPath = '/1/clusters/mapping/top';
1863
- const headers = {};
1864
- const queryParameters = {};
1865
- const request = {
1866
- method: 'GET',
1867
- path: requestPath,
1868
- queryParameters,
1869
- headers,
1870
- };
1871
- return transporter.request(request, requestOptions);
1872
- },
1873
- /**
1874
- * Returns the userID data stored in the mapping. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userID data.
1875
- *
1876
- * @summary Get userID.
1877
- * @param getUserId - The getUserId object.
1878
- * @param getUserId.userID - UserID to assign.
1879
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1880
- */
1881
- getUserId({ userID }, requestOptions) {
1882
- if (!userID) {
1883
- throw new Error('Parameter `userID` is required when calling `getUserId`.');
1884
- }
1885
- const requestPath = '/1/clusters/mapping/{userID}'.replace('{userID}', encodeURIComponent(userID));
1886
- const headers = {};
1887
- const queryParameters = {};
1888
- const request = {
1889
- method: 'GET',
1890
- path: requestPath,
1891
- queryParameters,
1892
- headers,
1893
- };
1894
- return transporter.request(request, requestOptions);
1895
- },
1896
- /**
1897
- * Get the status of your clusters\' migrations or user creations. Creating a large batch of users or migrating your multi-cluster may take quite some time. This method lets you retrieve the status of the migration, so you can know when it\'s done. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable.
1898
- *
1899
- * @summary Get migration status.
1900
- * @param hasPendingMappings - The hasPendingMappings object.
1901
- * @param hasPendingMappings.getClusters - If the clusters pending mapping state should be on the response.
1902
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1903
- */
1904
- hasPendingMappings({ getClusters }, requestOptions) {
1905
- const requestPath = '/1/clusters/mapping/pending';
1906
- const headers = {};
1907
- const queryParameters = {};
1908
- if (getClusters !== undefined) {
1909
- queryParameters.getClusters = getClusters.toString();
1910
- }
1911
- const request = {
1912
- method: 'GET',
1913
- path: requestPath,
1914
- queryParameters,
1915
- headers,
1916
- };
1917
- return transporter.request(request, requestOptions);
1918
- },
1919
- /**
1920
- * List API keys, along with their associated rights.
1921
- *
1922
- * @summary List API Keys.
1923
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1924
- */
1925
- listApiKeys(requestOptions) {
1926
- const requestPath = '/1/keys';
1927
- const headers = {};
1928
- const queryParameters = {};
1929
- const request = {
1930
- method: 'GET',
1931
- path: requestPath,
1932
- queryParameters,
1933
- headers,
1934
- };
1935
- return transporter.request(request, requestOptions);
1936
- },
1937
- /**
1938
- * List the clusters available in a multi-clusters setup for a single appID. Upon success, the response is 200 OK and contains the following clusters.
1939
- *
1940
- * @summary List clusters.
1941
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1942
- */
1943
- listClusters(requestOptions) {
1944
- const requestPath = '/1/clusters';
1945
- const headers = {};
1946
- const queryParameters = {};
1947
- const request = {
1948
- method: 'GET',
1949
- path: requestPath,
1950
- queryParameters,
1951
- headers,
1952
- };
1953
- return transporter.request(request, requestOptions);
1954
- },
1955
- /**
1956
- * List existing indexes from an application.
1957
- *
1958
- * @summary List existing indexes.
1959
- * @param listIndices - The listIndices object.
1960
- * @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination).
1961
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1962
- */
1963
- listIndices({ page }, requestOptions) {
1964
- const requestPath = '/1/indexes';
1965
- const headers = {};
1966
- const queryParameters = {};
1967
- if (page !== undefined) {
1968
- queryParameters.page = page.toString();
1969
- }
1970
- const request = {
1971
- method: 'GET',
1972
- path: requestPath,
1973
- queryParameters,
1974
- headers,
1975
- };
1976
- return transporter.request(request, requestOptions);
1977
- },
1978
- /**
1979
- * List the userIDs assigned to a multi-clusters appID. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userIDs data.
1980
- *
1981
- * @summary List userIDs.
1982
- * @param listUserIds - The listUserIds object.
1983
- * @param listUserIds.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination).
1984
- * @param listUserIds.hitsPerPage - Maximum number of objects to retrieve.
1985
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1986
- */
1987
- listUserIds({ page, hitsPerPage }, requestOptions) {
1988
- const requestPath = '/1/clusters/mapping';
1989
- const headers = {};
1990
- const queryParameters = {};
1991
- if (page !== undefined) {
1992
- queryParameters.page = page.toString();
1993
- }
1994
- if (hitsPerPage !== undefined) {
1995
- queryParameters.hitsPerPage = hitsPerPage.toString();
1996
- }
1997
- const request = {
1998
- method: 'GET',
1999
- path: requestPath,
2000
- queryParameters,
2001
- headers,
2002
- };
2003
- return transporter.request(request, requestOptions);
2004
- },
2005
- /**
2006
- * Perform multiple write operations, potentially targeting multiple indices, in a single API call.
2007
- *
2008
- * @summary Batch operations to many indices.
2009
- * @param batchParams - The batchParams object.
2010
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2011
- */
2012
- multipleBatch(batchParams, requestOptions) {
2013
- if (!batchParams) {
2014
- throw new Error('Parameter `batchParams` is required when calling `multipleBatch`.');
2015
- }
2016
- if (!batchParams.requests) {
2017
- throw new Error('Parameter `batchParams.requests` is required when calling `multipleBatch`.');
2018
- }
2019
- const requestPath = '/1/indexes/*/batch';
2020
- const headers = {};
2021
- const queryParameters = {};
2022
- const request = {
2023
- method: 'POST',
2024
- path: requestPath,
2025
- queryParameters,
2026
- headers,
2027
- data: batchParams,
2028
- };
2029
- return transporter.request(request, requestOptions);
2030
- },
2031
- /**
2032
- * Performs a copy or a move operation on a index.
2033
- *
2034
- * @summary Copy/move index.
2035
- * @param operationIndex - The operationIndex object.
2036
- * @param operationIndex.indexName - The index in which to perform the request.
2037
- * @param operationIndex.operationIndexParams - The operationIndexParams object.
2038
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2039
- */
2040
- operationIndex({ indexName, operationIndexParams }, requestOptions) {
2041
- if (!indexName) {
2042
- throw new Error('Parameter `indexName` is required when calling `operationIndex`.');
2043
- }
2044
- if (!operationIndexParams) {
2045
- throw new Error('Parameter `operationIndexParams` is required when calling `operationIndex`.');
2046
- }
2047
- if (!operationIndexParams.operation) {
2048
- throw new Error('Parameter `operationIndexParams.operation` is required when calling `operationIndex`.');
2049
- }
2050
- if (!operationIndexParams.destination) {
2051
- throw new Error('Parameter `operationIndexParams.destination` is required when calling `operationIndex`.');
2052
- }
2053
- const requestPath = '/1/indexes/{indexName}/operation'.replace('{indexName}', encodeURIComponent(indexName));
2054
- const headers = {};
2055
- const queryParameters = {};
2056
- const request = {
2057
- method: 'POST',
2058
- path: requestPath,
2059
- queryParameters,
2060
- headers,
2061
- data: operationIndexParams,
2062
- };
2063
- return transporter.request(request, requestOptions);
2064
- },
2065
- /**
2066
- * Update one or more attributes of an existing object. This method lets you update only a part of an existing object, either by adding new attributes or updating existing ones. You can partially update several objects in a single method call. If the index targeted by this operation doesn\'t exist yet, it\'s automatically created.
2067
- *
2068
- * @summary Partially update an object.
2069
- * @param partialUpdateObject - The partialUpdateObject object.
2070
- * @param partialUpdateObject.indexName - The index in which to perform the request.
2071
- * @param partialUpdateObject.objectID - Unique identifier of an object.
2072
- * @param partialUpdateObject.attributesToUpdate - Map of attribute(s) to update.
2073
- * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet.
2074
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2075
- */
2076
- partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists, }, requestOptions) {
2077
- if (!indexName) {
2078
- throw new Error('Parameter `indexName` is required when calling `partialUpdateObject`.');
2079
- }
2080
- if (!objectID) {
2081
- throw new Error('Parameter `objectID` is required when calling `partialUpdateObject`.');
2082
- }
2083
- if (!attributesToUpdate) {
2084
- throw new Error('Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.');
2085
- }
2086
- const requestPath = '/1/indexes/{indexName}/{objectID}/partial'
2087
- .replace('{indexName}', encodeURIComponent(indexName))
2088
- .replace('{objectID}', encodeURIComponent(objectID));
2089
- const headers = {};
2090
- const queryParameters = {};
2091
- if (createIfNotExists !== undefined) {
2092
- queryParameters.createIfNotExists = createIfNotExists.toString();
2093
- }
2094
- const request = {
2095
- method: 'POST',
2096
- path: requestPath,
2097
- queryParameters,
2098
- headers,
2099
- data: attributesToUpdate,
2100
- };
2101
- return transporter.request(request, requestOptions);
2102
- },
2103
- /**
2104
- * This method allow you to send requests to the Algolia REST API.
2105
- *
2106
- * @summary Send requests to the Algolia REST API.
2107
- * @param post - The post object.
2108
- * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
2109
- * @param post.parameters - Query parameters to be applied to the current query.
2110
- * @param post.body - The parameters to send with the custom request.
2111
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2112
- */
2113
- post({ path, parameters, body }, requestOptions) {
2114
- if (!path) {
2115
- throw new Error('Parameter `path` is required when calling `post`.');
2116
- }
2117
- const requestPath = '/1{path}'.replace('{path}', path);
2118
- const headers = {};
2119
- const queryParameters = parameters ? parameters : {};
2120
- const request = {
2121
- method: 'POST',
2122
- path: requestPath,
2123
- queryParameters,
2124
- headers,
2125
- data: body ? body : {},
2126
- };
2127
- return transporter.request(request, requestOptions);
2128
- },
2129
- /**
2130
- * This method allow you to send requests to the Algolia REST API.
2131
- *
2132
- * @summary Send requests to the Algolia REST API.
2133
- * @param put - The put object.
2134
- * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
2135
- * @param put.parameters - Query parameters to be applied to the current query.
2136
- * @param put.body - The parameters to send with the custom request.
2137
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2138
- */
2139
- put({ path, parameters, body }, requestOptions) {
2140
- if (!path) {
2141
- throw new Error('Parameter `path` is required when calling `put`.');
2142
- }
2143
- const requestPath = '/1{path}'.replace('{path}', path);
2144
- const headers = {};
2145
- const queryParameters = parameters ? parameters : {};
2146
- const request = {
2147
- method: 'PUT',
2148
- path: requestPath,
2149
- queryParameters,
2150
- headers,
2151
- data: body ? body : {},
2152
- };
2153
- return transporter.request(request, requestOptions);
2154
- },
2155
- /**
2156
- * Remove a userID and its associated data from the multi-clusters. Upon success, the response is 200 OK and a task is created to remove the userID data and mapping.
2157
- *
2158
- * @summary Remove userID.
2159
- * @param removeUserId - The removeUserId object.
2160
- * @param removeUserId.userID - UserID to assign.
2161
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2162
- */
2163
- removeUserId({ userID }, requestOptions) {
2164
- if (!userID) {
2165
- throw new Error('Parameter `userID` is required when calling `removeUserId`.');
2166
- }
2167
- const requestPath = '/1/clusters/mapping/{userID}'.replace('{userID}', encodeURIComponent(userID));
2168
- const headers = {};
2169
- const queryParameters = {};
2170
- const request = {
2171
- method: 'DELETE',
2172
- path: requestPath,
2173
- queryParameters,
2174
- headers,
2175
- };
2176
- return transporter.request(request, requestOptions);
2177
- },
2178
- /**
2179
- * Replace all allowed sources.
2180
- *
2181
- * @summary Replace all allowed sources.
2182
- * @param replaceSources - The replaceSources object.
2183
- * @param replaceSources.source - The sources to allow.
2184
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2185
- */
2186
- replaceSources({ source }, requestOptions) {
2187
- if (!source) {
2188
- throw new Error('Parameter `source` is required when calling `replaceSources`.');
2189
- }
2190
- const requestPath = '/1/security/sources';
2191
- const headers = {};
2192
- const queryParameters = {};
2193
- const request = {
2194
- method: 'PUT',
2195
- path: requestPath,
2196
- queryParameters,
2197
- headers,
2198
- data: source,
2199
- };
2200
- return transporter.request(request, requestOptions);
2201
- },
2202
- /**
2203
- * Restore a deleted API key, along with its associated rights.
2204
- *
2205
- * @summary Restore an API key.
2206
- * @param restoreApiKey - The restoreApiKey object.
2207
- * @param restoreApiKey.key - API Key string.
2208
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2209
- */
2210
- restoreApiKey({ key }, requestOptions) {
2211
- if (!key) {
2212
- throw new Error('Parameter `key` is required when calling `restoreApiKey`.');
2213
- }
2214
- const requestPath = '/1/keys/{key}/restore'.replace('{key}', encodeURIComponent(key));
2215
- const headers = {};
2216
- const queryParameters = {};
2217
- const request = {
2218
- method: 'POST',
2219
- path: requestPath,
2220
- queryParameters,
2221
- headers,
2222
- };
2223
- return transporter.request(request, requestOptions);
2224
- },
2225
- /**
2226
- * Add an object to the index, automatically assigning it an object ID.
2227
- *
2228
- * @summary Add an object to the index.
2229
- * @param saveObject - The saveObject object.
2230
- * @param saveObject.indexName - The index in which to perform the request.
2231
- * @param saveObject.body - The Algolia record.
2232
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2233
- */
2234
- saveObject({ indexName, body }, requestOptions) {
2235
- if (!indexName) {
2236
- throw new Error('Parameter `indexName` is required when calling `saveObject`.');
2237
- }
2238
- if (!body) {
2239
- throw new Error('Parameter `body` is required when calling `saveObject`.');
2240
- }
2241
- const requestPath = '/1/indexes/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
2242
- const headers = {};
2243
- const queryParameters = {};
2244
- const request = {
2245
- method: 'POST',
2246
- path: requestPath,
2247
- queryParameters,
2248
- headers,
2249
- data: body,
2250
- };
2251
- return transporter.request(request, requestOptions);
2252
- },
2253
- /**
2254
- * Create or update the Rule with the specified objectID.
2255
- *
2256
- * @summary Save/Update a rule.
2257
- * @param saveRule - The saveRule object.
2258
- * @param saveRule.indexName - The index in which to perform the request.
2259
- * @param saveRule.objectID - Unique identifier of an object.
2260
- * @param saveRule.rule - The rule object.
2261
- * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
2262
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2263
- */
2264
- saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
2265
- if (!indexName) {
2266
- throw new Error('Parameter `indexName` is required when calling `saveRule`.');
2267
- }
2268
- if (!objectID) {
2269
- throw new Error('Parameter `objectID` is required when calling `saveRule`.');
2270
- }
2271
- if (!rule) {
2272
- throw new Error('Parameter `rule` is required when calling `saveRule`.');
2273
- }
2274
- if (!rule.objectID) {
2275
- throw new Error('Parameter `rule.objectID` is required when calling `saveRule`.');
2276
- }
2277
- const requestPath = '/1/indexes/{indexName}/rules/{objectID}'
2278
- .replace('{indexName}', encodeURIComponent(indexName))
2279
- .replace('{objectID}', encodeURIComponent(objectID));
2280
- const headers = {};
2281
- const queryParameters = {};
2282
- if (forwardToReplicas !== undefined) {
2283
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
2284
- }
2285
- const request = {
2286
- method: 'PUT',
2287
- path: requestPath,
2288
- queryParameters,
2289
- headers,
2290
- data: rule,
2291
- };
2292
- return transporter.request(request, requestOptions);
2293
- },
2294
- /**
2295
- * Create/update multiple rules objects at once.
2296
- *
2297
- * @summary Save a batch of rules.
2298
- * @param saveRules - The saveRules object.
2299
- * @param saveRules.indexName - The index in which to perform the request.
2300
- * @param saveRules.rules - The rules object.
2301
- * @param saveRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
2302
- * @param saveRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept.
2303
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2304
- */
2305
- saveRules({ indexName, rules, forwardToReplicas, clearExistingRules, }, requestOptions) {
2306
- if (!indexName) {
2307
- throw new Error('Parameter `indexName` is required when calling `saveRules`.');
2308
- }
2309
- if (!rules) {
2310
- throw new Error('Parameter `rules` is required when calling `saveRules`.');
2311
- }
2312
- const requestPath = '/1/indexes/{indexName}/rules/batch'.replace('{indexName}', encodeURIComponent(indexName));
2313
- const headers = {};
2314
- const queryParameters = {};
2315
- if (forwardToReplicas !== undefined) {
2316
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
2317
- }
2318
- if (clearExistingRules !== undefined) {
2319
- queryParameters.clearExistingRules = clearExistingRules.toString();
2320
- }
2321
- const request = {
2322
- method: 'POST',
2323
- path: requestPath,
2324
- queryParameters,
2325
- headers,
2326
- data: rules,
2327
- };
2328
- return transporter.request(request, requestOptions);
2329
- },
2330
- /**
2331
- * Create a new synonym object or update the existing synonym object with the given object ID.
2332
- *
2333
- * @summary Save synonym.
2334
- * @param saveSynonym - The saveSynonym object.
2335
- * @param saveSynonym.indexName - The index in which to perform the request.
2336
- * @param saveSynonym.objectID - Unique identifier of an object.
2337
- * @param saveSynonym.synonymHit - The synonymHit object.
2338
- * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
2339
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2340
- */
2341
- saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
2342
- if (!indexName) {
2343
- throw new Error('Parameter `indexName` is required when calling `saveSynonym`.');
2344
- }
2345
- if (!objectID) {
2346
- throw new Error('Parameter `objectID` is required when calling `saveSynonym`.');
2347
- }
2348
- if (!synonymHit) {
2349
- throw new Error('Parameter `synonymHit` is required when calling `saveSynonym`.');
2350
- }
2351
- if (!synonymHit.objectID) {
2352
- throw new Error('Parameter `synonymHit.objectID` is required when calling `saveSynonym`.');
2353
- }
2354
- const requestPath = '/1/indexes/{indexName}/synonyms/{objectID}'
2355
- .replace('{indexName}', encodeURIComponent(indexName))
2356
- .replace('{objectID}', encodeURIComponent(objectID));
2357
- const headers = {};
2358
- const queryParameters = {};
2359
- if (forwardToReplicas !== undefined) {
2360
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
2361
- }
2362
- const request = {
2363
- method: 'PUT',
2364
- path: requestPath,
2365
- queryParameters,
2366
- headers,
2367
- data: synonymHit,
2368
- };
2369
- return transporter.request(request, requestOptions);
2370
- },
2371
- /**
2372
- * Create/update multiple synonym objects at once, potentially replacing the entire list of synonyms if replaceExistingSynonyms is true.
2373
- *
2374
- * @summary Save a batch of synonyms.
2375
- * @param saveSynonyms - The saveSynonyms object.
2376
- * @param saveSynonyms.indexName - The index in which to perform the request.
2377
- * @param saveSynonyms.synonymHit - The synonymHit object.
2378
- * @param saveSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
2379
- * @param saveSynonyms.replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request.
2380
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2381
- */
2382
- saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms, }, requestOptions) {
2383
- if (!indexName) {
2384
- throw new Error('Parameter `indexName` is required when calling `saveSynonyms`.');
2385
- }
2386
- if (!synonymHit) {
2387
- throw new Error('Parameter `synonymHit` is required when calling `saveSynonyms`.');
2388
- }
2389
- const requestPath = '/1/indexes/{indexName}/synonyms/batch'.replace('{indexName}', encodeURIComponent(indexName));
2390
- const headers = {};
2391
- const queryParameters = {};
2392
- if (forwardToReplicas !== undefined) {
2393
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
2394
- }
2395
- if (replaceExistingSynonyms !== undefined) {
2396
- queryParameters.replaceExistingSynonyms =
2397
- replaceExistingSynonyms.toString();
2398
- }
2399
- const request = {
2400
- method: 'POST',
2401
- path: requestPath,
2402
- queryParameters,
2403
- headers,
2404
- data: synonymHit,
2405
- };
2406
- return transporter.request(request, requestOptions);
2407
- },
2408
- /**
2409
- * Perform a search operation targeting one or many indices.
2410
- *
2411
- * @summary Search multiple indices.
2412
- * @param searchMethodParams - The `search` requests and strategy.
2413
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2414
- */
2415
- search(searchMethodParams, requestOptions) {
2416
- if (searchMethodParams && Array.isArray(searchMethodParams)) {
2417
- const newSignatureRequest = {
2418
- requests: searchMethodParams.map(({ params, ...legacyRequest }) => {
2419
- if (legacyRequest.type === 'facet') {
2420
- return {
2421
- ...legacyRequest,
2422
- ...params,
2423
- type: 'facet',
2424
- };
2425
- }
2426
- return {
2427
- ...legacyRequest,
2428
- ...params,
2429
- facet: undefined,
2430
- maxFacetHits: undefined,
2431
- facetQuery: undefined,
2432
- };
2433
- }),
2434
- };
2435
- // eslint-disable-next-line no-param-reassign
2436
- searchMethodParams = newSignatureRequest;
2437
- }
2438
- if (!searchMethodParams) {
2439
- throw new Error('Parameter `searchMethodParams` is required when calling `search`.');
2440
- }
2441
- if (!searchMethodParams.requests) {
2442
- throw new Error('Parameter `searchMethodParams.requests` is required when calling `search`.');
2443
- }
2444
- const requestPath = '/1/indexes/*/queries';
2445
- const headers = {};
2446
- const queryParameters = {};
2447
- const request = {
2448
- method: 'POST',
2449
- path: requestPath,
2450
- queryParameters,
2451
- headers,
2452
- data: searchMethodParams,
2453
- useReadTransporter: true,
2454
- cacheable: true,
2455
- };
2456
- return transporter.request(request, requestOptions);
2457
- },
2458
- /**
2459
- * Search the dictionary entries.
2460
- *
2461
- * @summary Search a dictionary entries.
2462
- * @param searchDictionaryEntries - The searchDictionaryEntries object.
2463
- * @param searchDictionaryEntries.dictionaryName - The dictionary to search in.
2464
- * @param searchDictionaryEntries.searchDictionaryEntriesParams - The searchDictionaryEntriesParams object.
2465
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2466
- */
2467
- searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams, }, requestOptions) {
2468
- if (!dictionaryName) {
2469
- throw new Error('Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.');
2470
- }
2471
- if (!searchDictionaryEntriesParams) {
2472
- throw new Error('Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.');
2473
- }
2474
- if (!searchDictionaryEntriesParams.query) {
2475
- throw new Error('Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.');
2476
- }
2477
- const requestPath = '/1/dictionaries/{dictionaryName}/search'.replace('{dictionaryName}', encodeURIComponent(dictionaryName));
2478
- const headers = {};
2479
- const queryParameters = {};
2480
- const request = {
2481
- method: 'POST',
2482
- path: requestPath,
2483
- queryParameters,
2484
- headers,
2485
- data: searchDictionaryEntriesParams,
2486
- useReadTransporter: true,
2487
- cacheable: true,
2488
- };
2489
- return transporter.request(request, requestOptions);
2490
- },
2491
- /**
2492
- * Search for values of a given facet, optionally restricting the returned values to those contained in objects matching other search criteria.
2493
- *
2494
- * @summary Search for values of a given facet.
2495
- * @param searchForFacetValues - The searchForFacetValues object.
2496
- * @param searchForFacetValues.indexName - The index in which to perform the request.
2497
- * @param searchForFacetValues.facetName - The facet name.
2498
- * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object.
2499
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2500
- */
2501
- searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest, }, requestOptions) {
2502
- if (!indexName) {
2503
- throw new Error('Parameter `indexName` is required when calling `searchForFacetValues`.');
2504
- }
2505
- if (!facetName) {
2506
- throw new Error('Parameter `facetName` is required when calling `searchForFacetValues`.');
2507
- }
2508
- const requestPath = '/1/indexes/{indexName}/facets/{facetName}/query'
2509
- .replace('{indexName}', encodeURIComponent(indexName))
2510
- .replace('{facetName}', encodeURIComponent(facetName));
2511
- const headers = {};
2512
- const queryParameters = {};
2513
- const request = {
2514
- method: 'POST',
2515
- path: requestPath,
2516
- queryParameters,
2517
- headers,
2518
- data: searchForFacetValuesRequest ? searchForFacetValuesRequest : {},
2519
- useReadTransporter: true,
2520
- cacheable: true,
2521
- };
2522
- return transporter.request(request, requestOptions);
2523
- },
2524
- /**
2525
- * Search for rules matching various criteria.
2526
- *
2527
- * @summary Search for rules.
2528
- * @param searchRules - The searchRules object.
2529
- * @param searchRules.indexName - The index in which to perform the request.
2530
- * @param searchRules.searchRulesParams - The searchRulesParams object.
2531
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2532
- */
2533
- searchRules({ indexName, searchRulesParams }, requestOptions) {
2534
- if (!indexName) {
2535
- throw new Error('Parameter `indexName` is required when calling `searchRules`.');
2536
- }
2537
- const requestPath = '/1/indexes/{indexName}/rules/search'.replace('{indexName}', encodeURIComponent(indexName));
2538
- const headers = {};
2539
- const queryParameters = {};
2540
- const request = {
2541
- method: 'POST',
2542
- path: requestPath,
2543
- queryParameters,
2544
- headers,
2545
- data: searchRulesParams ? searchRulesParams : {},
2546
- useReadTransporter: true,
2547
- cacheable: true,
2548
- };
2549
- return transporter.request(request, requestOptions);
2550
- },
2551
- /**
2552
- * Perform a search operation targeting one specific index.
2553
- *
2554
- * @summary Search in a single index.
2555
- * @param searchSingleIndex - The searchSingleIndex object.
2556
- * @param searchSingleIndex.indexName - The index in which to perform the request.
2557
- * @param searchSingleIndex.searchParams - The searchParams object.
2558
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2559
- */
2560
- searchSingleIndex({ indexName, searchParams }, requestOptions) {
2561
- if (!indexName) {
2562
- throw new Error('Parameter `indexName` is required when calling `searchSingleIndex`.');
2563
- }
2564
- const requestPath = '/1/indexes/{indexName}/query'.replace('{indexName}', encodeURIComponent(indexName));
2565
- const headers = {};
2566
- const queryParameters = {};
2567
- const request = {
2568
- method: 'POST',
2569
- path: requestPath,
2570
- queryParameters,
2571
- headers,
2572
- data: searchParams ? searchParams : {},
2573
- useReadTransporter: true,
2574
- cacheable: true,
2575
- };
2576
- return transporter.request(request, requestOptions);
2577
- },
2578
- /**
2579
- * Search or browse all synonyms, optionally filtering them by type.
2580
- *
2581
- * @summary Search synonyms.
2582
- * @param searchSynonyms - The searchSynonyms object.
2583
- * @param searchSynonyms.indexName - The index in which to perform the request.
2584
- * @param searchSynonyms.type - Only search for specific types of synonyms.
2585
- * @param searchSynonyms.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination).
2586
- * @param searchSynonyms.hitsPerPage - Maximum number of objects to retrieve.
2587
- * @param searchSynonyms.searchSynonymsParams - The body of the the `searchSynonyms` method.
2588
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2589
- */
2590
- searchSynonyms({ indexName, type, page, hitsPerPage, searchSynonymsParams, }, requestOptions) {
2591
- if (!indexName) {
2592
- throw new Error('Parameter `indexName` is required when calling `searchSynonyms`.');
2593
- }
2594
- const requestPath = '/1/indexes/{indexName}/synonyms/search'.replace('{indexName}', encodeURIComponent(indexName));
2595
- const headers = {};
2596
- const queryParameters = {};
2597
- if (type !== undefined) {
2598
- queryParameters.type = type.toString();
2599
- }
2600
- if (page !== undefined) {
2601
- queryParameters.page = page.toString();
2602
- }
2603
- if (hitsPerPage !== undefined) {
2604
- queryParameters.hitsPerPage = hitsPerPage.toString();
2605
- }
2606
- const request = {
2607
- method: 'POST',
2608
- path: requestPath,
2609
- queryParameters,
2610
- headers,
2611
- data: searchSynonymsParams ? searchSynonymsParams : {},
2612
- useReadTransporter: true,
2613
- cacheable: true,
2614
- };
2615
- return transporter.request(request, requestOptions);
2616
- },
2617
- /**
2618
- * Search for userIDs. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds propagate to the different clusters. To keep updates moving quickly, the index of userIDs isn\'t built synchronously with the mapping. Instead, the index is built once every 12h, at the same time as the update of userID usage. For example, when you perform a modification like adding or moving a userID, the search will report an outdated value until the next rebuild of the mapping, which takes place every 12h. Upon success, the response is 200 OK and contains the following userIDs data.
2619
- *
2620
- * @summary Search userID.
2621
- * @param searchUserIdsParams - The searchUserIdsParams object.
2622
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2623
- */
2624
- searchUserIds(searchUserIdsParams, requestOptions) {
2625
- if (!searchUserIdsParams) {
2626
- throw new Error('Parameter `searchUserIdsParams` is required when calling `searchUserIds`.');
2627
- }
2628
- if (!searchUserIdsParams.query) {
2629
- throw new Error('Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.');
2630
- }
2631
- const requestPath = '/1/clusters/mapping/search';
2632
- const headers = {};
2633
- const queryParameters = {};
2634
- const request = {
2635
- method: 'POST',
2636
- path: requestPath,
2637
- queryParameters,
2638
- headers,
2639
- data: searchUserIdsParams,
2640
- useReadTransporter: true,
2641
- cacheable: true,
2642
- };
2643
- return transporter.request(request, requestOptions);
2644
- },
2645
- /**
2646
- * Set dictionaries settings.
2647
- *
2648
- * @summary Set dictionaries settings.
2649
- * @param dictionarySettingsParams - The dictionarySettingsParams object.
2650
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2651
- */
2652
- setDictionarySettings(dictionarySettingsParams, requestOptions) {
2653
- if (!dictionarySettingsParams) {
2654
- throw new Error('Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.');
2655
- }
2656
- if (!dictionarySettingsParams.disableStandardEntries) {
2657
- throw new Error('Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.');
2658
- }
2659
- const requestPath = '/1/dictionaries/*/settings';
2660
- const headers = {};
2661
- const queryParameters = {};
2662
- const request = {
2663
- method: 'PUT',
2664
- path: requestPath,
2665
- queryParameters,
2666
- headers,
2667
- data: dictionarySettingsParams,
2668
- };
2669
- return transporter.request(request, requestOptions);
2670
- },
2671
- /**
2672
- * Update settings of an index. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value.
2673
- *
2674
- * @summary Update settings of an index.
2675
- * @param setSettings - The setSettings object.
2676
- * @param setSettings.indexName - The index in which to perform the request.
2677
- * @param setSettings.indexSettings - The indexSettings object.
2678
- * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
2679
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2680
- */
2681
- setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
2682
- if (!indexName) {
2683
- throw new Error('Parameter `indexName` is required when calling `setSettings`.');
2684
- }
2685
- if (!indexSettings) {
2686
- throw new Error('Parameter `indexSettings` is required when calling `setSettings`.');
2687
- }
2688
- const requestPath = '/1/indexes/{indexName}/settings'.replace('{indexName}', encodeURIComponent(indexName));
2689
- const headers = {};
2690
- const queryParameters = {};
2691
- if (forwardToReplicas !== undefined) {
2692
- queryParameters.forwardToReplicas = forwardToReplicas.toString();
2693
- }
2694
- const request = {
2695
- method: 'PUT',
2696
- path: requestPath,
2697
- queryParameters,
2698
- headers,
2699
- data: indexSettings,
2700
- };
2701
- return transporter.request(request, requestOptions);
2702
- },
2703
- /**
2704
- * Replace every permission of an existing API key.
2705
- *
2706
- * @summary Update an API key.
2707
- * @param updateApiKey - The updateApiKey object.
2708
- * @param updateApiKey.key - API Key string.
2709
- * @param updateApiKey.apiKey - The apiKey object.
2710
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2711
- */
2712
- updateApiKey({ key, apiKey }, requestOptions) {
2713
- if (!key) {
2714
- throw new Error('Parameter `key` is required when calling `updateApiKey`.');
2715
- }
2716
- if (!apiKey) {
2717
- throw new Error('Parameter `apiKey` is required when calling `updateApiKey`.');
2718
- }
2719
- if (!apiKey.acl) {
2720
- throw new Error('Parameter `apiKey.acl` is required when calling `updateApiKey`.');
2721
- }
2722
- const requestPath = '/1/keys/{key}'.replace('{key}', encodeURIComponent(key));
2723
- const headers = {};
2724
- const queryParameters = {};
2725
- const request = {
2726
- method: 'PUT',
2727
- path: requestPath,
2728
- queryParameters,
2729
- headers,
2730
- data: apiKey,
2731
- };
2732
- return transporter.request(request, requestOptions);
2733
- },
2734
- };
715
+ // 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.
716
+ const apiClientVersion = '5.0.0-alpha.80';
717
+ function getDefaultHosts(appId) {
718
+ return [
719
+ {
720
+ url: `${appId}-dsn.algolia.net`,
721
+ accept: 'read',
722
+ protocol: 'https',
723
+ },
724
+ {
725
+ url: `${appId}.algolia.net`,
726
+ accept: 'write',
727
+ protocol: 'https',
728
+ },
729
+ ].concat(shuffle([
730
+ {
731
+ url: `${appId}-1.algolianet.com`,
732
+ accept: 'readWrite',
733
+ protocol: 'https',
734
+ },
735
+ {
736
+ url: `${appId}-2.algolianet.com`,
737
+ accept: 'readWrite',
738
+ protocol: 'https',
739
+ },
740
+ {
741
+ url: `${appId}-3.algolianet.com`,
742
+ accept: 'readWrite',
743
+ protocol: 'https',
744
+ },
745
+ ]));
746
+ }
747
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
748
+ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
749
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
750
+ const transporter = createTransporter({
751
+ hosts: getDefaultHosts(appIdOption),
752
+ ...options,
753
+ algoliaAgent: getAlgoliaAgent({
754
+ algoliaAgents,
755
+ client: 'Search',
756
+ version: apiClientVersion,
757
+ }),
758
+ baseHeaders: {
759
+ 'content-type': 'text/plain',
760
+ ...auth.headers(),
761
+ ...options.baseHeaders,
762
+ },
763
+ baseQueryParameters: {
764
+ ...auth.queryParameters(),
765
+ ...options.baseQueryParameters,
766
+ },
767
+ });
768
+ return {
769
+ transporter,
770
+ /**
771
+ * The `appId` currently in use.
772
+ */
773
+ appId: appIdOption,
774
+ /**
775
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
776
+ */
777
+ clearCache() {
778
+ return Promise.all([
779
+ transporter.requestsCache.clear(),
780
+ transporter.responsesCache.clear(),
781
+ ]).then(() => undefined);
782
+ },
783
+ /**
784
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
785
+ */
786
+ get _ua() {
787
+ return transporter.algoliaAgent.value;
788
+ },
789
+ /**
790
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
791
+ *
792
+ * @param segment - The algolia agent (user-agent) segment to add.
793
+ * @param version - The version of the agent.
794
+ */
795
+ addAlgoliaAgent(segment, version) {
796
+ transporter.algoliaAgent.add({ segment, version });
797
+ },
798
+ /**
799
+ * Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
800
+ *
801
+ * @summary Helper method that waits for a task to be published (completed).
802
+ * @param waitForTaskOptions - The waitForTaskOptions object.
803
+ * @param waitForTaskOptions.indexName - The `indexName` where the operation was performed.
804
+ * @param waitForTaskOptions.taskID - The `taskID` returned in the method response.
805
+ * @param waitForTaskOptions.maxRetries - The maximum number of retries. 50 by default.
806
+ * @param waitForTaskOptions.timeout - The function to decide how long to wait between retries.
807
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
808
+ */
809
+ waitForTask({ indexName, taskID, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
810
+ let retryCount = 0;
811
+ return createIterablePromise({
812
+ func: () => this.getTask({ indexName, taskID }, requestOptions),
813
+ validate: (response) => response.status === 'published',
814
+ aggregator: () => (retryCount += 1),
815
+ error: {
816
+ validate: () => retryCount >= maxRetries,
817
+ message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
818
+ },
819
+ timeout: () => timeout(retryCount),
820
+ });
821
+ },
822
+ /**
823
+ * Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
824
+ *
825
+ * @summary Helper method that waits for an API key task to be processed.
826
+ * @param waitForApiKeyOptions - The waitForApiKeyOptions object.
827
+ * @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`.
828
+ * @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated.
829
+ * @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it.
830
+ * @param waitForApiKeyOptions.maxRetries - The maximum number of retries. 50 by default.
831
+ * @param waitForApiKeyOptions.timeout - The function to decide how long to wait between retries.
832
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
833
+ */
834
+ waitForApiKey({ operation, key, apiKey, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
835
+ let retryCount = 0;
836
+ const baseIteratorOptions = {
837
+ aggregator: () => (retryCount += 1),
838
+ error: {
839
+ validate: () => retryCount >= maxRetries,
840
+ message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
841
+ },
842
+ timeout: () => timeout(retryCount),
843
+ };
844
+ if (operation === 'update') {
845
+ if (!apiKey) {
846
+ throw new Error('`apiKey` is required when waiting for an `update` operation.');
847
+ }
848
+ return createIterablePromise({
849
+ ...baseIteratorOptions,
850
+ func: () => this.getApiKey({ key }, requestOptions),
851
+ validate: (response) => {
852
+ for (const field of Object.keys(apiKey)) {
853
+ const value = apiKey[field];
854
+ const resValue = response[field];
855
+ if (Array.isArray(value) && Array.isArray(resValue)) {
856
+ if (value.length !== resValue.length ||
857
+ value.some((v, index) => v !== resValue[index])) {
858
+ return false;
859
+ }
860
+ }
861
+ else if (value !== resValue) {
862
+ return false;
863
+ }
864
+ }
865
+ return true;
866
+ },
867
+ });
868
+ }
869
+ return createIterablePromise({
870
+ ...baseIteratorOptions,
871
+ func: () => this.getApiKey({ key }, requestOptions).catch((error) => error),
872
+ validate: (error) => operation === 'add' ? error.status !== 404 : error.status === 404,
873
+ });
874
+ },
875
+ /**
876
+ * Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
877
+ *
878
+ * @summary Helper method that iterates on the `browse` method.
879
+ * @param browseObjects - The browseObjects object.
880
+ * @param browseObjects.indexName - The index in which to perform the request.
881
+ * @param browseObjects.browseParams - The `browse` parameters.
882
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is no `cursor` in the response.
883
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
884
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `browse` method and merged with the transporter requestOptions.
885
+ */
886
+ browseObjects({ indexName, browseParams, ...browseObjectsOptions }, requestOptions) {
887
+ return createIterablePromise({
888
+ func: (previousResponse) => {
889
+ return this.browse({
890
+ indexName,
891
+ browseParams: {
892
+ cursor: previousResponse ? previousResponse.cursor : undefined,
893
+ ...browseParams,
894
+ },
895
+ }, requestOptions);
896
+ },
897
+ validate: (response) => response.cursor === undefined,
898
+ ...browseObjectsOptions,
899
+ });
900
+ },
901
+ /**
902
+ * Helper: Iterate on the `searchRules` method of the client to allow aggregating rules of an index.
903
+ *
904
+ * @summary Helper method that iterates on the `searchRules` method.
905
+ * @param browseObjects - The browseObjects object.
906
+ * @param browseObjects.indexName - The index in which to perform the request.
907
+ * @param browseObjects.searchRulesParams - The `searchRules` method parameters.
908
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
909
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
910
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchRules` method and merged with the transporter requestOptions.
911
+ */
912
+ browseRules({ indexName, searchRulesParams, ...browseRulesOptions }, requestOptions) {
913
+ const params = {
914
+ hitsPerPage: 1000,
915
+ ...searchRulesParams,
916
+ };
917
+ return createIterablePromise({
918
+ func: (previousResponse) => {
919
+ return this.searchRules({
920
+ indexName,
921
+ searchRulesParams: {
922
+ ...params,
923
+ page: previousResponse
924
+ ? previousResponse.page + 1
925
+ : params.page || 0,
926
+ },
927
+ }, requestOptions);
928
+ },
929
+ validate: (response) => response.nbHits < params.hitsPerPage,
930
+ ...browseRulesOptions,
931
+ });
932
+ },
933
+ /**
934
+ * Helper: Iterate on the `searchSynonyms` method of the client to allow aggregating rules of an index.
935
+ *
936
+ * @summary Helper method that iterates on the `searchSynonyms` method.
937
+ * @param browseObjects - The browseObjects object.
938
+ * @param browseObjects.indexName - The index in which to perform the request.
939
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
940
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
941
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions.
942
+ */
943
+ browseSynonyms({ indexName, validate, aggregator, ...browseSynonymsOptions }, requestOptions) {
944
+ const params = {
945
+ hitsPerPage: 1000,
946
+ ...browseSynonymsOptions,
947
+ };
948
+ return createIterablePromise({
949
+ func: (previousResponse) => {
950
+ return this.searchSynonyms({
951
+ ...params,
952
+ indexName,
953
+ page: previousResponse
954
+ ? previousResponse.page + 1
955
+ : browseSynonymsOptions.page || 0,
956
+ }, requestOptions);
957
+ },
958
+ validate: (response) => response.nbHits < params.hitsPerPage,
959
+ ...browseSynonymsOptions,
960
+ });
961
+ },
962
+ /**
963
+ * Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string.
964
+ *
965
+ * @summary Add API key.
966
+ * @param apiKey - The apiKey object.
967
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
968
+ */
969
+ addApiKey(apiKey, requestOptions) {
970
+ if (!apiKey) {
971
+ throw new Error('Parameter `apiKey` is required when calling `addApiKey`.');
972
+ }
973
+ if (!apiKey.acl) {
974
+ throw new Error('Parameter `apiKey.acl` is required when calling `addApiKey`.');
975
+ }
976
+ const requestPath = '/1/keys';
977
+ const headers = {};
978
+ const queryParameters = {};
979
+ const request = {
980
+ method: 'POST',
981
+ path: requestPath,
982
+ queryParameters,
983
+ headers,
984
+ data: apiKey,
985
+ };
986
+ return transporter.request(request, requestOptions);
987
+ },
988
+ /**
989
+ * If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).
990
+ *
991
+ * @summary Add or update a record (using objectID).
992
+ * @param addOrUpdateObject - The addOrUpdateObject object.
993
+ * @param addOrUpdateObject.indexName - Index on which to perform the request.
994
+ * @param addOrUpdateObject.objectID - Unique record (object) identifier.
995
+ * @param addOrUpdateObject.body - Algolia record.
996
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
997
+ */
998
+ addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
999
+ if (!indexName) {
1000
+ throw new Error('Parameter `indexName` is required when calling `addOrUpdateObject`.');
1001
+ }
1002
+ if (!objectID) {
1003
+ throw new Error('Parameter `objectID` is required when calling `addOrUpdateObject`.');
1004
+ }
1005
+ if (!body) {
1006
+ throw new Error('Parameter `body` is required when calling `addOrUpdateObject`.');
1007
+ }
1008
+ const requestPath = '/1/indexes/{indexName}/{objectID}'
1009
+ .replace('{indexName}', encodeURIComponent(indexName))
1010
+ .replace('{objectID}', encodeURIComponent(objectID));
1011
+ const headers = {};
1012
+ const queryParameters = {};
1013
+ const request = {
1014
+ method: 'PUT',
1015
+ path: requestPath,
1016
+ queryParameters,
1017
+ headers,
1018
+ data: body,
1019
+ };
1020
+ return transporter.request(request, requestOptions);
1021
+ },
1022
+ /**
1023
+ * Add a source to the list of allowed sources.
1024
+ *
1025
+ * @summary Add a source.
1026
+ * @param source - Source to add.
1027
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1028
+ */
1029
+ appendSource(source, requestOptions) {
1030
+ if (!source) {
1031
+ throw new Error('Parameter `source` is required when calling `appendSource`.');
1032
+ }
1033
+ if (!source.source) {
1034
+ throw new Error('Parameter `source.source` is required when calling `appendSource`.');
1035
+ }
1036
+ const requestPath = '/1/security/sources/append';
1037
+ const headers = {};
1038
+ const queryParameters = {};
1039
+ const request = {
1040
+ method: 'POST',
1041
+ path: requestPath,
1042
+ queryParameters,
1043
+ headers,
1044
+ data: source,
1045
+ };
1046
+ return transporter.request(request, requestOptions);
1047
+ },
1048
+ /**
1049
+ * Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
1050
+ *
1051
+ * @summary Assign or move a user ID.
1052
+ * @param assignUserId - The assignUserId object.
1053
+ * @param assignUserId.xAlgoliaUserID - UserID to assign.
1054
+ * @param assignUserId.assignUserIdParams - The assignUserIdParams object.
1055
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1056
+ */
1057
+ assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
1058
+ if (!xAlgoliaUserID) {
1059
+ throw new Error('Parameter `xAlgoliaUserID` is required when calling `assignUserId`.');
1060
+ }
1061
+ if (!assignUserIdParams) {
1062
+ throw new Error('Parameter `assignUserIdParams` is required when calling `assignUserId`.');
1063
+ }
1064
+ if (!assignUserIdParams.cluster) {
1065
+ throw new Error('Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.');
1066
+ }
1067
+ const requestPath = '/1/clusters/mapping';
1068
+ const headers = {};
1069
+ const queryParameters = {};
1070
+ if (xAlgoliaUserID !== undefined) {
1071
+ headers['X-Algolia-User-ID'] = xAlgoliaUserID.toString();
1072
+ }
1073
+ const request = {
1074
+ method: 'POST',
1075
+ path: requestPath,
1076
+ queryParameters,
1077
+ headers,
1078
+ data: assignUserIdParams,
1079
+ };
1080
+ return transporter.request(request, requestOptions);
1081
+ },
1082
+ /**
1083
+ * To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name.
1084
+ *
1085
+ * @summary Batch write operations on one index.
1086
+ * @param batch - The batch object.
1087
+ * @param batch.indexName - Index on which to perform the request.
1088
+ * @param batch.batchWriteParams - The batchWriteParams object.
1089
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1090
+ */
1091
+ batch({ indexName, batchWriteParams }, requestOptions) {
1092
+ if (!indexName) {
1093
+ throw new Error('Parameter `indexName` is required when calling `batch`.');
1094
+ }
1095
+ if (!batchWriteParams) {
1096
+ throw new Error('Parameter `batchWriteParams` is required when calling `batch`.');
1097
+ }
1098
+ if (!batchWriteParams.requests) {
1099
+ throw new Error('Parameter `batchWriteParams.requests` is required when calling `batch`.');
1100
+ }
1101
+ const requestPath = '/1/indexes/{indexName}/batch'.replace('{indexName}', encodeURIComponent(indexName));
1102
+ const headers = {};
1103
+ const queryParameters = {};
1104
+ const request = {
1105
+ method: 'POST',
1106
+ path: requestPath,
1107
+ queryParameters,
1108
+ headers,
1109
+ data: batchWriteParams,
1110
+ };
1111
+ return transporter.request(request, requestOptions);
1112
+ },
1113
+ /**
1114
+ * Assign multiple user IDs to a cluster. **You can\'t _move_ users with this operation.**.
1115
+ *
1116
+ * @summary Batch assign userIDs.
1117
+ * @param batchAssignUserIds - The batchAssignUserIds object.
1118
+ * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign.
1119
+ * @param batchAssignUserIds.batchAssignUserIdsParams - The batchAssignUserIdsParams object.
1120
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1121
+ */
1122
+ batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
1123
+ if (!xAlgoliaUserID) {
1124
+ throw new Error('Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.');
1125
+ }
1126
+ if (!batchAssignUserIdsParams) {
1127
+ throw new Error('Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.');
1128
+ }
1129
+ if (!batchAssignUserIdsParams.cluster) {
1130
+ throw new Error('Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.');
1131
+ }
1132
+ if (!batchAssignUserIdsParams.users) {
1133
+ throw new Error('Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.');
1134
+ }
1135
+ const requestPath = '/1/clusters/mapping/batch';
1136
+ const headers = {};
1137
+ const queryParameters = {};
1138
+ if (xAlgoliaUserID !== undefined) {
1139
+ headers['X-Algolia-User-ID'] = xAlgoliaUserID.toString();
1140
+ }
1141
+ const request = {
1142
+ method: 'POST',
1143
+ path: requestPath,
1144
+ queryParameters,
1145
+ headers,
1146
+ data: batchAssignUserIdsParams,
1147
+ };
1148
+ return transporter.request(request, requestOptions);
1149
+ },
1150
+ /**
1151
+ * Add or remove a batch of dictionary entries.
1152
+ *
1153
+ * @summary Batch dictionary entries.
1154
+ * @param batchDictionaryEntries - The batchDictionaryEntries object.
1155
+ * @param batchDictionaryEntries.dictionaryName - Dictionary to search in.
1156
+ * @param batchDictionaryEntries.batchDictionaryEntriesParams - The batchDictionaryEntriesParams object.
1157
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1158
+ */
1159
+ batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams, }, requestOptions) {
1160
+ if (!dictionaryName) {
1161
+ throw new Error('Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.');
1162
+ }
1163
+ if (!batchDictionaryEntriesParams) {
1164
+ throw new Error('Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.');
1165
+ }
1166
+ if (!batchDictionaryEntriesParams.requests) {
1167
+ throw new Error('Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.');
1168
+ }
1169
+ const requestPath = '/1/dictionaries/{dictionaryName}/batch'.replace('{dictionaryName}', encodeURIComponent(dictionaryName));
1170
+ const headers = {};
1171
+ const queryParameters = {};
1172
+ const request = {
1173
+ method: 'POST',
1174
+ path: requestPath,
1175
+ queryParameters,
1176
+ headers,
1177
+ data: batchDictionaryEntriesParams,
1178
+ };
1179
+ return transporter.request(request, requestOptions);
1180
+ },
1181
+ /**
1182
+ * Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn\'t support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance.
1183
+ *
1184
+ * @summary Get all records from an index.
1185
+ * @param browse - The browse object.
1186
+ * @param browse.indexName - Index on which to perform the request.
1187
+ * @param browse.browseParams - The browseParams object.
1188
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1189
+ */
1190
+ browse({ indexName, browseParams }, requestOptions) {
1191
+ if (!indexName) {
1192
+ throw new Error('Parameter `indexName` is required when calling `browse`.');
1193
+ }
1194
+ const requestPath = '/1/indexes/{indexName}/browse'.replace('{indexName}', encodeURIComponent(indexName));
1195
+ const headers = {};
1196
+ const queryParameters = {};
1197
+ const request = {
1198
+ method: 'POST',
1199
+ path: requestPath,
1200
+ queryParameters,
1201
+ headers,
1202
+ data: browseParams ? browseParams : {},
1203
+ };
1204
+ return transporter.request(request, requestOptions);
1205
+ },
1206
+ /**
1207
+ * Delete all synonyms in the index.
1208
+ *
1209
+ * @summary Delete all synonyms.
1210
+ * @param clearAllSynonyms - The clearAllSynonyms object.
1211
+ * @param clearAllSynonyms.indexName - Index on which to perform the request.
1212
+ * @param clearAllSynonyms.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
1213
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1214
+ */
1215
+ clearAllSynonyms({ indexName, forwardToReplicas }, requestOptions) {
1216
+ if (!indexName) {
1217
+ throw new Error('Parameter `indexName` is required when calling `clearAllSynonyms`.');
1218
+ }
1219
+ const requestPath = '/1/indexes/{indexName}/synonyms/clear'.replace('{indexName}', encodeURIComponent(indexName));
1220
+ const headers = {};
1221
+ const queryParameters = {};
1222
+ if (forwardToReplicas !== undefined) {
1223
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
1224
+ }
1225
+ const request = {
1226
+ method: 'POST',
1227
+ path: requestPath,
1228
+ queryParameters,
1229
+ headers,
1230
+ };
1231
+ return transporter.request(request, requestOptions);
1232
+ },
1233
+ /**
1234
+ * Delete the records but leave settings and index-specific API keys untouched.
1235
+ *
1236
+ * @summary Delete all records from an index.
1237
+ * @param clearObjects - The clearObjects object.
1238
+ * @param clearObjects.indexName - Index on which to perform the request.
1239
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1240
+ */
1241
+ clearObjects({ indexName }, requestOptions) {
1242
+ if (!indexName) {
1243
+ throw new Error('Parameter `indexName` is required when calling `clearObjects`.');
1244
+ }
1245
+ const requestPath = '/1/indexes/{indexName}/clear'.replace('{indexName}', encodeURIComponent(indexName));
1246
+ const headers = {};
1247
+ const queryParameters = {};
1248
+ const request = {
1249
+ method: 'POST',
1250
+ path: requestPath,
1251
+ queryParameters,
1252
+ headers,
1253
+ };
1254
+ return transporter.request(request, requestOptions);
1255
+ },
1256
+ /**
1257
+ * Delete all rules in the index.
1258
+ *
1259
+ * @summary Delete all rules.
1260
+ * @param clearRules - The clearRules object.
1261
+ * @param clearRules.indexName - Index on which to perform the request.
1262
+ * @param clearRules.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
1263
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1264
+ */
1265
+ clearRules({ indexName, forwardToReplicas }, requestOptions) {
1266
+ if (!indexName) {
1267
+ throw new Error('Parameter `indexName` is required when calling `clearRules`.');
1268
+ }
1269
+ const requestPath = '/1/indexes/{indexName}/rules/clear'.replace('{indexName}', encodeURIComponent(indexName));
1270
+ const headers = {};
1271
+ const queryParameters = {};
1272
+ if (forwardToReplicas !== undefined) {
1273
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
1274
+ }
1275
+ const request = {
1276
+ method: 'POST',
1277
+ path: requestPath,
1278
+ queryParameters,
1279
+ headers,
1280
+ };
1281
+ return transporter.request(request, requestOptions);
1282
+ },
1283
+ /**
1284
+ * This method allow you to send requests to the Algolia REST API.
1285
+ *
1286
+ * @summary Send requests to the Algolia REST API.
1287
+ * @param del - The del object.
1288
+ * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
1289
+ * @param del.parameters - Query parameters to apply to the current query.
1290
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1291
+ */
1292
+ del({ path, parameters }, requestOptions) {
1293
+ if (!path) {
1294
+ throw new Error('Parameter `path` is required when calling `del`.');
1295
+ }
1296
+ const requestPath = '/1{path}'.replace('{path}', path);
1297
+ const headers = {};
1298
+ const queryParameters = parameters ? parameters : {};
1299
+ const request = {
1300
+ method: 'DELETE',
1301
+ path: requestPath,
1302
+ queryParameters,
1303
+ headers,
1304
+ };
1305
+ return transporter.request(request, requestOptions);
1306
+ },
1307
+ /**
1308
+ * Delete an existing API key. The request must be authenticated with the admin API key.
1309
+ *
1310
+ * @summary Delete API key.
1311
+ * @param deleteApiKey - The deleteApiKey object.
1312
+ * @param deleteApiKey.key - API key.
1313
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1314
+ */
1315
+ deleteApiKey({ key }, requestOptions) {
1316
+ if (!key) {
1317
+ throw new Error('Parameter `key` is required when calling `deleteApiKey`.');
1318
+ }
1319
+ const requestPath = '/1/keys/{key}'.replace('{key}', encodeURIComponent(key));
1320
+ const headers = {};
1321
+ const queryParameters = {};
1322
+ const request = {
1323
+ method: 'DELETE',
1324
+ path: requestPath,
1325
+ queryParameters,
1326
+ headers,
1327
+ };
1328
+ return transporter.request(request, requestOptions);
1329
+ },
1330
+ /**
1331
+ * This operation doesn\'t support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn\'t accept empty filters or queries.
1332
+ *
1333
+ * @summary Delete all records matching a query.
1334
+ * @param deleteBy - The deleteBy object.
1335
+ * @param deleteBy.indexName - Index on which to perform the request.
1336
+ * @param deleteBy.deleteByParams - The deleteByParams object.
1337
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1338
+ */
1339
+ deleteBy({ indexName, deleteByParams }, requestOptions) {
1340
+ if (!indexName) {
1341
+ throw new Error('Parameter `indexName` is required when calling `deleteBy`.');
1342
+ }
1343
+ if (!deleteByParams) {
1344
+ throw new Error('Parameter `deleteByParams` is required when calling `deleteBy`.');
1345
+ }
1346
+ const requestPath = '/1/indexes/{indexName}/deleteByQuery'.replace('{indexName}', encodeURIComponent(indexName));
1347
+ const headers = {};
1348
+ const queryParameters = {};
1349
+ const request = {
1350
+ method: 'POST',
1351
+ path: requestPath,
1352
+ queryParameters,
1353
+ headers,
1354
+ data: deleteByParams,
1355
+ };
1356
+ return transporter.request(request, requestOptions);
1357
+ },
1358
+ /**
1359
+ * Delete an existing index.
1360
+ *
1361
+ * @summary Delete index.
1362
+ * @param deleteIndex - The deleteIndex object.
1363
+ * @param deleteIndex.indexName - Index on which to perform the request.
1364
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1365
+ */
1366
+ deleteIndex({ indexName }, requestOptions) {
1367
+ if (!indexName) {
1368
+ throw new Error('Parameter `indexName` is required when calling `deleteIndex`.');
1369
+ }
1370
+ const requestPath = '/1/indexes/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
1371
+ const headers = {};
1372
+ const queryParameters = {};
1373
+ const request = {
1374
+ method: 'DELETE',
1375
+ path: requestPath,
1376
+ queryParameters,
1377
+ headers,
1378
+ };
1379
+ return transporter.request(request, requestOptions);
1380
+ },
1381
+ /**
1382
+ * To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead.
1383
+ *
1384
+ * @summary Delete a record.
1385
+ * @param deleteObject - The deleteObject object.
1386
+ * @param deleteObject.indexName - Index on which to perform the request.
1387
+ * @param deleteObject.objectID - Unique record (object) identifier.
1388
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1389
+ */
1390
+ deleteObject({ indexName, objectID }, requestOptions) {
1391
+ if (!indexName) {
1392
+ throw new Error('Parameter `indexName` is required when calling `deleteObject`.');
1393
+ }
1394
+ if (!objectID) {
1395
+ throw new Error('Parameter `objectID` is required when calling `deleteObject`.');
1396
+ }
1397
+ const requestPath = '/1/indexes/{indexName}/{objectID}'
1398
+ .replace('{indexName}', encodeURIComponent(indexName))
1399
+ .replace('{objectID}', encodeURIComponent(objectID));
1400
+ const headers = {};
1401
+ const queryParameters = {};
1402
+ const request = {
1403
+ method: 'DELETE',
1404
+ path: requestPath,
1405
+ queryParameters,
1406
+ headers,
1407
+ };
1408
+ return transporter.request(request, requestOptions);
1409
+ },
1410
+ /**
1411
+ * Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
1412
+ *
1413
+ * @summary Delete a rule.
1414
+ * @param deleteRule - The deleteRule object.
1415
+ * @param deleteRule.indexName - Index on which to perform the request.
1416
+ * @param deleteRule.objectID - Unique identifier of a rule object.
1417
+ * @param deleteRule.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
1418
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1419
+ */
1420
+ deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
1421
+ if (!indexName) {
1422
+ throw new Error('Parameter `indexName` is required when calling `deleteRule`.');
1423
+ }
1424
+ if (!objectID) {
1425
+ throw new Error('Parameter `objectID` is required when calling `deleteRule`.');
1426
+ }
1427
+ const requestPath = '/1/indexes/{indexName}/rules/{objectID}'
1428
+ .replace('{indexName}', encodeURIComponent(indexName))
1429
+ .replace('{objectID}', encodeURIComponent(objectID));
1430
+ const headers = {};
1431
+ const queryParameters = {};
1432
+ if (forwardToReplicas !== undefined) {
1433
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
1434
+ }
1435
+ const request = {
1436
+ method: 'DELETE',
1437
+ path: requestPath,
1438
+ queryParameters,
1439
+ headers,
1440
+ };
1441
+ return transporter.request(request, requestOptions);
1442
+ },
1443
+ /**
1444
+ * Remove a source from the list of allowed sources.
1445
+ *
1446
+ * @summary Remove a source.
1447
+ * @param deleteSource - The deleteSource object.
1448
+ * @param deleteSource.source - IP address range of the source.
1449
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1450
+ */
1451
+ deleteSource({ source }, requestOptions) {
1452
+ if (!source) {
1453
+ throw new Error('Parameter `source` is required when calling `deleteSource`.');
1454
+ }
1455
+ const requestPath = '/1/security/sources/{source}'.replace('{source}', encodeURIComponent(source));
1456
+ const headers = {};
1457
+ const queryParameters = {};
1458
+ const request = {
1459
+ method: 'DELETE',
1460
+ path: requestPath,
1461
+ queryParameters,
1462
+ headers,
1463
+ };
1464
+ return transporter.request(request, requestOptions);
1465
+ },
1466
+ /**
1467
+ * Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
1468
+ *
1469
+ * @summary Delete a synonym.
1470
+ * @param deleteSynonym - The deleteSynonym object.
1471
+ * @param deleteSynonym.indexName - Index on which to perform the request.
1472
+ * @param deleteSynonym.objectID - Unique identifier of a synonym object.
1473
+ * @param deleteSynonym.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
1474
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1475
+ */
1476
+ deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
1477
+ if (!indexName) {
1478
+ throw new Error('Parameter `indexName` is required when calling `deleteSynonym`.');
1479
+ }
1480
+ if (!objectID) {
1481
+ throw new Error('Parameter `objectID` is required when calling `deleteSynonym`.');
1482
+ }
1483
+ const requestPath = '/1/indexes/{indexName}/synonyms/{objectID}'
1484
+ .replace('{indexName}', encodeURIComponent(indexName))
1485
+ .replace('{objectID}', encodeURIComponent(objectID));
1486
+ const headers = {};
1487
+ const queryParameters = {};
1488
+ if (forwardToReplicas !== undefined) {
1489
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
1490
+ }
1491
+ const request = {
1492
+ method: 'DELETE',
1493
+ path: requestPath,
1494
+ queryParameters,
1495
+ headers,
1496
+ };
1497
+ return transporter.request(request, requestOptions);
1498
+ },
1499
+ /**
1500
+ * This method allow you to send requests to the Algolia REST API.
1501
+ *
1502
+ * @summary Send requests to the Algolia REST API.
1503
+ * @param get - The get object.
1504
+ * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
1505
+ * @param get.parameters - Query parameters to apply to the current query.
1506
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1507
+ */
1508
+ get({ path, parameters }, requestOptions) {
1509
+ if (!path) {
1510
+ throw new Error('Parameter `path` is required when calling `get`.');
1511
+ }
1512
+ const requestPath = '/1{path}'.replace('{path}', path);
1513
+ const headers = {};
1514
+ const queryParameters = parameters ? parameters : {};
1515
+ const request = {
1516
+ method: 'GET',
1517
+ path: requestPath,
1518
+ queryParameters,
1519
+ headers,
1520
+ };
1521
+ return transporter.request(request, requestOptions);
1522
+ },
1523
+ /**
1524
+ * Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application\'s keys. When authenticating with other API keys, you can only retrieve information for that key.
1525
+ *
1526
+ * @summary Get API key permissions.
1527
+ * @param getApiKey - The getApiKey object.
1528
+ * @param getApiKey.key - API key.
1529
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1530
+ */
1531
+ getApiKey({ key }, requestOptions) {
1532
+ if (!key) {
1533
+ throw new Error('Parameter `key` is required when calling `getApiKey`.');
1534
+ }
1535
+ const requestPath = '/1/keys/{key}'.replace('{key}', encodeURIComponent(key));
1536
+ const headers = {};
1537
+ const queryParameters = {};
1538
+ const request = {
1539
+ method: 'GET',
1540
+ path: requestPath,
1541
+ queryParameters,
1542
+ headers,
1543
+ };
1544
+ return transporter.request(request, requestOptions);
1545
+ },
1546
+ /**
1547
+ * Lists Algolia\'s [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language\'s [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features.
1548
+ *
1549
+ * @summary List available languages.
1550
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1551
+ */
1552
+ getDictionaryLanguages(requestOptions) {
1553
+ const requestPath = '/1/dictionaries/*/languages';
1554
+ const headers = {};
1555
+ const queryParameters = {};
1556
+ const request = {
1557
+ method: 'GET',
1558
+ path: requestPath,
1559
+ queryParameters,
1560
+ headers,
1561
+ };
1562
+ return transporter.request(request, requestOptions);
1563
+ },
1564
+ /**
1565
+ * Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings).
1566
+ *
1567
+ * @summary Get stop word settings.
1568
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1569
+ */
1570
+ getDictionarySettings(requestOptions) {
1571
+ const requestPath = '/1/dictionaries/*/settings';
1572
+ const headers = {};
1573
+ const queryParameters = {};
1574
+ const request = {
1575
+ method: 'GET',
1576
+ path: requestPath,
1577
+ queryParameters,
1578
+ headers,
1579
+ };
1580
+ return transporter.request(request, requestOptions);
1581
+ },
1582
+ /**
1583
+ * The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There\'s also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn\'t appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN\'s endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers).
1584
+ *
1585
+ * @summary Return the latest log entries.
1586
+ * @param getLogs - The getLogs object.
1587
+ * @param getLogs.offset - First log entry to retrieve. Sorted by decreasing date with 0 being the most recent.
1588
+ * @param getLogs.length - Maximum number of entries to retrieve.
1589
+ * @param getLogs.indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices.
1590
+ * @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved.
1591
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1592
+ */
1593
+ getLogs({ offset, length, indexName, type } = {}, requestOptions = undefined) {
1594
+ const requestPath = '/1/logs';
1595
+ const headers = {};
1596
+ const queryParameters = {};
1597
+ if (offset !== undefined) {
1598
+ queryParameters.offset = offset.toString();
1599
+ }
1600
+ if (length !== undefined) {
1601
+ queryParameters.length = length.toString();
1602
+ }
1603
+ if (indexName !== undefined) {
1604
+ queryParameters.indexName = indexName.toString();
1605
+ }
1606
+ if (type !== undefined) {
1607
+ queryParameters.type = type.toString();
1608
+ }
1609
+ const request = {
1610
+ method: 'GET',
1611
+ path: requestPath,
1612
+ queryParameters,
1613
+ headers,
1614
+ };
1615
+ return transporter.request(request, requestOptions);
1616
+ },
1617
+ /**
1618
+ * To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
1619
+ *
1620
+ * @summary Get a record.
1621
+ * @param getObject - The getObject object.
1622
+ * @param getObject.indexName - Index on which to perform the request.
1623
+ * @param getObject.objectID - Unique record (object) identifier.
1624
+ * @param getObject.attributesToRetrieve - Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won\'t be retrieved unless the request is authenticated with the admin API key.
1625
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1626
+ */
1627
+ getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
1628
+ if (!indexName) {
1629
+ throw new Error('Parameter `indexName` is required when calling `getObject`.');
1630
+ }
1631
+ if (!objectID) {
1632
+ throw new Error('Parameter `objectID` is required when calling `getObject`.');
1633
+ }
1634
+ const requestPath = '/1/indexes/{indexName}/{objectID}'
1635
+ .replace('{indexName}', encodeURIComponent(indexName))
1636
+ .replace('{objectID}', encodeURIComponent(objectID));
1637
+ const headers = {};
1638
+ const queryParameters = {};
1639
+ if (attributesToRetrieve !== undefined) {
1640
+ queryParameters.attributesToRetrieve = attributesToRetrieve.toString();
1641
+ }
1642
+ const request = {
1643
+ method: 'GET',
1644
+ path: requestPath,
1645
+ queryParameters,
1646
+ headers,
1647
+ };
1648
+ return transporter.request(request, requestOptions);
1649
+ },
1650
+ /**
1651
+ * Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests.
1652
+ *
1653
+ * @summary Get multiple records.
1654
+ * @param getObjectsParams - Request object.
1655
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1656
+ */
1657
+ getObjects(getObjectsParams, requestOptions) {
1658
+ if (!getObjectsParams) {
1659
+ throw new Error('Parameter `getObjectsParams` is required when calling `getObjects`.');
1660
+ }
1661
+ if (!getObjectsParams.requests) {
1662
+ throw new Error('Parameter `getObjectsParams.requests` is required when calling `getObjects`.');
1663
+ }
1664
+ const requestPath = '/1/indexes/*/objects';
1665
+ const headers = {};
1666
+ const queryParameters = {};
1667
+ const request = {
1668
+ method: 'POST',
1669
+ path: requestPath,
1670
+ queryParameters,
1671
+ headers,
1672
+ data: getObjectsParams,
1673
+ useReadTransporter: true,
1674
+ cacheable: true,
1675
+ };
1676
+ return transporter.request(request, requestOptions);
1677
+ },
1678
+ /**
1679
+ * Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
1680
+ *
1681
+ * @summary Get a rule.
1682
+ * @param getRule - The getRule object.
1683
+ * @param getRule.indexName - Index on which to perform the request.
1684
+ * @param getRule.objectID - Unique identifier of a rule object.
1685
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1686
+ */
1687
+ getRule({ indexName, objectID }, requestOptions) {
1688
+ if (!indexName) {
1689
+ throw new Error('Parameter `indexName` is required when calling `getRule`.');
1690
+ }
1691
+ if (!objectID) {
1692
+ throw new Error('Parameter `objectID` is required when calling `getRule`.');
1693
+ }
1694
+ const requestPath = '/1/indexes/{indexName}/rules/{objectID}'
1695
+ .replace('{indexName}', encodeURIComponent(indexName))
1696
+ .replace('{objectID}', encodeURIComponent(objectID));
1697
+ const headers = {};
1698
+ const queryParameters = {};
1699
+ const request = {
1700
+ method: 'GET',
1701
+ path: requestPath,
1702
+ queryParameters,
1703
+ headers,
1704
+ };
1705
+ return transporter.request(request, requestOptions);
1706
+ },
1707
+ /**
1708
+ * Return an object containing an index\'s [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/).
1709
+ *
1710
+ * @summary Get index settings.
1711
+ * @param getSettings - The getSettings object.
1712
+ * @param getSettings.indexName - Index on which to perform the request.
1713
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1714
+ */
1715
+ getSettings({ indexName }, requestOptions) {
1716
+ if (!indexName) {
1717
+ throw new Error('Parameter `indexName` is required when calling `getSettings`.');
1718
+ }
1719
+ const requestPath = '/1/indexes/{indexName}/settings'.replace('{indexName}', encodeURIComponent(indexName));
1720
+ const headers = {};
1721
+ const queryParameters = {};
1722
+ const request = {
1723
+ method: 'GET',
1724
+ path: requestPath,
1725
+ queryParameters,
1726
+ headers,
1727
+ };
1728
+ return transporter.request(request, requestOptions);
1729
+ },
1730
+ /**
1731
+ * Get all allowed sources (IP addresses).
1732
+ *
1733
+ * @summary Get all allowed IP addresses.
1734
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1735
+ */
1736
+ getSources(requestOptions) {
1737
+ const requestPath = '/1/security/sources';
1738
+ const headers = {};
1739
+ const queryParameters = {};
1740
+ const request = {
1741
+ method: 'GET',
1742
+ path: requestPath,
1743
+ queryParameters,
1744
+ headers,
1745
+ };
1746
+ return transporter.request(request, requestOptions);
1747
+ },
1748
+ /**
1749
+ * Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
1750
+ *
1751
+ * @summary Get a synonym object.
1752
+ * @param getSynonym - The getSynonym object.
1753
+ * @param getSynonym.indexName - Index on which to perform the request.
1754
+ * @param getSynonym.objectID - Unique identifier of a synonym object.
1755
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1756
+ */
1757
+ getSynonym({ indexName, objectID }, requestOptions) {
1758
+ if (!indexName) {
1759
+ throw new Error('Parameter `indexName` is required when calling `getSynonym`.');
1760
+ }
1761
+ if (!objectID) {
1762
+ throw new Error('Parameter `objectID` is required when calling `getSynonym`.');
1763
+ }
1764
+ const requestPath = '/1/indexes/{indexName}/synonyms/{objectID}'
1765
+ .replace('{indexName}', encodeURIComponent(indexName))
1766
+ .replace('{objectID}', encodeURIComponent(objectID));
1767
+ const headers = {};
1768
+ const queryParameters = {};
1769
+ const request = {
1770
+ method: 'GET',
1771
+ path: requestPath,
1772
+ queryParameters,
1773
+ headers,
1774
+ };
1775
+ return transporter.request(request, requestOptions);
1776
+ },
1777
+ /**
1778
+ * Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task.
1779
+ *
1780
+ * @summary Check a task\'s status.
1781
+ * @param getTask - The getTask object.
1782
+ * @param getTask.indexName - Index on which to perform the request.
1783
+ * @param getTask.taskID - Unique task identifier.
1784
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1785
+ */
1786
+ getTask({ indexName, taskID }, requestOptions) {
1787
+ if (!indexName) {
1788
+ throw new Error('Parameter `indexName` is required when calling `getTask`.');
1789
+ }
1790
+ if (!taskID) {
1791
+ throw new Error('Parameter `taskID` is required when calling `getTask`.');
1792
+ }
1793
+ const requestPath = '/1/indexes/{indexName}/task/{taskID}'
1794
+ .replace('{indexName}', encodeURIComponent(indexName))
1795
+ .replace('{taskID}', encodeURIComponent(taskID));
1796
+ const headers = {};
1797
+ const queryParameters = {};
1798
+ const request = {
1799
+ method: 'GET',
1800
+ path: requestPath,
1801
+ queryParameters,
1802
+ headers,
1803
+ };
1804
+ return transporter.request(request, requestOptions);
1805
+ },
1806
+ /**
1807
+ * Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn\'t real-time.
1808
+ *
1809
+ * @summary Get top userID.
1810
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1811
+ */
1812
+ getTopUserIds(requestOptions) {
1813
+ const requestPath = '/1/clusters/mapping/top';
1814
+ const headers = {};
1815
+ const queryParameters = {};
1816
+ const request = {
1817
+ method: 'GET',
1818
+ path: requestPath,
1819
+ queryParameters,
1820
+ headers,
1821
+ };
1822
+ return transporter.request(request, requestOptions);
1823
+ },
1824
+ /**
1825
+ * Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn\'t real-time.
1826
+ *
1827
+ * @summary Get userID.
1828
+ * @param getUserId - The getUserId object.
1829
+ * @param getUserId.userID - UserID to assign.
1830
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1831
+ */
1832
+ getUserId({ userID }, requestOptions) {
1833
+ if (!userID) {
1834
+ throw new Error('Parameter `userID` is required when calling `getUserId`.');
1835
+ }
1836
+ const requestPath = '/1/clusters/mapping/{userID}'.replace('{userID}', encodeURIComponent(userID));
1837
+ const headers = {};
1838
+ const queryParameters = {};
1839
+ const request = {
1840
+ method: 'GET',
1841
+ path: requestPath,
1842
+ queryParameters,
1843
+ headers,
1844
+ };
1845
+ return transporter.request(request, requestOptions);
1846
+ },
1847
+ /**
1848
+ * To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
1849
+ *
1850
+ * @summary Get migration and user mapping status.
1851
+ * @param hasPendingMappings - The hasPendingMappings object.
1852
+ * @param hasPendingMappings.getClusters - Indicates whether to include the cluster\'s pending mapping state in the response.
1853
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1854
+ */
1855
+ hasPendingMappings({ getClusters } = {}, requestOptions = undefined) {
1856
+ const requestPath = '/1/clusters/mapping/pending';
1857
+ const headers = {};
1858
+ const queryParameters = {};
1859
+ if (getClusters !== undefined) {
1860
+ queryParameters.getClusters = getClusters.toString();
1861
+ }
1862
+ const request = {
1863
+ method: 'GET',
1864
+ path: requestPath,
1865
+ queryParameters,
1866
+ headers,
1867
+ };
1868
+ return transporter.request(request, requestOptions);
1869
+ },
1870
+ /**
1871
+ * List all API keys associated with your Algolia application, including their permissions and restrictions.
1872
+ *
1873
+ * @summary List API keys.
1874
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1875
+ */
1876
+ listApiKeys(requestOptions) {
1877
+ const requestPath = '/1/keys';
1878
+ const headers = {};
1879
+ const queryParameters = {};
1880
+ const request = {
1881
+ method: 'GET',
1882
+ path: requestPath,
1883
+ queryParameters,
1884
+ headers,
1885
+ };
1886
+ return transporter.request(request, requestOptions);
1887
+ },
1888
+ /**
1889
+ * List the available clusters in a multi-cluster setup.
1890
+ *
1891
+ * @summary List clusters.
1892
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1893
+ */
1894
+ listClusters(requestOptions) {
1895
+ const requestPath = '/1/clusters';
1896
+ const headers = {};
1897
+ const queryParameters = {};
1898
+ const request = {
1899
+ method: 'GET',
1900
+ path: requestPath,
1901
+ queryParameters,
1902
+ headers,
1903
+ };
1904
+ return transporter.request(request, requestOptions);
1905
+ },
1906
+ /**
1907
+ * List indices in an Algolia application.
1908
+ *
1909
+ * @summary List indices.
1910
+ * @param listIndices - The listIndices object.
1911
+ * @param listIndices.page - Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated.
1912
+ * @param listIndices.hitsPerPage - Maximum number of hits per page.
1913
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1914
+ */
1915
+ listIndices({ page, hitsPerPage } = {}, requestOptions = undefined) {
1916
+ const requestPath = '/1/indexes';
1917
+ const headers = {};
1918
+ const queryParameters = {};
1919
+ if (page !== undefined) {
1920
+ queryParameters.page = page.toString();
1921
+ }
1922
+ if (hitsPerPage !== undefined) {
1923
+ queryParameters.hitsPerPage = hitsPerPage.toString();
1924
+ }
1925
+ const request = {
1926
+ method: 'GET',
1927
+ path: requestPath,
1928
+ queryParameters,
1929
+ headers,
1930
+ };
1931
+ return transporter.request(request, requestOptions);
1932
+ },
1933
+ /**
1934
+ * List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn\'t real-time.
1935
+ *
1936
+ * @summary List userIDs.
1937
+ * @param listUserIds - The listUserIds object.
1938
+ * @param listUserIds.page - Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated.
1939
+ * @param listUserIds.hitsPerPage - Maximum number of hits per page.
1940
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1941
+ */
1942
+ listUserIds({ page, hitsPerPage } = {}, requestOptions = undefined) {
1943
+ const requestPath = '/1/clusters/mapping';
1944
+ const headers = {};
1945
+ const queryParameters = {};
1946
+ if (page !== undefined) {
1947
+ queryParameters.page = page.toString();
1948
+ }
1949
+ if (hitsPerPage !== undefined) {
1950
+ queryParameters.hitsPerPage = hitsPerPage.toString();
1951
+ }
1952
+ const request = {
1953
+ method: 'GET',
1954
+ path: requestPath,
1955
+ queryParameters,
1956
+ headers,
1957
+ };
1958
+ return transporter.request(request, requestOptions);
1959
+ },
1960
+ /**
1961
+ * To reduce the time spent on network round trips, you can perform several write actions in a single request. It\'s a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name.
1962
+ *
1963
+ * @summary Batch write operations on multiple indices.
1964
+ * @param batchParams - The batchParams object.
1965
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1966
+ */
1967
+ multipleBatch(batchParams, requestOptions) {
1968
+ if (!batchParams) {
1969
+ throw new Error('Parameter `batchParams` is required when calling `multipleBatch`.');
1970
+ }
1971
+ if (!batchParams.requests) {
1972
+ throw new Error('Parameter `batchParams.requests` is required when calling `multipleBatch`.');
1973
+ }
1974
+ const requestPath = '/1/indexes/*/batch';
1975
+ const headers = {};
1976
+ const queryParameters = {};
1977
+ const request = {
1978
+ method: 'POST',
1979
+ path: requestPath,
1980
+ queryParameters,
1981
+ headers,
1982
+ data: batchParams,
1983
+ };
1984
+ return transporter.request(request, requestOptions);
1985
+ },
1986
+ /**
1987
+ * This `operation`, _copy_ or _move_, will copy or move a source index\'s (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn\'t exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/).
1988
+ *
1989
+ * @summary Copy, move, or rename an index.
1990
+ * @param operationIndex - The operationIndex object.
1991
+ * @param operationIndex.indexName - Index on which to perform the request.
1992
+ * @param operationIndex.operationIndexParams - The operationIndexParams object.
1993
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1994
+ */
1995
+ operationIndex({ indexName, operationIndexParams }, requestOptions) {
1996
+ if (!indexName) {
1997
+ throw new Error('Parameter `indexName` is required when calling `operationIndex`.');
1998
+ }
1999
+ if (!operationIndexParams) {
2000
+ throw new Error('Parameter `operationIndexParams` is required when calling `operationIndex`.');
2001
+ }
2002
+ if (!operationIndexParams.operation) {
2003
+ throw new Error('Parameter `operationIndexParams.operation` is required when calling `operationIndex`.');
2004
+ }
2005
+ if (!operationIndexParams.destination) {
2006
+ throw new Error('Parameter `operationIndexParams.destination` is required when calling `operationIndex`.');
2007
+ }
2008
+ const requestPath = '/1/indexes/{indexName}/operation'.replace('{indexName}', encodeURIComponent(indexName));
2009
+ const headers = {};
2010
+ const queryParameters = {};
2011
+ const request = {
2012
+ method: 'POST',
2013
+ path: requestPath,
2014
+ queryParameters,
2015
+ headers,
2016
+ data: operationIndexParams,
2017
+ };
2018
+ return transporter.request(request, requestOptions);
2019
+ },
2020
+ /**
2021
+ * Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor.
2022
+ *
2023
+ * @summary Update record attributes.
2024
+ * @param partialUpdateObject - The partialUpdateObject object.
2025
+ * @param partialUpdateObject.indexName - Index on which to perform the request.
2026
+ * @param partialUpdateObject.objectID - Unique record (object) identifier.
2027
+ * @param partialUpdateObject.attributesToUpdate - Object with attributes to update.
2028
+ * @param partialUpdateObject.createIfNotExists - Indicates whether to create a new record if it doesn\'t exist yet.
2029
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2030
+ */
2031
+ partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists, }, requestOptions) {
2032
+ if (!indexName) {
2033
+ throw new Error('Parameter `indexName` is required when calling `partialUpdateObject`.');
2034
+ }
2035
+ if (!objectID) {
2036
+ throw new Error('Parameter `objectID` is required when calling `partialUpdateObject`.');
2037
+ }
2038
+ if (!attributesToUpdate) {
2039
+ throw new Error('Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.');
2040
+ }
2041
+ const requestPath = '/1/indexes/{indexName}/{objectID}/partial'
2042
+ .replace('{indexName}', encodeURIComponent(indexName))
2043
+ .replace('{objectID}', encodeURIComponent(objectID));
2044
+ const headers = {};
2045
+ const queryParameters = {};
2046
+ if (createIfNotExists !== undefined) {
2047
+ queryParameters.createIfNotExists = createIfNotExists.toString();
2048
+ }
2049
+ const request = {
2050
+ method: 'POST',
2051
+ path: requestPath,
2052
+ queryParameters,
2053
+ headers,
2054
+ data: attributesToUpdate,
2055
+ };
2056
+ return transporter.request(request, requestOptions);
2057
+ },
2058
+ /**
2059
+ * This method allow you to send requests to the Algolia REST API.
2060
+ *
2061
+ * @summary Send requests to the Algolia REST API.
2062
+ * @param post - The post object.
2063
+ * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
2064
+ * @param post.parameters - Query parameters to apply to the current query.
2065
+ * @param post.body - Parameters to send with the custom request.
2066
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2067
+ */
2068
+ post({ path, parameters, body }, requestOptions) {
2069
+ if (!path) {
2070
+ throw new Error('Parameter `path` is required when calling `post`.');
2071
+ }
2072
+ const requestPath = '/1{path}'.replace('{path}', path);
2073
+ const headers = {};
2074
+ const queryParameters = parameters ? parameters : {};
2075
+ const request = {
2076
+ method: 'POST',
2077
+ path: requestPath,
2078
+ queryParameters,
2079
+ headers,
2080
+ data: body ? body : {},
2081
+ };
2082
+ return transporter.request(request, requestOptions);
2083
+ },
2084
+ /**
2085
+ * This method allow you to send requests to the Algolia REST API.
2086
+ *
2087
+ * @summary Send requests to the Algolia REST API.
2088
+ * @param put - The put object.
2089
+ * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
2090
+ * @param put.parameters - Query parameters to apply to the current query.
2091
+ * @param put.body - Parameters to send with the custom request.
2092
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2093
+ */
2094
+ put({ path, parameters, body }, requestOptions) {
2095
+ if (!path) {
2096
+ throw new Error('Parameter `path` is required when calling `put`.');
2097
+ }
2098
+ const requestPath = '/1{path}'.replace('{path}', path);
2099
+ const headers = {};
2100
+ const queryParameters = parameters ? parameters : {};
2101
+ const request = {
2102
+ method: 'PUT',
2103
+ path: requestPath,
2104
+ queryParameters,
2105
+ headers,
2106
+ data: body ? body : {},
2107
+ };
2108
+ return transporter.request(request, requestOptions);
2109
+ },
2110
+ /**
2111
+ * Remove a userID and its associated data from the multi-clusters.
2112
+ *
2113
+ * @summary Remove userID.
2114
+ * @param removeUserId - The removeUserId object.
2115
+ * @param removeUserId.userID - UserID to assign.
2116
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2117
+ */
2118
+ removeUserId({ userID }, requestOptions) {
2119
+ if (!userID) {
2120
+ throw new Error('Parameter `userID` is required when calling `removeUserId`.');
2121
+ }
2122
+ const requestPath = '/1/clusters/mapping/{userID}'.replace('{userID}', encodeURIComponent(userID));
2123
+ const headers = {};
2124
+ const queryParameters = {};
2125
+ const request = {
2126
+ method: 'DELETE',
2127
+ path: requestPath,
2128
+ queryParameters,
2129
+ headers,
2130
+ };
2131
+ return transporter.request(request, requestOptions);
2132
+ },
2133
+ /**
2134
+ * Replace all allowed sources.
2135
+ *
2136
+ * @summary Replace all sources.
2137
+ * @param replaceSources - The replaceSources object.
2138
+ * @param replaceSources.source - Allowed sources.
2139
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2140
+ */
2141
+ replaceSources({ source }, requestOptions) {
2142
+ if (!source) {
2143
+ throw new Error('Parameter `source` is required when calling `replaceSources`.');
2144
+ }
2145
+ const requestPath = '/1/security/sources';
2146
+ const headers = {};
2147
+ const queryParameters = {};
2148
+ const request = {
2149
+ method: 'PUT',
2150
+ path: requestPath,
2151
+ queryParameters,
2152
+ headers,
2153
+ data: source,
2154
+ };
2155
+ return transporter.request(request, requestOptions);
2156
+ },
2157
+ /**
2158
+ * Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key.
2159
+ *
2160
+ * @summary Restore API key.
2161
+ * @param restoreApiKey - The restoreApiKey object.
2162
+ * @param restoreApiKey.key - API key.
2163
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2164
+ */
2165
+ restoreApiKey({ key }, requestOptions) {
2166
+ if (!key) {
2167
+ throw new Error('Parameter `key` is required when calling `restoreApiKey`.');
2168
+ }
2169
+ const requestPath = '/1/keys/{key}/restore'.replace('{key}', encodeURIComponent(key));
2170
+ const headers = {};
2171
+ const queryParameters = {};
2172
+ const request = {
2173
+ method: 'POST',
2174
+ path: requestPath,
2175
+ queryParameters,
2176
+ headers,
2177
+ };
2178
+ return transporter.request(request, requestOptions);
2179
+ },
2180
+ /**
2181
+ * Add a record (object) to an index or replace it. If the record doesn\'t contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).
2182
+ *
2183
+ * @summary Add or update a record.
2184
+ * @param saveObject - The saveObject object.
2185
+ * @param saveObject.indexName - Index on which to perform the request.
2186
+ * @param saveObject.body - The Algolia record.
2187
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2188
+ */
2189
+ saveObject({ indexName, body }, requestOptions) {
2190
+ if (!indexName) {
2191
+ throw new Error('Parameter `indexName` is required when calling `saveObject`.');
2192
+ }
2193
+ if (!body) {
2194
+ throw new Error('Parameter `body` is required when calling `saveObject`.');
2195
+ }
2196
+ const requestPath = '/1/indexes/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
2197
+ const headers = {};
2198
+ const queryParameters = {};
2199
+ const request = {
2200
+ method: 'POST',
2201
+ path: requestPath,
2202
+ queryParameters,
2203
+ headers,
2204
+ data: body,
2205
+ };
2206
+ return transporter.request(request, requestOptions);
2207
+ },
2208
+ /**
2209
+ * To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules).
2210
+ *
2211
+ * @summary Create or update a rule.
2212
+ * @param saveRule - The saveRule object.
2213
+ * @param saveRule.indexName - Index on which to perform the request.
2214
+ * @param saveRule.objectID - Unique identifier of a rule object.
2215
+ * @param saveRule.rule - The rule object.
2216
+ * @param saveRule.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
2217
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2218
+ */
2219
+ saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
2220
+ if (!indexName) {
2221
+ throw new Error('Parameter `indexName` is required when calling `saveRule`.');
2222
+ }
2223
+ if (!objectID) {
2224
+ throw new Error('Parameter `objectID` is required when calling `saveRule`.');
2225
+ }
2226
+ if (!rule) {
2227
+ throw new Error('Parameter `rule` is required when calling `saveRule`.');
2228
+ }
2229
+ if (!rule.objectID) {
2230
+ throw new Error('Parameter `rule.objectID` is required when calling `saveRule`.');
2231
+ }
2232
+ const requestPath = '/1/indexes/{indexName}/rules/{objectID}'
2233
+ .replace('{indexName}', encodeURIComponent(indexName))
2234
+ .replace('{objectID}', encodeURIComponent(objectID));
2235
+ const headers = {};
2236
+ const queryParameters = {};
2237
+ if (forwardToReplicas !== undefined) {
2238
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
2239
+ }
2240
+ const request = {
2241
+ method: 'PUT',
2242
+ path: requestPath,
2243
+ queryParameters,
2244
+ headers,
2245
+ data: rule,
2246
+ };
2247
+ return transporter.request(request, requestOptions);
2248
+ },
2249
+ /**
2250
+ * Create or update multiple rules.
2251
+ *
2252
+ * @summary Save a batch of rules.
2253
+ * @param saveRules - The saveRules object.
2254
+ * @param saveRules.indexName - Index on which to perform the request.
2255
+ * @param saveRules.rules - The rules object.
2256
+ * @param saveRules.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
2257
+ * @param saveRules.clearExistingRules - Indicates whether existing rules should be deleted before adding this batch.
2258
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2259
+ */
2260
+ saveRules({ indexName, rules, forwardToReplicas, clearExistingRules, }, requestOptions) {
2261
+ if (!indexName) {
2262
+ throw new Error('Parameter `indexName` is required when calling `saveRules`.');
2263
+ }
2264
+ if (!rules) {
2265
+ throw new Error('Parameter `rules` is required when calling `saveRules`.');
2266
+ }
2267
+ const requestPath = '/1/indexes/{indexName}/rules/batch'.replace('{indexName}', encodeURIComponent(indexName));
2268
+ const headers = {};
2269
+ const queryParameters = {};
2270
+ if (forwardToReplicas !== undefined) {
2271
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
2272
+ }
2273
+ if (clearExistingRules !== undefined) {
2274
+ queryParameters.clearExistingRules = clearExistingRules.toString();
2275
+ }
2276
+ const request = {
2277
+ method: 'POST',
2278
+ path: requestPath,
2279
+ queryParameters,
2280
+ headers,
2281
+ data: rules,
2282
+ };
2283
+ return transporter.request(request, requestOptions);
2284
+ },
2285
+ /**
2286
+ * Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn\'t exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).
2287
+ *
2288
+ * @summary Save a synonym.
2289
+ * @param saveSynonym - The saveSynonym object.
2290
+ * @param saveSynonym.indexName - Index on which to perform the request.
2291
+ * @param saveSynonym.objectID - Unique identifier of a synonym object.
2292
+ * @param saveSynonym.synonymHit - The synonymHit object.
2293
+ * @param saveSynonym.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
2294
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2295
+ */
2296
+ saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
2297
+ if (!indexName) {
2298
+ throw new Error('Parameter `indexName` is required when calling `saveSynonym`.');
2299
+ }
2300
+ if (!objectID) {
2301
+ throw new Error('Parameter `objectID` is required when calling `saveSynonym`.');
2302
+ }
2303
+ if (!synonymHit) {
2304
+ throw new Error('Parameter `synonymHit` is required when calling `saveSynonym`.');
2305
+ }
2306
+ if (!synonymHit.objectID) {
2307
+ throw new Error('Parameter `synonymHit.objectID` is required when calling `saveSynonym`.');
2308
+ }
2309
+ if (!synonymHit.type) {
2310
+ throw new Error('Parameter `synonymHit.type` is required when calling `saveSynonym`.');
2311
+ }
2312
+ const requestPath = '/1/indexes/{indexName}/synonyms/{objectID}'
2313
+ .replace('{indexName}', encodeURIComponent(indexName))
2314
+ .replace('{objectID}', encodeURIComponent(objectID));
2315
+ const headers = {};
2316
+ const queryParameters = {};
2317
+ if (forwardToReplicas !== undefined) {
2318
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
2319
+ }
2320
+ const request = {
2321
+ method: 'PUT',
2322
+ path: requestPath,
2323
+ queryParameters,
2324
+ headers,
2325
+ data: synonymHit,
2326
+ };
2327
+ return transporter.request(request, requestOptions);
2328
+ },
2329
+ /**
2330
+ * Create or update multiple synonyms.
2331
+ *
2332
+ * @summary Save a batch of synonyms.
2333
+ * @param saveSynonyms - The saveSynonyms object.
2334
+ * @param saveSynonyms.indexName - Index on which to perform the request.
2335
+ * @param saveSynonyms.synonymHit - The synonymHit object.
2336
+ * @param saveSynonyms.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
2337
+ * @param saveSynonyms.replaceExistingSynonyms - Indicates whether to replace all synonyms in the index with the ones sent with this request.
2338
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2339
+ */
2340
+ saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms, }, requestOptions) {
2341
+ if (!indexName) {
2342
+ throw new Error('Parameter `indexName` is required when calling `saveSynonyms`.');
2343
+ }
2344
+ if (!synonymHit) {
2345
+ throw new Error('Parameter `synonymHit` is required when calling `saveSynonyms`.');
2346
+ }
2347
+ const requestPath = '/1/indexes/{indexName}/synonyms/batch'.replace('{indexName}', encodeURIComponent(indexName));
2348
+ const headers = {};
2349
+ const queryParameters = {};
2350
+ if (forwardToReplicas !== undefined) {
2351
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
2352
+ }
2353
+ if (replaceExistingSynonyms !== undefined) {
2354
+ queryParameters.replaceExistingSynonyms =
2355
+ replaceExistingSynonyms.toString();
2356
+ }
2357
+ const request = {
2358
+ method: 'POST',
2359
+ path: requestPath,
2360
+ queryParameters,
2361
+ headers,
2362
+ data: synonymHit,
2363
+ };
2364
+ return transporter.request(request, requestOptions);
2365
+ },
2366
+ /**
2367
+ * Send multiple search queries to one or more indices.
2368
+ *
2369
+ * @summary Search multiple indices.
2370
+ * @param searchMethodParams - Query requests and strategies. Results will be received in the same order as the queries.
2371
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2372
+ */
2373
+ search(searchMethodParams, requestOptions) {
2374
+ if (searchMethodParams && Array.isArray(searchMethodParams)) {
2375
+ const newSignatureRequest = {
2376
+ requests: searchMethodParams.map(({ params, ...legacyRequest }) => {
2377
+ if (legacyRequest.type === 'facet') {
2378
+ return {
2379
+ ...legacyRequest,
2380
+ ...params,
2381
+ type: 'facet',
2382
+ };
2383
+ }
2384
+ return {
2385
+ ...legacyRequest,
2386
+ ...params,
2387
+ facet: undefined,
2388
+ maxFacetHits: undefined,
2389
+ facetQuery: undefined,
2390
+ };
2391
+ }),
2392
+ };
2393
+ // eslint-disable-next-line no-param-reassign
2394
+ searchMethodParams = newSignatureRequest;
2395
+ }
2396
+ if (!searchMethodParams) {
2397
+ throw new Error('Parameter `searchMethodParams` is required when calling `search`.');
2398
+ }
2399
+ if (!searchMethodParams.requests) {
2400
+ throw new Error('Parameter `searchMethodParams.requests` is required when calling `search`.');
2401
+ }
2402
+ const requestPath = '/1/indexes/*/queries';
2403
+ const headers = {};
2404
+ const queryParameters = {};
2405
+ const request = {
2406
+ method: 'POST',
2407
+ path: requestPath,
2408
+ queryParameters,
2409
+ headers,
2410
+ data: searchMethodParams,
2411
+ useReadTransporter: true,
2412
+ cacheable: true,
2413
+ };
2414
+ return transporter.request(request, requestOptions);
2415
+ },
2416
+ /**
2417
+ * Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries.
2418
+ *
2419
+ * @summary Search dictionary entries.
2420
+ * @param searchDictionaryEntries - The searchDictionaryEntries object.
2421
+ * @param searchDictionaryEntries.dictionaryName - Dictionary to search in.
2422
+ * @param searchDictionaryEntries.searchDictionaryEntriesParams - The searchDictionaryEntriesParams object.
2423
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2424
+ */
2425
+ searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams, }, requestOptions) {
2426
+ if (!dictionaryName) {
2427
+ throw new Error('Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.');
2428
+ }
2429
+ if (!searchDictionaryEntriesParams) {
2430
+ throw new Error('Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.');
2431
+ }
2432
+ if (!searchDictionaryEntriesParams.query) {
2433
+ throw new Error('Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.');
2434
+ }
2435
+ const requestPath = '/1/dictionaries/{dictionaryName}/search'.replace('{dictionaryName}', encodeURIComponent(dictionaryName));
2436
+ const headers = {};
2437
+ const queryParameters = {};
2438
+ const request = {
2439
+ method: 'POST',
2440
+ path: requestPath,
2441
+ queryParameters,
2442
+ headers,
2443
+ data: searchDictionaryEntriesParams,
2444
+ useReadTransporter: true,
2445
+ cacheable: true,
2446
+ };
2447
+ return transporter.request(request, requestOptions);
2448
+ },
2449
+ /**
2450
+ * [Search for a facet\'s values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn\'t supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`.
2451
+ *
2452
+ * @summary Search for facet values.
2453
+ * @param searchForFacetValues - The searchForFacetValues object.
2454
+ * @param searchForFacetValues.indexName - Index on which to perform the request.
2455
+ * @param searchForFacetValues.facetName - Facet name.
2456
+ * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object.
2457
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2458
+ */
2459
+ searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest, }, requestOptions) {
2460
+ if (!indexName) {
2461
+ throw new Error('Parameter `indexName` is required when calling `searchForFacetValues`.');
2462
+ }
2463
+ if (!facetName) {
2464
+ throw new Error('Parameter `facetName` is required when calling `searchForFacetValues`.');
2465
+ }
2466
+ const requestPath = '/1/indexes/{indexName}/facets/{facetName}/query'
2467
+ .replace('{indexName}', encodeURIComponent(indexName))
2468
+ .replace('{facetName}', encodeURIComponent(facetName));
2469
+ const headers = {};
2470
+ const queryParameters = {};
2471
+ const request = {
2472
+ method: 'POST',
2473
+ path: requestPath,
2474
+ queryParameters,
2475
+ headers,
2476
+ data: searchForFacetValuesRequest ? searchForFacetValuesRequest : {},
2477
+ useReadTransporter: true,
2478
+ cacheable: true,
2479
+ };
2480
+ return transporter.request(request, requestOptions);
2481
+ },
2482
+ /**
2483
+ * Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body.
2484
+ *
2485
+ * @summary Search for rules.
2486
+ * @param searchRules - The searchRules object.
2487
+ * @param searchRules.indexName - Index on which to perform the request.
2488
+ * @param searchRules.searchRulesParams - The searchRulesParams object.
2489
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2490
+ */
2491
+ searchRules({ indexName, searchRulesParams }, requestOptions) {
2492
+ if (!indexName) {
2493
+ throw new Error('Parameter `indexName` is required when calling `searchRules`.');
2494
+ }
2495
+ const requestPath = '/1/indexes/{indexName}/rules/search'.replace('{indexName}', encodeURIComponent(indexName));
2496
+ const headers = {};
2497
+ const queryParameters = {};
2498
+ const request = {
2499
+ method: 'POST',
2500
+ path: requestPath,
2501
+ queryParameters,
2502
+ headers,
2503
+ data: searchRulesParams ? searchRulesParams : {},
2504
+ useReadTransporter: true,
2505
+ cacheable: true,
2506
+ };
2507
+ return transporter.request(request, requestOptions);
2508
+ },
2509
+ /**
2510
+ * Return records that match the query.
2511
+ *
2512
+ * @summary Search an index.
2513
+ * @param searchSingleIndex - The searchSingleIndex object.
2514
+ * @param searchSingleIndex.indexName - Index on which to perform the request.
2515
+ * @param searchSingleIndex.searchParams - The searchParams object.
2516
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2517
+ */
2518
+ searchSingleIndex({ indexName, searchParams }, requestOptions) {
2519
+ if (!indexName) {
2520
+ throw new Error('Parameter `indexName` is required when calling `searchSingleIndex`.');
2521
+ }
2522
+ const requestPath = '/1/indexes/{indexName}/query'.replace('{indexName}', encodeURIComponent(indexName));
2523
+ const headers = {};
2524
+ const queryParameters = {};
2525
+ const request = {
2526
+ method: 'POST',
2527
+ path: requestPath,
2528
+ queryParameters,
2529
+ headers,
2530
+ data: searchParams ? searchParams : {},
2531
+ useReadTransporter: true,
2532
+ cacheable: true,
2533
+ };
2534
+ return transporter.request(request, requestOptions);
2535
+ },
2536
+ /**
2537
+ * Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body.
2538
+ *
2539
+ * @summary Search for synonyms.
2540
+ * @param searchSynonyms - The searchSynonyms object.
2541
+ * @param searchSynonyms.indexName - Index on which to perform the request.
2542
+ * @param searchSynonyms.type - Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms).
2543
+ * @param searchSynonyms.page - Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there\'s no pagination.
2544
+ * @param searchSynonyms.hitsPerPage - Maximum number of hits per page.
2545
+ * @param searchSynonyms.searchSynonymsParams - Body of the `searchSynonyms` operation.
2546
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2547
+ */
2548
+ searchSynonyms({ indexName, type, page, hitsPerPage, searchSynonymsParams, }, requestOptions) {
2549
+ if (!indexName) {
2550
+ throw new Error('Parameter `indexName` is required when calling `searchSynonyms`.');
2551
+ }
2552
+ const requestPath = '/1/indexes/{indexName}/synonyms/search'.replace('{indexName}', encodeURIComponent(indexName));
2553
+ const headers = {};
2554
+ const queryParameters = {};
2555
+ if (type !== undefined) {
2556
+ queryParameters.type = type.toString();
2557
+ }
2558
+ if (page !== undefined) {
2559
+ queryParameters.page = page.toString();
2560
+ }
2561
+ if (hitsPerPage !== undefined) {
2562
+ queryParameters.hitsPerPage = hitsPerPage.toString();
2563
+ }
2564
+ const request = {
2565
+ method: 'POST',
2566
+ path: requestPath,
2567
+ queryParameters,
2568
+ headers,
2569
+ data: searchSynonymsParams ? searchSynonymsParams : {},
2570
+ useReadTransporter: true,
2571
+ cacheable: true,
2572
+ };
2573
+ return transporter.request(request, requestOptions);
2574
+ },
2575
+ /**
2576
+ * Since it can take up to a few seconds to get the data from the different clusters, the response isn\'t real-time. To ensure rapid updates, the user IDs index isn\'t built at the same time as the mapping. Instead, it\'s built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).
2577
+ *
2578
+ * @summary Search for a user ID.
2579
+ * @param searchUserIdsParams - The searchUserIdsParams object.
2580
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2581
+ */
2582
+ searchUserIds(searchUserIdsParams, requestOptions) {
2583
+ if (!searchUserIdsParams) {
2584
+ throw new Error('Parameter `searchUserIdsParams` is required when calling `searchUserIds`.');
2585
+ }
2586
+ if (!searchUserIdsParams.query) {
2587
+ throw new Error('Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.');
2588
+ }
2589
+ const requestPath = '/1/clusters/mapping/search';
2590
+ const headers = {};
2591
+ const queryParameters = {};
2592
+ const request = {
2593
+ method: 'POST',
2594
+ path: requestPath,
2595
+ queryParameters,
2596
+ headers,
2597
+ data: searchUserIdsParams,
2598
+ useReadTransporter: true,
2599
+ cacheable: true,
2600
+ };
2601
+ return transporter.request(request, requestOptions);
2602
+ },
2603
+ /**
2604
+ * Set stop word settings for a specific language.
2605
+ *
2606
+ * @summary Set stop word settings.
2607
+ * @param dictionarySettingsParams - The dictionarySettingsParams object.
2608
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2609
+ */
2610
+ setDictionarySettings(dictionarySettingsParams, requestOptions) {
2611
+ if (!dictionarySettingsParams) {
2612
+ throw new Error('Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.');
2613
+ }
2614
+ if (!dictionarySettingsParams.disableStandardEntries) {
2615
+ throw new Error('Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.');
2616
+ }
2617
+ const requestPath = '/1/dictionaries/*/settings';
2618
+ const headers = {};
2619
+ const queryParameters = {};
2620
+ const request = {
2621
+ method: 'PUT',
2622
+ path: requestPath,
2623
+ queryParameters,
2624
+ headers,
2625
+ data: dictionarySettingsParams,
2626
+ };
2627
+ return transporter.request(request, requestOptions);
2628
+ },
2629
+ /**
2630
+ * Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value.
2631
+ *
2632
+ * @summary Update index settings.
2633
+ * @param setSettings - The setSettings object.
2634
+ * @param setSettings.indexName - Index on which to perform the request.
2635
+ * @param setSettings.indexSettings - The indexSettings object.
2636
+ * @param setSettings.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
2637
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2638
+ */
2639
+ setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
2640
+ if (!indexName) {
2641
+ throw new Error('Parameter `indexName` is required when calling `setSettings`.');
2642
+ }
2643
+ if (!indexSettings) {
2644
+ throw new Error('Parameter `indexSettings` is required when calling `setSettings`.');
2645
+ }
2646
+ const requestPath = '/1/indexes/{indexName}/settings'.replace('{indexName}', encodeURIComponent(indexName));
2647
+ const headers = {};
2648
+ const queryParameters = {};
2649
+ if (forwardToReplicas !== undefined) {
2650
+ queryParameters.forwardToReplicas = forwardToReplicas.toString();
2651
+ }
2652
+ const request = {
2653
+ method: 'PUT',
2654
+ path: requestPath,
2655
+ queryParameters,
2656
+ headers,
2657
+ data: indexSettings,
2658
+ };
2659
+ return transporter.request(request, requestOptions);
2660
+ },
2661
+ /**
2662
+ * Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key.
2663
+ *
2664
+ * @summary Update an API key.
2665
+ * @param updateApiKey - The updateApiKey object.
2666
+ * @param updateApiKey.key - API key.
2667
+ * @param updateApiKey.apiKey - The apiKey object.
2668
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2669
+ */
2670
+ updateApiKey({ key, apiKey }, requestOptions) {
2671
+ if (!key) {
2672
+ throw new Error('Parameter `key` is required when calling `updateApiKey`.');
2673
+ }
2674
+ if (!apiKey) {
2675
+ throw new Error('Parameter `apiKey` is required when calling `updateApiKey`.');
2676
+ }
2677
+ if (!apiKey.acl) {
2678
+ throw new Error('Parameter `apiKey.acl` is required when calling `updateApiKey`.');
2679
+ }
2680
+ const requestPath = '/1/keys/{key}'.replace('{key}', encodeURIComponent(key));
2681
+ const headers = {};
2682
+ const queryParameters = {};
2683
+ const request = {
2684
+ method: 'PUT',
2685
+ path: requestPath,
2686
+ queryParameters,
2687
+ headers,
2688
+ data: apiKey,
2689
+ };
2690
+ return transporter.request(request, requestOptions);
2691
+ },
2692
+ };
2735
2693
  }
2736
2694
 
2737
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2738
- function searchClient(appId, apiKey, options) {
2739
- if (!appId || typeof appId !== 'string') {
2740
- throw new Error('`appId` is missing.');
2741
- }
2742
- if (!apiKey || typeof apiKey !== 'string') {
2743
- throw new Error('`apiKey` is missing.');
2744
- }
2745
- return createSearchClient({
2746
- appId,
2747
- apiKey,
2748
- timeouts: {
2749
- connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
2750
- read: DEFAULT_READ_TIMEOUT_BROWSER,
2751
- write: DEFAULT_WRITE_TIMEOUT_BROWSER,
2752
- },
2753
- requester: createXhrRequester(),
2754
- algoliaAgents: [{ segment: 'Browser' }],
2755
- authMode: 'WithinQueryParameters',
2756
- responsesCache: createMemoryCache(),
2757
- requestsCache: createMemoryCache({ serializable: false }),
2758
- hostsCache: createFallbackableCache({
2759
- caches: [
2760
- createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }),
2761
- createMemoryCache(),
2762
- ],
2763
- }),
2764
- ...options,
2765
- });
2695
+ // 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.
2696
+ function searchClient(appId, apiKey, options) {
2697
+ if (!appId || typeof appId !== 'string') {
2698
+ throw new Error('`appId` is missing.');
2699
+ }
2700
+ if (!apiKey || typeof apiKey !== 'string') {
2701
+ throw new Error('`apiKey` is missing.');
2702
+ }
2703
+ return createSearchClient({
2704
+ appId,
2705
+ apiKey,
2706
+ timeouts: {
2707
+ connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
2708
+ read: DEFAULT_READ_TIMEOUT_BROWSER,
2709
+ write: DEFAULT_WRITE_TIMEOUT_BROWSER,
2710
+ },
2711
+ requester: createXhrRequester(),
2712
+ algoliaAgents: [{ segment: 'Browser' }],
2713
+ authMode: 'WithinQueryParameters',
2714
+ responsesCache: createMemoryCache(),
2715
+ requestsCache: createMemoryCache({ serializable: false }),
2716
+ hostsCache: createFallbackableCache({
2717
+ caches: [
2718
+ createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }),
2719
+ createMemoryCache(),
2720
+ ],
2721
+ }),
2722
+ ...options,
2723
+ });
2766
2724
  }
2767
2725
 
2768
2726
  export { apiClientVersion, searchClient };