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