diff --git a/packages/algoliasearch/src/builds/browser.ts b/packages/algoliasearch/src/builds/browser.ts index f8976e59d..0dab73b08 100644 --- a/packages/algoliasearch/src/builds/browser.ts +++ b/packages/algoliasearch/src/builds/browser.ts @@ -45,6 +45,7 @@ import { browseSynonyms, ChunkedBatchResponse, ChunkOptions, + clearDictionaryEntries, clearObjects, clearRules, ClearRulesOptions, @@ -60,6 +61,7 @@ import { DeleteApiKeyResponse, deleteBy, DeleteByFiltersOptions, + deleteDictionaryEntries, deleteIndex, deleteObject, deleteObjects, @@ -67,6 +69,8 @@ import { deleteRule, deleteSynonym, DeleteSynonymOptions, + DictionaryEntry, + DictionarySettings, exists, findAnswers, FindAnswersOptions, @@ -76,6 +80,9 @@ import { FindObjectResponse, getApiKey, GetApiKeyResponse, + getDictionarySettings, + GetDictionarySettingsResponse, + getDictionaryTask, getLogs, GetLogsResponse, getObject, @@ -127,9 +134,13 @@ import { ReplaceAllObjectsOptions, replaceAllRules, replaceAllSynonyms, + replaceDictionaryEntries, restoreApiKey, RestoreApiKeyResponse, Rule, + saveDictionaryEntries, + SaveDictionaryEntriesOptions, + SaveDictionaryEntriesResponse, saveObject, SaveObjectResponse, saveObjects, @@ -146,6 +157,8 @@ import { SaveSynonymsResponse, search, SearchClient as BaseSearchClient, + searchDictionaryEntries, + SearchDictionaryEntriesResponse, searchForFacetValues, SearchForFacetValuesQueryParams, SearchForFacetValuesResponse, @@ -160,14 +173,18 @@ import { searchUserIDs, SearchUserIDsOptions, SearchUserIDsResponse, + setDictionarySettings, + SetDictionarySettingsResponse, setSettings, SetSettingsResponse, Settings, Synonym, + TaskStatusResponse, updateApiKey, UpdateApiKeyOptions, UpdateApiKeyResponse, UserIDResponse, + waitDictionaryTask, waitTask, } from '@algolia/client-search'; import { LogLevelEnum } from '@algolia/logger-common'; @@ -235,6 +252,15 @@ export default function algoliasearch( getTopUserIDs, removeUserID, hasPendingMappings, + clearDictionaryEntries, + deleteDictionaryEntries, + getDictionarySettings, + getDictionaryTask, + replaceDictionaryEntries, + saveDictionaryEntries, + searchDictionaryEntries, + setDictionarySettings, + waitDictionaryTask, initIndex: base => (indexName: string): SearchIndex => { return initIndex(base)(indexName, { methods: { @@ -601,6 +627,41 @@ export type SearchClient = BaseSearchClient & { readonly hasPendingMappings: ( requestOptions?: HasPendingMappingsOptions & RequestOptions ) => Readonly>; + readonly clearDictionaryEntries: ( + dictionary: string, + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly deleteDictionaryEntries: ( + dictionary: string, + objectIDs: readonly string[], + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly replaceDictionaryEntries: ( + dictionary: string, + entries: readonly DictionaryEntry[], + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly saveDictionaryEntries: ( + dictionary: string, + entries: readonly DictionaryEntry[], + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly searchDictionaryEntries: ( + dictionary: string, + query: string, + requestOptions?: RequestOptions + ) => Readonly>; + readonly getDictionarySettings: ( + requestOptions?: RequestOptions + ) => Readonly>; + readonly setDictionarySettings: ( + settings: readonly DictionarySettings[], + requestOptions?: RequestOptions + ) => Readonly>; + readonly getDictionaryTask: ( + taskID: number, + requestOptions?: RequestOptions + ) => Readonly>; readonly initAnalytics: (options?: InitAnalyticsOptions) => AnalyticsClient; readonly initRecommendation: (options?: InitRecommendationOptions) => RecommendationClient; }; diff --git a/packages/algoliasearch/src/builds/node.ts b/packages/algoliasearch/src/builds/node.ts index b1030fd6d..711b82000 100644 --- a/packages/algoliasearch/src/builds/node.ts +++ b/packages/algoliasearch/src/builds/node.ts @@ -44,6 +44,7 @@ import { browseSynonyms, ChunkedBatchResponse, ChunkOptions, + clearDictionaryEntries, clearObjects, clearRules, ClearRulesOptions, @@ -59,6 +60,7 @@ import { DeleteApiKeyResponse, deleteBy, DeleteByFiltersOptions, + deleteDictionaryEntries, deleteIndex, deleteObject, deleteObjects, @@ -66,6 +68,8 @@ import { deleteRule, deleteSynonym, DeleteSynonymOptions, + DictionaryEntry, + DictionarySettings, exists, findAnswers, FindAnswersOptions, @@ -76,6 +80,9 @@ import { generateSecuredApiKey, getApiKey, GetApiKeyResponse, + getDictionarySettings, + GetDictionarySettingsResponse, + getDictionaryTask, getLogs, GetLogsResponse, getObject, @@ -128,9 +135,13 @@ import { ReplaceAllObjectsOptions, replaceAllRules, replaceAllSynonyms, + replaceDictionaryEntries, restoreApiKey, RestoreApiKeyResponse, Rule, + saveDictionaryEntries, + SaveDictionaryEntriesOptions, + SaveDictionaryEntriesResponse, saveObject, SaveObjectResponse, saveObjects, @@ -147,6 +158,8 @@ import { SaveSynonymsResponse, search, SearchClient as BaseSearchClient, + searchDictionaryEntries, + SearchDictionaryEntriesResponse, searchForFacetValues, SearchForFacetValuesQueryParams, SearchForFacetValuesResponse, @@ -162,14 +175,18 @@ import { SearchUserIDsOptions, SearchUserIDsResponse, SecuredApiKeyRestrictions, + setDictionarySettings, + SetDictionarySettingsResponse, setSettings, SetSettingsResponse, Settings, Synonym, + TaskStatusResponse, updateApiKey, UpdateApiKeyOptions, UpdateApiKeyResponse, UserIDResponse, + waitDictionaryTask, waitTask, } from '@algolia/client-search'; import { createNullLogger } from '@algolia/logger-common'; @@ -238,6 +255,15 @@ export default function algoliasearch( generateSecuredApiKey, getSecuredApiKeyRemainingValidity, destroy, + clearDictionaryEntries, + deleteDictionaryEntries, + getDictionarySettings, + getDictionaryTask, + replaceDictionaryEntries, + saveDictionaryEntries, + searchDictionaryEntries, + setDictionarySettings, + waitDictionaryTask, initIndex: base => (indexName: string): SearchIndex => { return initIndex(base)(indexName, { methods: { @@ -609,6 +635,41 @@ export type SearchClient = BaseSearchClient & { restrictions: SecuredApiKeyRestrictions ) => string; readonly getSecuredApiKeyRemainingValidity: (securedApiKey: string) => number; + readonly clearDictionaryEntries: ( + dictionary: string, + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly deleteDictionaryEntries: ( + dictionary: string, + objectIDs: readonly string[], + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly replaceDictionaryEntries: ( + dictionary: string, + entries: readonly DictionaryEntry[], + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly saveDictionaryEntries: ( + dictionary: string, + entries: readonly DictionaryEntry[], + requestOptions?: RequestOptions & SaveDictionaryEntriesOptions + ) => Readonly>; + readonly searchDictionaryEntries: ( + dictionary: string, + query: string, + requestOptions?: RequestOptions + ) => Readonly>; + readonly getDictionarySettings: ( + requestOptions?: RequestOptions + ) => Readonly>; + readonly setDictionarySettings: ( + settings: readonly DictionarySettings[], + requestOptions?: RequestOptions + ) => Readonly>; + readonly getDictionaryTask: ( + taskID: number, + requestOptions?: RequestOptions + ) => Readonly>; readonly initAnalytics: (options?: InitAnalyticsOptions) => AnalyticsClient; readonly initRecommendation: (options?: InitRecommendationOptions) => RecommendationClient; } & Destroyable; diff --git a/packages/client-common/src/__tests__/TestSuite.ts b/packages/client-common/src/__tests__/TestSuite.ts index 8ddbae2c1..8fd2239c9 100644 --- a/packages/client-common/src/__tests__/TestSuite.ts +++ b/packages/client-common/src/__tests__/TestSuite.ts @@ -68,6 +68,13 @@ export class TestSuite { return client; } + public makeDictionarySearchClient( + appIdEnv: string = 'ALGOLIA_APPLICATION_ID_2', + apiKeyEnv: string = 'ALGOLIA_ADMIN_KEY_2' + ) { + return this.makeSearchClient(appIdEnv, apiKeyEnv); + } + public makeRecommendationClient( appIdEnv: string = 'ALGOLIA_APPLICATION_ID_1', apiKeyEnv: string = 'ALGOLIA_ADMIN_KEY_1' diff --git a/packages/client-search/src/methods/client/index.ts b/packages/client-search/src/methods/client/index.ts index c0ed301c0..787a568c6 100644 --- a/packages/client-search/src/methods/client/index.ts +++ b/packages/client-search/src/methods/client/index.ts @@ -5,16 +5,20 @@ export * from './addApiKey'; export * from './assignUserID'; export * from './assignUserIDs'; +export * from './clearDictionaryEntries'; export * from './copyIndex'; export * from './copyRules'; export * from './copySettings'; export * from './copySynonyms'; export * from './deleteApiKey'; +export * from './deleteDictionaryEntries'; export * from './generateSecuredApiKey'; export * from './getApiKey'; +export * from './getDictionarySettings'; export * from './getLogs'; export * from './getSecuredApiKeyRemainingValidity'; export * from './getTopUserIDs'; +export * from './getDictionaryTask'; export * from './getUserID'; export * from './hasPendingMappings'; export * from './initIndex'; @@ -28,6 +32,11 @@ export * from './multipleGetObjects'; export * from './multipleQueries'; export * from './multipleSearchForFacetValues'; export * from './removeUserID'; +export * from './replaceDictionaryEntries'; export * from './restoreApiKey'; +export * from './saveDictionaryEntries'; +export * from './searchDictionaryEntries'; export * from './searchUserIDs'; +export * from './setDictionarySettings'; export * from './updateApiKey'; +export * from './waitDictionaryTask'; diff --git a/packages/client-search/src/types/index.ts b/packages/client-search/src/types/index.ts index 523dfd08e..44d2eb8d2 100644 --- a/packages/client-search/src/types/index.ts +++ b/packages/client-search/src/types/index.ts @@ -24,6 +24,8 @@ export * from './DeleteApiKeyResponse'; export * from './DeleteByFiltersOptions'; export * from './DeleteResponse'; export * from './DeleteSynonymOptions'; +export * from './DictionaryEntry'; +export * from './DictionarySettings'; export * from './FacetHit'; export * from './FindAnswersOptions'; export * from './FindAnswersResponse'; @@ -35,6 +37,7 @@ export * from './GetLogsResponse'; export * from './GetObjectOptions'; export * from './GetObjectsOptions'; export * from './GetObjectsResponse'; +export * from './GetDictionarySettingsResponse'; export * from './GetTopUserIDsResponse'; export * from './HasPendingMappingsOptions'; export * from './HasPendingMappingsResponse'; @@ -61,6 +64,8 @@ export * from './RemoveUserIDResponse'; export * from './ReplaceAllObjectsOptions'; export * from './RestoreApiKeyResponse'; export * from './Rule'; +export * from './SaveDictionaryEntriesOptions'; +export * from './SaveDictionaryEntriesResponse'; export * from './SaveObjectResponse'; export * from './SaveObjectsOptions'; export * from './SaveRuleResponse'; @@ -71,6 +76,7 @@ export * from './SaveSynonymsOptions'; export * from './SaveSynonymsResponse'; export * from './SearchClient'; export * from './SearchClientOptions'; +export * from './SearchDictionaryEntriesResponse'; export * from './SearchForFacetValuesQueryParams'; export * from './SearchForFacetValuesResponse'; export * from './SearchIndex'; @@ -82,6 +88,7 @@ export * from './SearchSynonymsResponse'; export * from './SearchUserIDsOptions'; export * from './SearchUserIDsResponse'; export * from './SecuredApiKeyRestrictions'; +export * from './SetDictionarySettingsResponse'; export * from './SetSettingsOptions'; export * from './SetSettingsResponse'; export * from './Settings';