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