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