@algolia/client-search 5.0.0-alpha.1 → 5.0.0-alpha.100

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