From 8ee3c61b172fbcff5ae4eab0ad33deec118e49a0 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 15:43:56 +0100 Subject: [PATCH 01/69] chore: provide token to checkout submodule --- .github/workflows/process-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index f011375c58..4189d0682d 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -18,6 +18,7 @@ jobs: with: fetch-depth: 0 submodules: true + token: ${{ secrets.TOKEN_RELEASE_BOT }} - run: git checkout chore/release From c484dc7271fd27b65b331727a9c1aafc8f7c900b Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 16:25:31 +0100 Subject: [PATCH 02/69] chore(ci): remove pipe function --- scripts/release/process-release.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index d8bb376be6..c8a9703dc5 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -73,7 +73,7 @@ const langsToUpdateRepo = getMarkdownSection( const result = line.match(/- \[ \] (.+): v(.+) -> v(.+)/); return result?.[1]; }) - .filter(Boolean); // e.g. ['javascript', 'php'] + .filter(Boolean) as string[]; // e.g. ['javascript', 'php'] // update versions in `openapitools.json` Object.keys(openapitools['generator-cli'].generators).forEach((client) => { @@ -121,15 +121,13 @@ if (process.env.RELEASE_TEST !== 'true') { // generate clients to release Object.keys(versionsToRelease).forEach((lang) => { console.log(`Generating ${lang} client(s)...`); - // @ts-expect-error the library `execa` is not typed correctly - run(`yarn generate ${lang}`).pipe(process.stdout); + console.log(run(`yarn generate ${lang}`)); }); // generate clients to just update the repos langsToUpdateRepo.forEach((lang) => { console.log(`Generating ${lang} client(s)...`); - // @ts-expect-error the library `execa` is not typed correctly - run(`yarn generate ${lang}`).pipe(process.stdout); + console.log(run(`yarn generate ${lang}`)); }); const clientPath = path.resolve( From cac59d5af6a3cdff7969541d125466eb1608b917 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 16:31:49 +0100 Subject: [PATCH 03/69] chore(ci): set author identity --- scripts/release/process-release.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index c8a9703dc5..bbe1550e7c 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -108,10 +108,11 @@ new Set([...Object.keys(versionsToRelease), ...langsToUpdateRepo]).forEach( } ); +run('git config user.name "api-clients-bot"'); +run('git config user.email "bot@algolia.com"'); + // commit openapitools and changelogs if (process.env.RELEASE_TEST !== 'true') { - run('git config user.name "api-clients-bot"'); - run('git config user.email "bot@algolia.com"'); run('git add openapitools.json'); run('git add doc/changelogs/*'); execa.sync('git', ['commit', '-m', TEXT.commitMessage]); From 4b87271010f004836d77bfa807d7c40e86a93b2d Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 16:40:50 +0100 Subject: [PATCH 04/69] chore(ci): set git config globally --- scripts/release/process-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index bbe1550e7c..eb65e0038a 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -108,8 +108,8 @@ new Set([...Object.keys(versionsToRelease), ...langsToUpdateRepo]).forEach( } ); -run('git config user.name "api-clients-bot"'); -run('git config user.email "bot@algolia.com"'); +run('git config --global user.name "api-clients-bot"'); +run('git config --global user.email "bot@algolia.com"'); // commit openapitools and changelogs if (process.env.RELEASE_TEST !== 'true') { From f5d56631edf2cf9f53204dd2a15bdf0c0e36eef3 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 17:04:53 +0100 Subject: [PATCH 05/69] chore(ci): update monorepo after submodule changes --- scripts/release/process-release.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index eb65e0038a..355cbb538e 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -116,7 +116,7 @@ if (process.env.RELEASE_TEST !== 'true') { run('git add openapitools.json'); run('git add doc/changelogs/*'); execa.sync('git', ['commit', '-m', TEXT.commitMessage]); - run(`git push origin ${MAIN_BRANCH}`); + run(`git push`); } // generate clients to release @@ -135,18 +135,17 @@ const clientPath = path.resolve( ROOT_DIR, 'clients/dummy-algoliasearch-client-javascript' ); -const runInClient: Run = (command, options = {}) => - runOriginal(command, { - cwd: clientPath, - ...options, - }); -runInClient(`git checkout next`); +run(`git checkout next`, { cwd: clientPath }); run( - `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript` + `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript/` ); -runInClient(`git add .`); +run(`git add .`, { cwd: clientPath }); execa.sync('git', ['commit', '-m', 'chore: release test'], { cwd: clientPath, }); -runInClient(`git push origin next`); +run(`git push origin next`, { cwd: clientPath }); + +run(`git add clients/dummy-algoliasearch-client-javascript`); +execa.sync('git', ['commit', '-m', 'chore: update submodules']); +run(`git push`); From 31d4cf6fe8fc649bff1eddf79898d176a9e2760d Mon Sep 17 00:00:00 2001 From: api-clients-bot Date: Wed, 23 Feb 2022 16:11:19 +0000 Subject: [PATCH 06/69] chore: update submodules --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index 04ec6e52f8..9a10ff5fab 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 04ec6e52f8cd58c5abc6c71c7fb19a652b597e8b +Subproject commit 9a10ff5fabf1960b4306200275f2268569d1a1b1 From 7ea9c6ca7ef639d9513195dc99f0cf9ff083b98b Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 17:17:42 +0100 Subject: [PATCH 07/69] chore(ci): fix copy path --- scripts/release/process-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 355cbb538e..644998a984 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -138,7 +138,7 @@ const clientPath = path.resolve( run(`git checkout next`, { cwd: clientPath }); run( - `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript/` + `cp -r clients/algoliasearch-client-javascript clients/dummy-algoliasearch-client-javascript` ); run(`git add .`, { cwd: clientPath }); execa.sync('git', ['commit', '-m', 'chore: release test'], { From 68d89fe991953cf9661ab07969a305e114d6597f Mon Sep 17 00:00:00 2001 From: api-clients-bot Date: Wed, 23 Feb 2022 16:33:09 +0000 Subject: [PATCH 08/69] chore: update submodules --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index 9a10ff5fab..5407f84981 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 9a10ff5fabf1960b4306200275f2268569d1a1b1 +Subproject commit 5407f84981b495dd08401fd19ff6569232d1c9fa From cc420682a5f553d8ff36dd9a14af8e496e349b6b Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 17:43:04 +0100 Subject: [PATCH 09/69] chore: update submodule --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index 9a10ff5fab..dbe2f2f79d 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 9a10ff5fabf1960b4306200275f2268569d1a1b1 +Subproject commit dbe2f2f79d9b09748c39687ab6b691dad2e9116b From 1549109e9d9d04fc97f059b0828e825c6b4fb0f1 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 17:45:48 +0100 Subject: [PATCH 10/69] chore(ci): fix copy command --- scripts/release/process-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 644998a984..2628d771e6 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -138,7 +138,7 @@ const clientPath = path.resolve( run(`git checkout next`, { cwd: clientPath }); run( - `cp -r clients/algoliasearch-client-javascript clients/dummy-algoliasearch-client-javascript` + `cp -r clients/algoliasearch-client-javascript/* clients/dummy-algoliasearch-client-javascript/` ); run(`git add .`, { cwd: clientPath }); execa.sync('git', ['commit', '-m', 'chore: release test'], { From 58e83d40ed33e3644f86ef13104b1bd16293e2f7 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 23 Feb 2022 18:02:59 +0100 Subject: [PATCH 11/69] chore(ci): fix copy --- scripts/release/process-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 2628d771e6..355cbb538e 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -138,7 +138,7 @@ const clientPath = path.resolve( run(`git checkout next`, { cwd: clientPath }); run( - `cp -r clients/algoliasearch-client-javascript/* clients/dummy-algoliasearch-client-javascript/` + `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript/` ); run(`git add .`, { cwd: clientPath }); execa.sync('git', ['commit', '-m', 'chore: release test'], { From 7ec4043c6f1e19bb1086fe76720b75b2edf2750e Mon Sep 17 00:00:00 2001 From: api-clients-bot Date: Wed, 23 Feb 2022 17:08:38 +0000 Subject: [PATCH 12/69] chore: update submodules --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index dbe2f2f79d..abcde7b1dc 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit dbe2f2f79d9b09748c39687ab6b691dad2e9116b +Subproject commit abcde7b1dcaaf6353daee6386fa28ff73d26dfa1 From 44e563d46a8f5ad1727e9deec6b1c19300a14f61 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Thu, 24 Feb 2022 10:40:40 +0100 Subject: [PATCH 13/69] chore(ci): fix copy command --- scripts/release/process-release.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 355cbb538e..cd5405d651 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -138,7 +138,8 @@ const clientPath = path.resolve( run(`git checkout next`, { cwd: clientPath }); run( - `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript/` + `cp -r clients/algoliasearch-client-javascript/* clients/dummy-algoliasearch-client-javascript/`, + { shell: true } ); run(`git add .`, { cwd: clientPath }); execa.sync('git', ['commit', '-m', 'chore: release test'], { From 5b84a784912f07094cbb4e669390e4eb152e3cae Mon Sep 17 00:00:00 2001 From: api-clients-bot Date: Thu, 24 Feb 2022 09:50:00 +0000 Subject: [PATCH 14/69] chore: update submodules --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index abcde7b1dc..a97d5e1436 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit abcde7b1dcaaf6353daee6386fa28ff73d26dfa1 +Subproject commit a97d5e143622e8803b021737824fcc14cfd03cd7 From a00d022accd291ae6666952a0f731762fc7b836f Mon Sep 17 00:00:00 2001 From: api-clients-bot Date: Thu, 24 Feb 2022 10:08:02 +0000 Subject: [PATCH 15/69] chore: update submodules --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index a97d5e1436..00ed98b964 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit a97d5e143622e8803b021737824fcc14cfd03cd7 +Subproject commit 00ed98b964080a5dd1b7eb287e777106152b9ce2 From ad4d9527f7230f15f5b551937bb219c277e85515 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Thu, 24 Feb 2022 15:17:01 +0100 Subject: [PATCH 16/69] chore(ci): update script --- clients/dummy-algoliasearch-client-javascript | 2 +- scripts/release/process-release.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index 00ed98b964..c205c62f37 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 00ed98b964080a5dd1b7eb287e777106152b9ce2 +Subproject commit c205c62f37eeb8757f7564fa8d55b2f9567814d7 diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index cd5405d651..3c58487c46 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -137,6 +137,7 @@ const clientPath = path.resolve( ); run(`git checkout next`, { cwd: clientPath }); +run(`git pull origin next`, { cwd: clientPath }); run( `cp -r clients/algoliasearch-client-javascript/* clients/dummy-algoliasearch-client-javascript/`, { shell: true } From ac978cf3eb7f50dd241b079d2f2927c8cbf2bfac Mon Sep 17 00:00:00 2001 From: api-clients-bot Date: Thu, 24 Feb 2022 14:24:03 +0000 Subject: [PATCH 17/69] chore: update submodules --- clients/dummy-algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript index c205c62f37..293935056c 160000 --- a/clients/dummy-algoliasearch-client-javascript +++ b/clients/dummy-algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit c205c62f37eeb8757f7564fa8d55b2f9567814d7 +Subproject commit 293935056c524c1a6dbb6b2875dd2fb19051f4fc From 6c0fc7c2d770585e53a80540b014b407ec82a379 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Fri, 25 Feb 2022 15:05:33 +0100 Subject: [PATCH 18/69] chore: remove dummy submodule --- .gitmodules | 3 --- clients/dummy-algoliasearch-client-javascript | 1 - 2 files changed, 4 deletions(-) delete mode 160000 clients/dummy-algoliasearch-client-javascript diff --git a/.gitmodules b/.gitmodules index bed8e2ba28..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "clients/dummy-algoliasearch-client-javascript"] - path = clients/dummy-algoliasearch-client-javascript - url = git@github.com:algolia/dummy-js-client.git \ No newline at end of file diff --git a/clients/dummy-algoliasearch-client-javascript b/clients/dummy-algoliasearch-client-javascript deleted file mode 160000 index 293935056c..0000000000 --- a/clients/dummy-algoliasearch-client-javascript +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 293935056c524c1a6dbb6b2875dd2fb19051f4fc From e0d11d033f8ff1614dbdbeb071a9a3250a49915a Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Fri, 25 Feb 2022 15:06:43 +0100 Subject: [PATCH 19/69] chore: remove generated clients --- .../algoliasearch-client-java-2/.gitignore | 20 - .../.openapi-generator-ignore | 25 - .../com/algolia/ApiCallback.java | 55 - .../com/algolia/ApiClient.java | 776 --- .../com/algolia/ApiException.java | 103 - .../com/algolia/ApiResponse.java | 51 - .../algoliasearch-core/com/algolia/JSON.java | 813 --- .../algoliasearch-core/com/algolia/Pair.java | 48 - .../com/algolia/ProgressRequestBody.java | 61 - .../com/algolia/ProgressResponseBody.java | 59 - .../com/algolia/model/Action.java | 64 - .../com/algolia/model/AddApiKeyResponse.java | 95 - .../com/algolia/model/Anchoring.java | 61 - .../com/algolia/model/ApiKey.java | 363 - .../com/algolia/model/AssignUserIdParams.java | 66 - .../algolia/model/AutomaticFacetFilter.java | 119 - .../com/algolia/model/BaseBrowseResponse.java | 67 - .../com/algolia/model/BaseIndexSettings.java | 494 -- .../com/algolia/model/BaseSearchParams.java | 1050 --- .../com/algolia/model/BaseSearchResponse.java | 741 -- .../model/BaseSearchResponseFacetsStats.java | 140 - .../model/BatchAssignUserIdsParams.java | 99 - .../model/BatchDictionaryEntriesParams.java | 113 - .../model/BatchDictionaryEntriesRequest.java | 92 - .../com/algolia/model/BatchParams.java | 76 - .../com/algolia/model/BatchResponse.java | 105 - .../com/algolia/model/BatchWriteParams.java | 76 - .../com/algolia/model/BrowseRequest.java | 93 - .../com/algolia/model/BrowseResponse.java | 785 --- .../com/algolia/model/BuiltInOperation.java | 163 - .../com/algolia/model/Condition.java | 146 - .../com/algolia/model/Consequence.java | 189 - .../com/algolia/model/ConsequenceHide.java | 66 - .../com/algolia/model/ConsequenceParams.java | 3018 -------- .../com/algolia/model/CreatedAtObject.java | 69 - .../com/algolia/model/CreatedAtResponse.java | 69 - .../algolia/model/DeleteApiKeyResponse.java | 69 - .../algolia/model/DeleteSourceResponse.java | 69 - .../com/algolia/model/DeletedAtResponse.java | 95 - .../com/algolia/model/DictionaryAction.java | 57 - .../com/algolia/model/DictionaryEntry.java | 220 - .../algolia/model/DictionaryEntryState.java | 57 - .../com/algolia/model/DictionaryLanguage.java | 73 - .../model/DictionarySettingsParams.java | 76 - .../com/algolia/model/ErrorBase.java | 68 - .../model/GetDictionarySettingsResponse.java | 76 - .../com/algolia/model/GetLogsResponse.java | 73 - .../model/GetLogsResponseInnerQueries.java | 122 - .../algolia/model/GetLogsResponseLogs.java | 464 -- .../com/algolia/model/GetObjectsParams.java | 78 - .../com/algolia/model/GetObjectsResponse.java | 76 - .../com/algolia/model/GetTaskResponse.java | 120 - .../algolia/model/GetTopUserIdsResponse.java | 78 - .../com/algolia/model/HighlightResult.java | 216 - .../com/algolia/model/Hit.java | 186 - .../com/algolia/model/IndexSettings.java | 2320 ------- .../model/IndexSettingsAsSearchParams.java | 1960 ------ .../com/algolia/model/Indice.java | 347 - .../com/algolia/model/Key.java | 388 -- .../com/algolia/model/Languages.java | 122 - .../algolia/model/ListApiKeysResponse.java | 73 - .../algolia/model/ListClustersResponse.java | 73 - .../algolia/model/ListIndicesResponse.java | 102 - .../algolia/model/ListUserIdsResponse.java | 73 - .../algolia/model/MultipleBatchResponse.java | 105 - .../model/MultipleGetObjectsParams.java | 139 - .../com/algolia/model/MultipleQueries.java | 167 - .../algolia/model/MultipleQueriesParams.java | 99 - .../model/MultipleQueriesResponse.java | 76 - .../model/MultipleQueriesStrategy.java | 57 - .../algolia/model/MultipleQueriesType.java | 57 - .../com/algolia/model/OneOfintegerstring.java | 3 - .../model/OneOfstringbuiltInOperation.java | 20 - .../com/algolia/model/Operation.java | 119 - .../algolia/model/OperationIndexParams.java | 133 - .../com/algolia/model/OperationType.java | 56 - .../com/algolia/model/Params.java | 163 - .../com/algolia/model/Promote.java | 131 - .../com/algolia/model/RankingInfo.java | 360 - .../model/RankingInfoMatchedGeoLocation.java | 116 - .../algolia/model/RemoveUserIdResponse.java | 69 - .../algolia/model/ReplaceSourceResponse.java | 69 - .../algolia/model/RequiredSearchParams.java | 66 - .../com/algolia/model/Rule.java | 226 - .../com/algolia/model/SaveObjectResponse.java | 119 - .../algolia/model/SaveSynonymResponse.java | 119 - .../com/algolia/model/ScopeType.java | 56 - .../model/SearchDictionaryEntriesParams.java | 146 - .../model/SearchForFacetValuesRequest.java | 126 - .../model/SearchForFacetValuesResponse.java | 85 - ...SearchForFacetValuesResponseFacetHits.java | 123 - .../com/algolia/model/SearchHits.java | 76 - .../com/algolia/model/SearchParams.java | 2913 -------- .../com/algolia/model/SearchParamsObject.java | 2945 -------- .../com/algolia/model/SearchParamsString.java | 66 - .../com/algolia/model/SearchResponse.java | 759 -- .../com/algolia/model/SearchRulesParams.java | 240 - .../algolia/model/SearchRulesResponse.java | 147 - .../algolia/model/SearchSynonymsResponse.java | 102 - .../algolia/model/SearchUserIdsParams.java | 147 - .../algolia/model/SearchUserIdsResponse.java | 177 - .../SearchUserIdsResponseHighlightResult.java | 103 - .../model/SearchUserIdsResponseHits.java | 211 - .../com/algolia/model/SnippetResult.java | 152 - .../com/algolia/model/Source.java | 95 - .../com/algolia/model/StandardEntries.java | 151 - .../com/algolia/model/SynonymHit.java | 308 - .../model/SynonymHitHighlightResult.java | 104 - .../com/algolia/model/SynonymType.java | 62 - .../com/algolia/model/TimeRange.java | 92 - .../algolia/model/UpdateApiKeyResponse.java | 95 - .../com/algolia/model/UpdatedAtResponse.java | 95 - .../model/UpdatedAtWithObjectIdResponse.java | 119 - .../algolia/model/UpdatedRuleResponse.java | 119 - .../com/algolia/model/UserId.java | 146 - .../com/algolia/search/SearchApi.java | 6103 ----------------- .../com/algolia/utils/HttpRequester.java | 107 - .../com/algolia/utils/Requester.java | 61 - .../com/algolia/utils/echo/CallEcho.java | 53 - .../com/algolia/utils/echo/EchoRequester.java | 34 - .../com/algolia/utils/echo/EchoResponse.java | 1571 ----- .../utils/echo/EchoResponseInterface.java | 14 - .../algoliasearch-client-java-2/build.gradle | 41 - .../settings.gradle | 1 - .../.gitignore | 10 - .../algoliasearch-client-javascript/.nvmrc | 1 - .../algoliasearch-client-javascript/README.md | 30 - .../bundlesize.config.json | 52 - .../package.json | 38 - .../packages/algoliasearch/builds/browser.ts | 84 - .../packages/algoliasearch/builds/node.ts | 83 - .../packages/algoliasearch/index.d.ts | 2 - .../packages/algoliasearch/index.js | 2 - .../packages/algoliasearch/package.json | 35 - .../packages/algoliasearch/tsconfig.json | 8 - .../.openapi-generator-ignore | 9 - .../client-abtesting/builds/browser.ts | 37 - .../packages/client-abtesting/builds/node.ts | 36 - .../packages/client-abtesting/index.d.ts | 2 - .../packages/client-abtesting/index.js | 2 - .../packages/client-abtesting/model/aBTest.ts | 36 - .../client-abtesting/model/aBTestResponse.ts | 14 - .../client-abtesting/model/abTestsVariant.ts | 14 - .../model/abTestsVariantSearchParams.ts | 4 - .../model/addABTestsRequest.ts | 16 - .../model/addABTestsVariant.ts | 4 - .../model/customSearchParams.ts | 3 - .../client-abtesting/model/errorBase.ts | 6 - .../model/listABTestsResponse.ts | 16 - .../client-abtesting/model/variant.ts | 50 - .../packages/client-abtesting/package.json | 29 - .../client-abtesting/src/abtestingApi.ts | 277 - .../packages/client-abtesting/tsconfig.json | 8 - .../.openapi-generator-ignore | 9 - .../client-analytics/builds/browser.ts | 37 - .../packages/client-analytics/builds/node.ts | 36 - .../packages/client-analytics/index.d.ts | 2 - .../packages/client-analytics/index.js | 2 - .../client-analytics/model/errorBase.ts | 6 - .../model/getAverageClickPositionResponse.ts | 16 - .../getAverageClickPositionResponseDates.ts | 14 - .../model/getClickPositionsResponse.ts | 8 - .../getClickPositionsResponsePositions.ts | 10 - .../model/getClickThroughRateResponse.ts | 20 - .../model/getClickThroughRateResponseDates.ts | 18 - .../model/getConversationRateResponse.ts | 20 - .../model/getConversationRateResponseDates.ts | 18 - .../model/getNoClickRateResponse.ts | 20 - .../model/getNoClickRateResponseDates.ts | 18 - .../model/getNoResultsRateResponse.ts | 20 - .../model/getNoResultsRateResponseDates.ts | 18 - .../model/getSearchesCountResponse.ts | 12 - .../model/getSearchesCountResponseDates.ts | 10 - .../model/getSearchesNoClicksResponse.ts | 8 - .../getSearchesNoClicksResponseSearches.ts | 14 - .../model/getSearchesNoResultsResponse.ts | 8 - .../getSearchesNoResultsResponseSearches.ts | 14 - .../model/getStatusResponse.ts | 6 - .../model/getTopCountriesResponse.ts | 8 - .../model/getTopCountriesResponseCountries.ts | 10 - .../model/getTopFilterAttribute.ts | 10 - .../model/getTopFilterAttributesResponse.ts | 8 - .../model/getTopFilterForAttribute.ts | 18 - .../model/getTopFilterForAttributeResponse.ts | 8 - .../model/getTopFiltersNoResultsResponse.ts | 8 - .../model/getTopFiltersNoResultsValue.ts | 14 - .../model/getTopFiltersNoResultsValues.ts | 12 - .../model/getTopHitsResponse.ts | 8 - .../model/getTopHitsResponseHits.ts | 10 - .../model/getTopHitsResponseWithAnalytics.ts | 8 - .../getTopHitsResponseWithAnalyticsHits.ts | 30 - .../model/getTopSearchesResponse.ts | 8 - .../getTopSearchesResponseWithAnalytics.ts | 8 - ...opSearchesResponseWithAnalyticsSearches.ts | 38 - .../model/getUsersCountResponse.ts | 12 - .../packages/client-analytics/package.json | 29 - .../client-analytics/src/analyticsApi.ts | 1553 ----- .../packages/client-analytics/tsconfig.json | 8 - .../packages/client-common/index.ts | 12 - .../packages/client-common/package.json | 21 - .../packages/client-common/src/Response.ts | 23 - .../packages/client-common/src/createAuth.ts | 25 - .../client-common/src/createEchoRequester.ts | 44 - .../client-common/src/createMemoryCache.ts | 41 - .../client-common/src/createStatefulHost.ts | 22 - .../client-common/src/createTransporter.ts | 226 - .../client-common/src/createUserAgent.ts | 20 - .../packages/client-common/src/errors.ts | 38 - .../client-common/src/getUserAgent.ts | 23 - .../packages/client-common/src/helpers.ts | 116 - .../packages/client-common/src/stackTrace.ts | 30 - .../packages/client-common/src/types/Cache.ts | 27 - .../client-common/src/types/CreateClient.ts | 15 - .../packages/client-common/src/types/Host.ts | 12 - .../client-common/src/types/Requester.ts | 40 - .../client-common/src/types/Transporter.ts | 162 - .../packages/client-common/src/types/index.ts | 5 - .../packages/client-common/tsconfig.json | 8 - .../client-insights/.openapi-generator-ignore | 9 - .../client-insights/builds/browser.ts | 37 - .../packages/client-insights/builds/node.ts | 36 - .../packages/client-insights/index.d.ts | 2 - .../packages/client-insights/index.js | 2 - .../client-insights/model/errorBase.ts | 6 - .../client-insights/model/insightEvent.ts | 43 - .../client-insights/model/insightEvents.ts | 11 - .../model/pushEventsResponse.ts | 6 - .../packages/client-insights/package.json | 29 - .../client-insights/src/insightsApi.ts | 99 - .../packages/client-insights/tsconfig.json | 8 - .../.openapi-generator-ignore | 9 - .../client-personalization/builds/browser.ts | 41 - .../client-personalization/builds/node.ts | 40 - .../client-personalization/index.d.ts | 2 - .../packages/client-personalization/index.js | 2 - .../model/deleteUserProfileResponse.ts | 10 - .../client-personalization/model/errorBase.ts | 6 - .../model/eventScoring.ts | 14 - .../model/facetScoring.ts | 10 - .../model/getUserTokenResponse.ts | 14 - .../model/personalizationStrategyParams.ts | 17 - .../setPersonalizationStrategyResponse.ts | 6 - .../client-personalization/package.json | 29 - .../src/personalizationApi.ts | 218 - .../client-personalization/tsconfig.json | 8 - .../client-predict/.openapi-generator-ignore | 9 - .../packages/client-predict/builds/browser.ts | 35 - .../packages/client-predict/builds/node.ts | 34 - .../packages/client-predict/index.d.ts | 2 - .../packages/client-predict/index.js | 2 - .../client-predict/model/affinities.ts | 5 - .../client-predict/model/errorBase.ts | 6 - .../model/fetchUserProfileResponse.ts | 10 - .../client-predict/model/funnelStage.ts | 4 - .../packages/client-predict/model/params.ts | 20 - .../client-predict/model/predictions.ts | 9 - .../model/predictionsAffinities.ts | 9 - .../model/predictionsFunnelStage.ts | 9 - .../model/predictionsOrderValue.ts | 7 - .../client-predict/model/properties.ts | 17 - .../packages/client-predict/model/segments.ts | 13 - .../packages/client-predict/package.json | 29 - .../packages/client-predict/src/predictApi.ts | 107 - .../packages/client-predict/tsconfig.json | 8 - .../.openapi-generator-ignore | 9 - .../builds/browser.ts | 41 - .../client-query-suggestions/builds/node.ts | 40 - .../client-query-suggestions/index.d.ts | 2 - .../client-query-suggestions/index.js | 2 - .../model/errorBase.ts | 6 - .../model/indexName.ts | 6 - .../client-query-suggestions/model/logFile.ts | 20 - .../model/querySuggestionsIndex.ts | 20 - .../model/querySuggestionsIndexParam.ts | 16 - .../querySuggestionsIndexWithIndexParam.ts | 5 - .../model/sourceIndex.ts | 32 - .../model/sourceIndexExternal.ts | 10 - .../model/sourceIndiceWithReplicas.ts | 39 - .../client-query-suggestions/model/status.ts | 14 - .../model/sucessResponse.ts | 10 - .../client-query-suggestions/package.json | 29 - .../src/querySuggestionsApi.ts | 344 - .../client-query-suggestions/tsconfig.json | 8 - .../client-search/.openapi-generator-ignore | 9 - .../packages/client-search/builds/browser.ts | 35 - .../packages/client-search/builds/node.ts | 34 - .../packages/client-search/index.d.ts | 2 - .../packages/client-search/index.js | 2 - .../packages/client-search/model/action.ts | 12 - .../client-search/model/addApiKeyResponse.ts | 10 - .../packages/client-search/model/anchoring.ts | 5 - .../packages/client-search/model/apiKey.ts | 53 - .../client-search/model/assignUserIdParams.ts | 9 - .../model/automaticFacetFilter.ts | 17 - .../client-search/model/baseBrowseResponse.ts | 6 - .../client-search/model/baseIndexSettings.ts | 50 - .../client-search/model/baseSearchParams.ts | 130 - .../client-search/model/baseSearchResponse.ts | 100 - .../model/baseSearchResponseFacetsStats.ts | 18 - .../model/batchAssignUserIdsParams.ts | 13 - .../model/batchDictionaryEntriesParams.ts | 15 - .../model/batchDictionaryEntriesRequest.ts | 7 - .../client-search/model/batchParams.ts | 8 - .../client-search/model/batchResponse.ts | 10 - .../client-search/model/batchWriteParams.ts | 8 - .../client-search/model/browseRequest.ts | 10 - .../client-search/model/browseResponse.ts | 7 - .../client-search/model/builtInOperation.ts | 22 - .../packages/client-search/model/condition.ts | 17 - .../client-search/model/consequence.ts | 26 - .../client-search/model/consequenceHide.ts | 9 - .../client-search/model/consequenceParams.ts | 7 - .../client-search/model/createdAtObject.ts | 6 - .../client-search/model/createdAtResponse.ts | 9 - .../model/deleteApiKeyResponse.ts | 6 - .../model/deleteSourceResponse.ts | 6 - .../client-search/model/deletedAtResponse.ts | 13 - .../client-search/model/dictionaryAction.ts | 5 - .../client-search/model/dictionaryEntry.ts | 28 - .../model/dictionaryEntryState.ts | 5 - .../client-search/model/dictionaryLanguage.ts | 9 - .../model/dictionarySettingsParams.ts | 8 - .../packages/client-search/model/errorBase.ts | 6 - .../model/getDictionarySettingsResponse.ts | 5 - .../client-search/model/getLogsResponse.ts | 5 - .../model/getLogsResponseInnerQueries.ts | 14 - .../model/getLogsResponseLogs.ts | 64 - .../client-search/model/getObjectsParams.ts | 8 - .../client-search/model/getObjectsResponse.ts | 6 - .../client-search/model/getTaskResponse.ts | 5 - .../model/getTopUserIdsResponse.ts | 11 - .../client-search/model/highlightResult.ts | 23 - .../packages/client-search/model/hit.ts | 17 - .../client-search/model/indexSettings.ts | 4 - .../model/indexSettingsAsSearchParams.ts | 209 - .../packages/client-search/model/indice.ts | 46 - .../packages/client-search/model/key.ts | 4 - .../packages/client-search/model/languages.ts | 10 - .../model/listApiKeysResponse.ts | 8 - .../model/listClustersResponse.ts | 9 - .../model/listIndicesResponse.ts | 12 - .../model/listUserIdsResponse.ts | 11 - .../model/multipleBatchResponse.ts | 10 - .../model/multipleGetObjectsParams.ts | 17 - .../client-search/model/multipleQueries.ts | 21 - .../model/multipleQueriesParams.ts | 7 - .../model/multipleQueriesResponse.ts | 5 - .../model/multipleQueriesStrategy.ts | 1 - .../model/multipleQueriesType.ts | 5 - .../packages/client-search/model/operation.ts | 13 - .../model/operationIndexParams.ts | 14 - .../client-search/model/operationType.ts | 5 - .../packages/client-search/model/params.ts | 19 - .../packages/client-search/model/promote.ts | 17 - .../client-search/model/rankingInfo.ts | 45 - .../model/rankingInfoMatchedGeoLocation.ts | 14 - .../model/removeUserIdResponse.ts | 6 - .../model/replaceSourceResponse.ts | 6 - .../model/requiredSearchParams.ts | 6 - .../packages/client-search/model/rule.ts | 30 - .../client-search/model/saveObjectResponse.ts | 11 - .../model/saveSynonymResponse.ts | 14 - .../packages/client-search/model/scopeType.ts | 1 - .../model/searchDictionaryEntriesParams.ts | 21 - .../model/searchForFacetValuesRequest.ts | 14 - .../model/searchForFacetValuesResponse.ts | 5 - .../searchForFacetValuesResponseFacetHits.ts | 14 - .../client-search/model/searchHits.ts | 5 - .../client-search/model/searchParams.ts | 4 - .../client-search/model/searchParamsObject.ts | 7 - .../client-search/model/searchParamsString.ts | 6 - .../client-search/model/searchResponse.ts | 4 - .../client-search/model/searchRulesParams.ts | 32 - .../model/searchRulesResponse.ts | 20 - .../model/searchSynonymsResponse.ts | 12 - .../model/searchUserIdsParams.ts | 21 - .../model/searchUserIdsResponse.ts | 27 - .../searchUserIdsResponseHighlightResult.ts | 6 - .../model/searchUserIdsResponseHits.ts | 25 - .../client-search/model/snippetResult.ts | 12 - .../packages/client-search/model/source.ts | 13 - .../client-search/model/standardEntries.ts | 17 - .../client-search/model/synonymHit.ts | 38 - .../model/synonymHitHighlightResult.ts | 9 - .../client-search/model/synonymType.ts | 10 - .../packages/client-search/model/timeRange.ts | 10 - .../model/updateApiKeyResponse.ts | 10 - .../client-search/model/updatedAtResponse.ts | 13 - .../model/updatedAtWithObjectIdResponse.ts | 17 - .../model/updatedRuleResponse.ts | 14 - .../packages/client-search/model/userId.ts | 21 - .../packages/client-search/package.json | 29 - .../packages/client-search/src/searchApi.ts | 2932 -------- .../packages/client-search/tsconfig.json | 8 - .../client-sources/.openapi-generator-ignore | 9 - .../packages/client-sources/builds/browser.ts | 41 - .../packages/client-sources/builds/node.ts | 40 - .../packages/client-sources/index.d.ts | 2 - .../packages/client-sources/index.js | 2 - .../client-sources/model/errorBase.ts | 6 - .../model/postIngestUrlResponse.ts | 5 - .../client-sources/model/postURLJob.ts | 20 - .../client-sources/model/postURLJobAuth.ts | 19 - .../client-sources/model/postURLJobInput.ts | 18 - .../client-sources/model/postURLJobTarget.ts | 21 - .../packages/client-sources/model/task.ts | 15 - .../packages/client-sources/package.json | 29 - .../packages/client-sources/src/sourcesApi.ts | 107 - .../packages/client-sources/tsconfig.json | 8 - .../recommend/.openapi-generator-ignore | 9 - .../packages/recommend/builds/browser.ts | 35 - .../packages/recommend/builds/node.ts | 34 - .../packages/recommend/index.d.ts | 2 - .../packages/recommend/index.js | 2 - .../recommend/model/baseSearchParams.ts | 130 - .../recommend/model/baseSearchResponse.ts | 100 - .../model/baseSearchResponseFacetsStats.ts | 18 - .../packages/recommend/model/errorBase.ts | 6 - .../model/getRecommendationsParams.ts | 11 - .../model/getRecommendationsResponse.ts | 5 - .../recommend/model/highlightResult.ts | 23 - .../model/indexSettingsAsSearchParams.ts | 209 - .../packages/recommend/model/rankingInfo.ts | 45 - .../model/rankingInfoMatchedGeoLocation.ts | 14 - .../packages/recommend/model/recommendHit.ts | 21 - .../packages/recommend/model/recommendHits.ts | 5 - .../recommend/model/recommendationRequest.ts | 28 - .../model/recommendationsResponse.ts | 4 - .../recommend/model/requiredSearchParams.ts | 6 - .../packages/recommend/model/searchParams.ts | 7 - .../packages/recommend/model/snippetResult.ts | 12 - .../packages/recommend/package.json | 29 - .../packages/recommend/src/recommendApi.ts | 119 - .../packages/recommend/tsconfig.json | 8 - .../packages/requester-browser-xhr/index.ts | 2 - .../requester-browser-xhr/package.json | 25 - .../src/createXhrRequester.ts | 79 - .../src/echoRequester.ts | 28 - .../requester-browser-xhr/tsconfig.json | 8 - .../packages/requester-node-http/index.ts | 2 - .../packages/requester-node-http/package.json | 24 - .../src/createHttpRequester.ts | 95 - .../requester-node-http/src/echoRequester.ts | 30 - .../requester-node-http/tsconfig.json | 8 - .../rollup.config.js | 249 - .../tsconfig.json | 25 - .../version.js | 1 - clients/algoliasearch-client-php/.gitignore | 13 - .../.openapi-generator-ignore | 17 - .../.php-cs-fixer.php | 63 - .../algoliasearch-client-php/composer.json | 45 - .../algoliasearch-client-php/lib/Algolia.php | 105 - .../lib/Api/AbtestingApi.php | 265 - .../lib/Api/AnalyticsApi.php | 1588 ----- .../lib/Api/InsightsApi.php | 134 - .../lib/Api/PersonalizationApi.php | 212 - .../lib/Api/QuerySuggestionsApi.php | 316 - .../lib/Api/RecommendApi.php | 135 - .../lib/Api/SearchApi.php | 2369 ------- .../lib/ApiException.php | 92 - .../lib/Cache/FileCacheDriver.php | 117 - .../lib/Cache/NullCacheDriver.php | 78 - .../lib/Configuration/AbTestingConfig.php | 7 - .../lib/Configuration/AnalyticsConfig.php | 7 - .../lib/Configuration/ConfigWithRegion.php | 28 - .../lib/Configuration/Configuration.php | 274 - .../lib/Configuration/InsightsConfig.php | 7 - .../Configuration/PersonalizationConfig.php | 7 - .../Configuration/QuerySuggestionsConfig.php | 7 - .../lib/Configuration/RecommendConfig.php | 7 - .../lib/Configuration/SearchConfig.php | 34 - .../lib/Exceptions/AlgoliaException.php | 7 - .../lib/Exceptions/BadRequestException.php | 7 - .../lib/Exceptions/CannotWaitException.php | 7 - .../lib/Exceptions/MissingObjectId.php | 7 - .../lib/Exceptions/NotFoundException.php | 7 - .../Exceptions/ObjectNotFoundException.php | 7 - .../lib/Exceptions/RequestException.php | 22 - .../lib/Exceptions/RetriableException.php | 7 - .../lib/Exceptions/UnreachableException.php | 15 - .../ValidUntilNotFoundException.php | 7 - .../lib/Http/GuzzleHttpClient.php | 62 - .../lib/Http/HttpClientInterface.php | 24 - .../lib/Http/Psr7/BufferStream.php | 141 - .../lib/Http/Psr7/PumpStream.php | 169 - .../lib/Http/Psr7/Request.php | 308 - .../lib/Http/Psr7/Response.php | 314 - .../lib/Http/Psr7/Stream.php | 278 - .../lib/Http/Psr7/Uri.php | 716 -- .../lib/Http/Psr7/UriResolver.php | 227 - .../lib/Http/Psr7/functions.php | 82 - .../lib/Log/DebugLogger.php | 57 - .../lib/ModelInterface.php | 68 - .../lib/ObjectSerializer.php | 355 - .../lib/RequestOptions/RequestOptions.php | 368 - .../RequestOptions/RequestOptionsFactory.php | 134 - .../lib/RetryStrategy/ApiWrapper.php | 263 - .../lib/RetryStrategy/ApiWrapperInterface.php | 12 - .../lib/RetryStrategy/ClusterHosts.php | 152 - .../lib/RetryStrategy/Host.php | 65 - .../lib/RetryStrategy/HostCollection.php | 85 - .../lib/Support/Helpers.php | 62 - .../lib/Support/UserAgent.php | 59 - .../algoliasearch-client-php/phpunit.xml.dist | 8 - 504 files changed, 60962 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/.gitignore delete mode 100644 clients/algoliasearch-client-java-2/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Action.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddApiKeyResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Anchoring.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiKey.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AssignUserIdParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AutomaticFacetFilter.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseBrowseResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchAssignUserIdsParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesRequest.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchWriteParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseRequest.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BuiltInOperation.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Condition.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceHide.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtObject.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteApiKeyResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryAction.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntry.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntryState.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryLanguage.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionarySettingsParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetDictionarySettingsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseInnerQueries.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseLogs.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTaskResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTopUserIdsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Hit.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Indice.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Key.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Languages.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListApiKeysResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListClustersResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListUserIdsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleBatchResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleGetObjectsParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesStrategy.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesType.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationType.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Params.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Promote.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RemoveUserIdResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RequiredSearchParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Rule.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ScopeType.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchDictionaryEntriesParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesRequest.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponseFacetHits.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHighlightResult.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHits.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/StandardEntries.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymType.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/TimeRange.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdateApiKeyResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UserId.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java delete mode 100644 clients/algoliasearch-client-java-2/build.gradle delete mode 100644 clients/algoliasearch-client-java-2/settings.gradle delete mode 100644 clients/algoliasearch-client-javascript/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/.nvmrc delete mode 100644 clients/algoliasearch-client-javascript/README.md delete mode 100644 clients/algoliasearch-client-javascript/bundlesize.config.json delete mode 100644 clients/algoliasearch-client-javascript/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/action.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/key.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/params.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/source.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/rollup.config.js delete mode 100644 clients/algoliasearch-client-javascript/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/version.js delete mode 100644 clients/algoliasearch-client-php/.gitignore delete mode 100644 clients/algoliasearch-client-php/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-php/.php-cs-fixer.php delete mode 100644 clients/algoliasearch-client-php/composer.json delete mode 100644 clients/algoliasearch-client-php/lib/Algolia.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/AbtestingApi.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/InsightsApi.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/RecommendApi.php delete mode 100644 clients/algoliasearch-client-php/lib/Api/SearchApi.php delete mode 100644 clients/algoliasearch-client-php/lib/ApiException.php delete mode 100644 clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php delete mode 100644 clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/AbTestingConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/AnalyticsConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/ConfigWithRegion.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/Configuration.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/PersonalizationConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/QuerySuggestionsConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/RecommendConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/SearchConfig.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/AlgoliaException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/BadRequestException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/CannotWaitException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/MissingObjectId.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/NotFoundException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/ObjectNotFoundException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/RequestException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php delete mode 100644 clients/algoliasearch-client-php/lib/Exceptions/ValidUntilNotFoundException.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/GuzzleHttpClient.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/BufferStream.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/Request.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/Response.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php delete mode 100644 clients/algoliasearch-client-php/lib/Http/Psr7/functions.php delete mode 100644 clients/algoliasearch-client-php/lib/Log/DebugLogger.php delete mode 100644 clients/algoliasearch-client-php/lib/ModelInterface.php delete mode 100644 clients/algoliasearch-client-php/lib/ObjectSerializer.php delete mode 100644 clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php delete mode 100644 clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php delete mode 100644 clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php delete mode 100644 clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php delete mode 100644 clients/algoliasearch-client-php/lib/RetryStrategy/ClusterHosts.php delete mode 100644 clients/algoliasearch-client-php/lib/RetryStrategy/Host.php delete mode 100644 clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php delete mode 100644 clients/algoliasearch-client-php/lib/Support/Helpers.php delete mode 100644 clients/algoliasearch-client-php/lib/Support/UserAgent.php delete mode 100644 clients/algoliasearch-client-php/phpunit.xml.dist diff --git a/clients/algoliasearch-client-java-2/.gitignore b/clients/algoliasearch-client-java-2/.gitignore deleted file mode 100644 index 7cf2ea329d..0000000000 --- a/clients/algoliasearch-client-java-2/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -# build files -**/target -target -.gradle -build - -.openapi-generator diff --git a/clients/algoliasearch-client-java-2/.openapi-generator-ignore b/clients/algoliasearch-client-java-2/.openapi-generator-ignore deleted file mode 100644 index 7b4b7e7ffe..0000000000 --- a/clients/algoliasearch-client-java-2/.openapi-generator-ignore +++ /dev/null @@ -1,25 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -api/** -docs/** -gradle/** -src/** -README.md - -.travis.yml -build.sbt -gradle.properties -git_push.sh -pom.xml -gradle* - -# Selective source file -algoliasearch-core/com/algolia/auth/** -algoliasearch-core/com/algolia/Configuration.java -algoliasearch-core/com/algolia/Server*.java -algoliasearch-core/com/algolia/StringUtil.java -algoliasearch-core/com/algolia/GzipRequestInterceptor.java diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java deleted file mode 100644 index 6b149c2b32..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.algolia; - -import java.util.List; -import java.util.Map; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure( - ApiException e, - int statusCode, - Map> responseHeaders - ); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess( - T result, - int statusCode, - Map> responseHeaders - ); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java deleted file mode 100644 index fe63fb8313..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ /dev/null @@ -1,776 +0,0 @@ -package com.algolia; - -import com.algolia.utils.Requester; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URLEncoder; -import java.text.DateFormat; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.util.*; -import java.util.Map.Entry; -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; - -public class ApiClient { - - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - - private String basePath; - private String appId, apiKey; - - private DateFormat dateFormat; - - private JSON json; - - private Requester requester; - - /* - * Constructor for ApiClient with custom Requester - */ - public ApiClient(String appId, String apiKey, Requester requester) { - json = new JSON(); - setUserAgent("OpenAPI-Generator/0.1.0/java"); - - this.basePath = "https://" + appId + "-1.algolianet.com"; - this.appId = appId; - this.apiKey = apiKey; - this.requester = requester; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); - return this; - } - - public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - requester.setDebugging(debugging); - return this; - } - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return requester.getConnectTimeout(); - } - - /** - * Sets the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values - * must be between 1 and {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - requester.setConnectTimeout(connectionTimeout); - return this; - } - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return requester.getReadTimeout(); - } - - /** - * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - requester.setReadTimeout(readTimeout); - return this; - } - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return requester.getWriteTimeout(); - } - - /** - * Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - requester.setWriteTimeout(writeTimeout); - return this; - } - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if ( - param instanceof Date || - param instanceof OffsetDateTime || - param instanceof LocalDate - ) { - // Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - *

Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if ( - name == null || - name.isEmpty() || - value == null || - value instanceof Collection - ) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; - } - - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - *

Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs( - String collectionFormat, - String name, - Collection value - ) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString( - String collectionFormat, - Collection value - ) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - - /** - * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; - * charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON - * - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = - "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and the Content-Type - * response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body or - * the Content-Type of the response is not supported. - */ - public T deserialize(Response response, Type returnType) - throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } - - String respBody; - try { - if (response.body() != null) respBody = - response.body().string(); else respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + - contentType + - "\" is not supported for type: " + - returnType, - response.code(), - response.headers().toMultimap(), - respBody - ); - } - } - - /** - * Serialize the given Java object into request body according to the object's class and the - * request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) - throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported" - ); - } - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and data, which is a Java object - * deserialized from response body and would be null when returnType is null. - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) - throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse( - response.code(), - response.headers().toMultimap(), - data - ); - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) - */ - public void executeAsync( - Call call, - final Type returnType, - final ApiCallback callback - ) { - call.enqueue( - new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Call call, Response response) - throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure( - e, - response.code(), - response.headers().toMultimap() - ); - return; - } catch (Exception e) { - callback.onFailure( - new ApiException(e), - response.code(), - response.headers().toMultimap() - ); - return; - } - callback.onSuccess( - result, - response.code(), - response.headers().toMultimap() - ); - } - } - ); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws ApiException If the response has an unsuccessful status code or fail to deserialize the - * response body - */ - public T handleResponse(Response response, Type returnType) - throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap() - ); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap() - ); - } - } - throw new ApiException( - response.message(), - response.code(), - response.headers().toMultimap(), - respBody - ); - } - } - - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and - * "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall( - String path, - String method, - List queryParams, - Object body, - Map headerParams, - ApiCallback callback - ) throws ApiException { - Request request = buildRequest( - path, - method, - queryParams, - body, - headerParams, - callback - ); - - return requester.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and - * "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws ApiException If fail to serialize the request body object - */ - public Request buildRequest( - String path, - String method, - List queryParams, - Object body, - Map headerParams, - ApiCallback callback - ) throws ApiException { - headerParams.put("X-Algolia-Application-Id", this.appId); - headerParams.put("X-Algolia-API-Key", this.apiKey); - - final String url = buildUrl(path, queryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); - } - } else { - reqBody = serialize(body, contentType); - } - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody( - reqBody, - callback - ); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url - .append(escapeString(param.getName())) - .append("=") - .append(escapeString(value)); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams( - Map headerParams, - Request.Builder reqBuilder - ) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header( - header.getKey(), - parameterToString(header.getValue()) - ); - } - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding( - Map formParams - ) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java deleted file mode 100644 index 06c74f5cc5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.algolia; - -import java.util.List; -import java.util.Map; - -public class ApiException extends Exception { - - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders, - String responseBody - ) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException( - String message, - int code, - Map> responseHeaders, - String responseBody - ) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders - ) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException( - int code, - Map> responseHeaders, - String responseBody - ) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException( - int code, - String message, - Map> responseHeaders, - String responseBody - ) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java deleted file mode 100644 index 3826fd0754..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.algolia; - -import java.util.List; -import java.util.Map; - -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ -public class ApiResponse { - - private final int statusCode; - private final Map> headers; - private final T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse( - int statusCode, - Map> headers, - T data - ) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map> getHeaders() { - return headers; - } - - public T getData() { - return data; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java deleted file mode 100644 index 0bfbbc8762..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java +++ /dev/null @@ -1,813 +0,0 @@ -package com.algolia; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.FieldNamingStrategy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.InstanceCreator; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.internal.$Gson$Types; -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.internal.Excluder; -import com.google.gson.internal.LinkedTreeMap; -import com.google.gson.internal.ObjectConstructor; -import com.google.gson.internal.Primitives; -import com.google.gson.internal.bind.MapTypeAdapterFactory; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import io.gsonfire.GsonFireBuilder; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.lang.reflect.Field; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.ParsePosition; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Collections; -import java.util.Date; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.IdentityHashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentHashMap; -import okio.ByteString; - -public class JSON { - - private Gson gson; - private boolean isLenientOnJson = false; - private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - private RetainFieldMapFactory mapAdapter = new RetainFieldMapFactory(); - - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder(); - GsonBuilder builder = fireBuilder.createGsonBuilder(); - return builder; - } - - public JSON() { - gson = - createGson() - .registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - .registerTypeAdapter(byte[].class, byteArrayAdapter) - .registerTypeAdapterFactory(mapAdapter) - .create(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - * @return JSON - */ - public JSON setGson(Gson gson) { - this.gson = gson; - return this; - } - - public JSON setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - return this; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - public T deserialize(String body, Type returnType) { - try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see - // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } - } - - /** Gson TypeAdapter for Byte Array type */ - public class ByteArrayAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } - - @Override - public byte[] read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString.toByteArray(); - } - } - } - - /** Gson TypeAdapter for JSR310 OffsetDateTime type */ - public static class OffsetDateTimeTypeAdapter - extends TypeAdapter { - - private DateTimeFormatter formatter; - - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } - - public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length() - 5) + "Z"; - } - return OffsetDateTime.parse(date, formatter); - } - } - } - - /** Gson TypeAdapter for JSR310 LocalDate type */ - public class LocalDateTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } - - public LocalDateTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } - } - } - - public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - return this; - } - - public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - return this; - } - - /** - * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd" format - * will be used (more efficient than SimpleDateFormat). - */ - public static class SqlDateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public SqlDateTypeAdapter() {} - - public SqlDateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, java.sql.Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = date.toString(); - } - out.value(value); - } - } - - @Override - public java.sql.Date read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return new java.sql.Date(dateFormat.parse(date).getTime()); - } - return new java.sql.Date( - ISO8601Utils.parse(date, new ParsePosition(0)).getTime() - ); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } - } - - /** - * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be used. - */ - public static class DateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public DateTypeAdapter() {} - - public DateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = ISO8601Utils.format(date, true); - } - out.value(value); - } - } - - @Override - public Date read(JsonReader in) throws IOException { - try { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return dateFormat.parse(date); - } - return ISO8601Utils.parse(date, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } catch (IllegalArgumentException e) { - throw new JsonParseException(e); - } - } - } - - public JSON setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - return this; - } - - public JSON setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - return this; - } -} - -// https://stackoverflow.com/questions/21458468/gson-wont-properly-serialise-a-class-that-extends-hashmap -class RetainFieldMapFactory implements TypeAdapterFactory { - - FieldNamingPolicy fieldNamingPolicy = FieldNamingPolicy.IDENTITY; - ConstructorConstructor constructorConstructor = new ConstructorConstructor( - Collections.>emptyMap() - ); - MapTypeAdapterFactory defaultMapFactory = new MapTypeAdapterFactory( - constructorConstructor, - false - ); - ReflectiveFilterMapFieldFactory defaultObjectFactory = new ReflectiveFilterMapFieldFactory( - constructorConstructor, - fieldNamingPolicy, - Excluder.DEFAULT - ); - - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - final TypeAdapter mapAdapter = defaultMapFactory.create(gson, type); - if (mapAdapter != null) { - return (TypeAdapter) new RetainFieldMapAdapter( - mapAdapter, - defaultObjectFactory.create(gson, type) - ); - } - return mapAdapter; - } - - class RetainFieldMapAdapter extends TypeAdapter> { - - TypeAdapter> mapAdapter; - ReflectiveTypeAdapterFactory.Adapter> objectAdapter; - - RetainFieldMapAdapter( - TypeAdapter mapAdapter, - ReflectiveTypeAdapterFactory.Adapter objectAdapter - ) { - this.mapAdapter = mapAdapter; - this.objectAdapter = objectAdapter; - } - - @Override - public void write(final JsonWriter out, Map value) - throws IOException { - if (value == null) { - out.nullValue(); - return; - } - // 1.write object - StringWriter sw = new StringWriter(); - objectAdapter.write(new JsonWriter(sw), value); - - // 2.convert object to a map - Map objectMap = mapAdapter.fromJson(sw.toString()); - - // 3.overwrite fields in object to a copy map - value = new LinkedHashMap(value); - value.putAll(objectMap); - - // 4.write the copy map - mapAdapter.write(out, value); - } - - @Override - public Map read(JsonReader in) throws IOException { - // 1.create map, all key-value retain in map - Map map = mapAdapter.read(in); - - // 2.create object from created map - Map object = objectAdapter.fromJsonTree( - mapAdapter.toJsonTree(map) - ); - - // 3.remove fields in object from map - for (String field : objectAdapter.boundFields.keySet()) { - map.remove(field); - } - // 4.put map to object - object.putAll(map); - return object; - } - } - - static class ReflectiveFilterMapFieldFactory - extends ReflectiveTypeAdapterFactory { - - public ReflectiveFilterMapFieldFactory( - ConstructorConstructor constructorConstructor, - FieldNamingStrategy fieldNamingPolicy, - Excluder excluder - ) { - super(constructorConstructor, fieldNamingPolicy, excluder); - } - - @Override - protected boolean shouldFindFieldInClass( - Class willFindClass, - Class originalRaw - ) { - Class[] endClasses = new Class[] { - Object.class, - HashMap.class, - LinkedHashMap.class, - LinkedTreeMap.class, - Hashtable.class, - TreeMap.class, - ConcurrentHashMap.class, - IdentityHashMap.class, - WeakHashMap.class, - EnumMap.class, - }; - for (Class c : endClasses) { - if (willFindClass == c) return false; - } - - return super.shouldFindFieldInClass(willFindClass, originalRaw); - } - } - - /** - * below code copy from {@link com.google.gson.internal.bind.ReflectiveTypeAdapterFactory} (little - * modify, in source this class is final) Type adapter that reflects over the fields and methods - * of a class. - */ - static class ReflectiveTypeAdapterFactory implements TypeAdapterFactory { - - private final ConstructorConstructor constructorConstructor; - private final FieldNamingStrategy fieldNamingPolicy; - private final Excluder excluder; - - public ReflectiveTypeAdapterFactory( - ConstructorConstructor constructorConstructor, - FieldNamingStrategy fieldNamingPolicy, - Excluder excluder - ) { - this.constructorConstructor = constructorConstructor; - this.fieldNamingPolicy = fieldNamingPolicy; - this.excluder = excluder; - } - - public boolean excludeField(Field f, boolean serialize) { - return ( - !excluder.excludeClass(f.getType(), serialize) && - !excluder.excludeField(f, serialize) - ); - } - - private String getFieldName(Field f) { - SerializedName serializedName = f.getAnnotation(SerializedName.class); - return serializedName == null - ? fieldNamingPolicy.translateName(f) - : serializedName.value(); - } - - public Adapter create(Gson gson, final TypeToken type) { - Class raw = type.getRawType(); - - if (!Object.class.isAssignableFrom(raw)) { - return null; // it's a primitive! - } - - ObjectConstructor constructor = constructorConstructor.get(type); - return new Adapter(constructor, getBoundFields(gson, type, raw)); - } - - private ReflectiveTypeAdapterFactory.BoundField createBoundField( - final Gson context, - final Field field, - final String name, - final TypeToken fieldType, - boolean serialize, - boolean deserialize - ) { - final boolean isPrimitive = Primitives.isPrimitive( - fieldType.getRawType() - ); - - // special casing primitives here saves ~5% on Android... - return new ReflectiveTypeAdapterFactory.BoundField( - name, - serialize, - deserialize - ) { - final TypeAdapter typeAdapter = context.getAdapter(fieldType); - - @SuppressWarnings({ "unchecked", "rawtypes" }) // the type adapter and field type always agree - @Override - void write(JsonWriter writer, Object value) - throws IOException, IllegalAccessException { - Object fieldValue = field.get(value); - TypeAdapter t = new TypeAdapterRuntimeTypeWrapper( - context, - this.typeAdapter, - fieldType.getType() - ); - t.write(writer, fieldValue); - } - - @Override - void read(JsonReader reader, Object value) - throws IOException, IllegalAccessException { - Object fieldValue = typeAdapter.read(reader); - if (fieldValue != null || !isPrimitive) { - field.set(value, fieldValue); - } - } - }; - } - - private Map getBoundFields( - Gson context, - TypeToken type, - Class raw - ) { - Map result = new LinkedHashMap(); - if (raw.isInterface()) { - return result; - } - - Type declaredType = type.getType(); - Class originalRaw = type.getRawType(); - while (shouldFindFieldInClass(raw, originalRaw)) { - Field[] fields = raw.getDeclaredFields(); - for (Field field : fields) { - boolean serialize = excludeField(field, true); - boolean deserialize = excludeField(field, false); - if (!serialize && !deserialize) { - continue; - } - field.setAccessible(true); - Type fieldType = $Gson$Types.resolve( - type.getType(), - raw, - field.getGenericType() - ); - BoundField boundField = createBoundField( - context, - field, - getFieldName(field), - TypeToken.get(fieldType), - serialize, - deserialize - ); - BoundField previous = result.put(boundField.name, boundField); - if (previous != null) { - throw new IllegalArgumentException( - declaredType + - " declares multiple JSON fields named " + - previous.name - ); - } - } - type = - TypeToken.get( - $Gson$Types.resolve(type.getType(), raw, raw.getGenericSuperclass()) - ); - raw = type.getRawType(); - } - return result; - } - - protected boolean shouldFindFieldInClass( - Class willFindClass, - Class originalRaw - ) { - return willFindClass != Object.class; - } - - abstract static class BoundField { - - final String name; - final boolean serialized; - final boolean deserialized; - - protected BoundField( - String name, - boolean serialized, - boolean deserialized - ) { - this.name = name; - this.serialized = serialized; - this.deserialized = deserialized; - } - - abstract void write(JsonWriter writer, Object value) - throws IOException, IllegalAccessException; - - abstract void read(JsonReader reader, Object value) - throws IOException, IllegalAccessException; - } - - public static final class Adapter extends TypeAdapter { - - private final ObjectConstructor constructor; - private final Map boundFields; - - private Adapter( - ObjectConstructor constructor, - Map boundFields - ) { - this.constructor = constructor; - this.boundFields = boundFields; - } - - @Override - public T read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - - T instance = constructor.construct(); - - try { - in.beginObject(); - while (in.hasNext()) { - String name = in.nextName(); - BoundField field = boundFields.get(name); - if (field == null || !field.deserialized) { - in.skipValue(); - } else { - field.read(in, instance); - } - } - } catch (IllegalStateException e) { - throw new JsonSyntaxException(e); - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - in.endObject(); - return instance; - } - - @Override - public void write(JsonWriter out, T value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - - out.beginObject(); - try { - for (BoundField boundField : boundFields.values()) { - if (boundField.serialized) { - out.name(boundField.name); - boundField.write(out, value); - } - } - } catch (IllegalAccessException e) { - throw new AssertionError(); - } - out.endObject(); - } - } - } - - static class TypeAdapterRuntimeTypeWrapper extends TypeAdapter { - - private final Gson context; - private final TypeAdapter delegate; - private final Type type; - - TypeAdapterRuntimeTypeWrapper( - Gson context, - TypeAdapter delegate, - Type type - ) { - this.context = context; - this.delegate = delegate; - this.type = type; - } - - @Override - public T read(JsonReader in) throws IOException { - return delegate.read(in); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void write(JsonWriter out, T value) throws IOException { - // Order of preference for choosing type adapters - // First preference: a type adapter registered for the runtime type - // Second preference: a type adapter registered for the declared type - // Third preference: reflective type adapter for the runtime type (if it is a - // sub class of the declared type) - // Fourth preference: reflective type adapter for the declared type - - TypeAdapter chosen = delegate; - Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value); - if (runtimeType != type) { - TypeAdapter runtimeTypeAdapter = context.getAdapter( - TypeToken.get(runtimeType) - ); - if ( - !(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter) - ) { - // The user registered a type adapter for the runtime type, so we will use that - chosen = runtimeTypeAdapter; - } else if ( - !(delegate instanceof ReflectiveTypeAdapterFactory.Adapter) - ) { - // The user registered a type adapter for Base class, so we prefer it over the - // reflective type adapter for the runtime type - chosen = delegate; - } else { - // Use the type adapter for runtime type - chosen = runtimeTypeAdapter; - } - } - chosen.write(out, value); - } - - /** Finds a compatible runtime type if it is more specific */ - private Type getRuntimeTypeIfMoreSpecific(Type type, Object value) { - if ( - value != null && - ( - type == Object.class || - type instanceof TypeVariable || - type instanceof Class - ) - ) { - type = value.getClass(); - } - return type; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java deleted file mode 100644 index 1e5bf539ea..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.algolia; - -public class Pair { - - private String name = ""; - private String value = ""; - - public Pair(String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java deleted file mode 100644 index 42c926955c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.algolia; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.RequestBody; -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress( - bytesWritten, - contentLength, - bytesWritten == contentLength - ); - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java deleted file mode 100644 index d5f13aa6e5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.algolia; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress( - totalBytesRead, - responseBody.contentLength(), - bytesRead == -1 - ); - return bytesRead; - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Action.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Action.java deleted file mode 100644 index d77747289a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Action.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** type of operation. */ -@JsonAdapter(Action.Adapter.class) -public enum Action { - ADDOBJECT("addObject"), - - UPDATEOBJECT("updateObject"), - - PARTIALUPDATEOBJECT("partialUpdateObject"), - - PARTIALUPDATEOBJECTNOCREATE("partialUpdateObjectNoCreate"), - - DELETEOBJECT("deleteObject"), - - DELETE("delete"), - - CLEAR("clear"); - - private String value; - - Action(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static Action fromValue(String value) { - for (Action b : Action.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write(final JsonWriter jsonWriter, final Action enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public Action read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return Action.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddApiKeyResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddApiKeyResponse.java deleted file mode 100644 index 0de446c362..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddApiKeyResponse.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** AddApiKeyResponse */ -public class AddApiKeyResponse { - - @SerializedName("key") - private String key; - - @SerializedName("createdAt") - private String createdAt; - - public AddApiKeyResponse key(String key) { - this.key = key; - return this; - } - - /** - * Key string. - * - * @return key - */ - @javax.annotation.Nonnull - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public AddApiKeyResponse createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Date of creation (ISO-8601 format). - * - * @return createdAt - */ - @javax.annotation.Nonnull - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AddApiKeyResponse addApiKeyResponse = (AddApiKeyResponse) o; - return ( - Objects.equals(this.key, addApiKeyResponse.key) && - Objects.equals(this.createdAt, addApiKeyResponse.createdAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(key, createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddApiKeyResponse {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb - .append(" createdAt: ") - .append(toIndentedString(createdAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Anchoring.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Anchoring.java deleted file mode 100644 index 6f7077ec8f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Anchoring.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** - * Whether the pattern parameter must match the beginning or the end of the query string, or both, - * or none. - */ -@JsonAdapter(Anchoring.Adapter.class) -public enum Anchoring { - IS("is"), - - STARTSWITH("startsWith"), - - ENDSWITH("endsWith"), - - CONTAINS("contains"); - - private String value; - - Anchoring(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static Anchoring fromValue(String value) { - for (Anchoring b : Anchoring.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write(final JsonWriter jsonWriter, final Anchoring enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public Anchoring read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return Anchoring.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiKey.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiKey.java deleted file mode 100644 index 313ed2554a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiKey.java +++ /dev/null @@ -1,363 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Api Key object. */ -public class ApiKey { - - /** Gets or Sets acl */ - @JsonAdapter(AclEnum.Adapter.class) - public enum AclEnum { - ADDOBJECT("addObject"), - - ANALYTICS("analytics"), - - BROWSE("browse"), - - DELETEOBJECT("deleteObject"), - - DELETEINDEX("deleteIndex"), - - EDITSETTINGS("editSettings"), - - LISTINDEXES("listIndexes"), - - LOGS("logs"), - - PERSONALIZATION("personalization"), - - RECOMMENDATION("recommendation"), - - SEARCH("search"), - - SEEUNRETRIEVABLEATTRIBUTES("seeUnretrievableAttributes"), - - SETTINGS("settings"), - - USAGE("usage"); - - private String value; - - AclEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AclEnum fromValue(String value) { - for (AclEnum b : AclEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write(final JsonWriter jsonWriter, final AclEnum enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AclEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return AclEnum.fromValue(value); - } - } - } - - @SerializedName("acl") - private List acl = new ArrayList<>(); - - @SerializedName("description") - private String description = ""; - - @SerializedName("indexes") - private List indexes = null; - - @SerializedName("maxHitsPerQuery") - private Integer maxHitsPerQuery = 0; - - @SerializedName("maxQueriesPerIPPerHour") - private Integer maxQueriesPerIPPerHour = 0; - - @SerializedName("queryParameters") - private String queryParameters = ""; - - @SerializedName("referers") - private List referers = null; - - @SerializedName("validity") - private Integer validity = 0; - - public ApiKey acl(List acl) { - this.acl = acl; - return this; - } - - public ApiKey addAclItem(AclEnum aclItem) { - this.acl.add(aclItem); - return this; - } - - /** - * Set of permissions associated with the key. - * - * @return acl - */ - @javax.annotation.Nonnull - public List getAcl() { - return acl; - } - - public void setAcl(List acl) { - this.acl = acl; - } - - public ApiKey description(String description) { - this.description = description; - return this; - } - - /** - * A comment used to identify a key more easily in the dashboard. It is not interpreted by the - * API. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public ApiKey indexes(List indexes) { - this.indexes = indexes; - return this; - } - - public ApiKey addIndexesItem(String indexesItem) { - if (this.indexes == null) { - this.indexes = new ArrayList<>(); - } - this.indexes.add(indexesItem); - return this; - } - - /** - * Restrict this new API key to a list of indices or index patterns. If the list is empty, all - * indices are allowed. - * - * @return indexes - */ - @javax.annotation.Nullable - public List getIndexes() { - return indexes; - } - - public void setIndexes(List indexes) { - this.indexes = indexes; - } - - public ApiKey maxHitsPerQuery(Integer maxHitsPerQuery) { - this.maxHitsPerQuery = maxHitsPerQuery; - return this; - } - - /** - * Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. - * - * @return maxHitsPerQuery - */ - @javax.annotation.Nullable - public Integer getMaxHitsPerQuery() { - return maxHitsPerQuery; - } - - public void setMaxHitsPerQuery(Integer maxHitsPerQuery) { - this.maxHitsPerQuery = maxHitsPerQuery; - } - - public ApiKey maxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) { - this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour; - return this; - } - - /** - * Maximum number of API calls per hour allowed from a given IP address or a user token. - * - * @return maxQueriesPerIPPerHour - */ - @javax.annotation.Nullable - public Integer getMaxQueriesPerIPPerHour() { - return maxQueriesPerIPPerHour; - } - - public void setMaxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) { - this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour; - } - - public ApiKey queryParameters(String queryParameters) { - this.queryParameters = queryParameters; - return this; - } - - /** - * URL-encoded query string. Force some query parameters to be applied for each query made with - * this API key. - * - * @return queryParameters - */ - @javax.annotation.Nullable - public String getQueryParameters() { - return queryParameters; - } - - public void setQueryParameters(String queryParameters) { - this.queryParameters = queryParameters; - } - - public ApiKey referers(List referers) { - this.referers = referers; - return this; - } - - public ApiKey addReferersItem(String referersItem) { - if (this.referers == null) { - this.referers = new ArrayList<>(); - } - this.referers.add(referersItem); - return this; - } - - /** - * Restrict this new API key to specific referers. If empty or blank, defaults to all referers. - * - * @return referers - */ - @javax.annotation.Nullable - public List getReferers() { - return referers; - } - - public void setReferers(List referers) { - this.referers = referers; - } - - public ApiKey validity(Integer validity) { - this.validity = validity; - return this; - } - - /** - * Validity limit for this key in seconds. The key will automatically be removed after this period - * of time. - * - * @return validity - */ - @javax.annotation.Nullable - public Integer getValidity() { - return validity; - } - - public void setValidity(Integer validity) { - this.validity = validity; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiKey apiKey = (ApiKey) o; - return ( - Objects.equals(this.acl, apiKey.acl) && - Objects.equals(this.description, apiKey.description) && - Objects.equals(this.indexes, apiKey.indexes) && - Objects.equals(this.maxHitsPerQuery, apiKey.maxHitsPerQuery) && - Objects.equals( - this.maxQueriesPerIPPerHour, - apiKey.maxQueriesPerIPPerHour - ) && - Objects.equals(this.queryParameters, apiKey.queryParameters) && - Objects.equals(this.referers, apiKey.referers) && - Objects.equals(this.validity, apiKey.validity) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - acl, - description, - indexes, - maxHitsPerQuery, - maxQueriesPerIPPerHour, - queryParameters, - referers, - validity - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiKey {\n"); - sb.append(" acl: ").append(toIndentedString(acl)).append("\n"); - sb - .append(" description: ") - .append(toIndentedString(description)) - .append("\n"); - sb.append(" indexes: ").append(toIndentedString(indexes)).append("\n"); - sb - .append(" maxHitsPerQuery: ") - .append(toIndentedString(maxHitsPerQuery)) - .append("\n"); - sb - .append(" maxQueriesPerIPPerHour: ") - .append(toIndentedString(maxQueriesPerIPPerHour)) - .append("\n"); - sb - .append(" queryParameters: ") - .append(toIndentedString(queryParameters)) - .append("\n"); - sb.append(" referers: ").append(toIndentedString(referers)).append("\n"); - sb.append(" validity: ").append(toIndentedString(validity)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AssignUserIdParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AssignUserIdParams.java deleted file mode 100644 index 33f6d0cc78..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AssignUserIdParams.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Assign userID parameters. */ -public class AssignUserIdParams { - - @SerializedName("cluster") - private String cluster; - - public AssignUserIdParams cluster(String cluster) { - this.cluster = cluster; - return this; - } - - /** - * Name of the cluster. - * - * @return cluster - */ - @javax.annotation.Nonnull - public String getCluster() { - return cluster; - } - - public void setCluster(String cluster) { - this.cluster = cluster; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AssignUserIdParams assignUserIdParams = (AssignUserIdParams) o; - return Objects.equals(this.cluster, assignUserIdParams.cluster); - } - - @Override - public int hashCode() { - return Objects.hash(cluster); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AssignUserIdParams {\n"); - sb.append(" cluster: ").append(toIndentedString(cluster)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AutomaticFacetFilter.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AutomaticFacetFilter.java deleted file mode 100644 index 0badc11f39..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AutomaticFacetFilter.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Automatic facet Filter. */ -public class AutomaticFacetFilter { - - @SerializedName("facet") - private String facet; - - @SerializedName("score") - private Integer score = 1; - - @SerializedName("disjunctive") - private Boolean disjunctive = false; - - public AutomaticFacetFilter facet(String facet) { - this.facet = facet; - return this; - } - - /** - * Attribute to filter on. This must match a facet placeholder in the Rule's pattern. - * - * @return facet - */ - @javax.annotation.Nonnull - public String getFacet() { - return facet; - } - - public void setFacet(String facet) { - this.facet = facet; - } - - public AutomaticFacetFilter score(Integer score) { - this.score = score; - return this; - } - - /** - * Score for the filter. Typically used for optional or disjunctive filters. - * - * @return score - */ - @javax.annotation.Nullable - public Integer getScore() { - return score; - } - - public void setScore(Integer score) { - this.score = score; - } - - public AutomaticFacetFilter disjunctive(Boolean disjunctive) { - this.disjunctive = disjunctive; - return this; - } - - /** - * Whether the filter is disjunctive (true) or conjunctive (false). - * - * @return disjunctive - */ - @javax.annotation.Nullable - public Boolean getDisjunctive() { - return disjunctive; - } - - public void setDisjunctive(Boolean disjunctive) { - this.disjunctive = disjunctive; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AutomaticFacetFilter automaticFacetFilter = (AutomaticFacetFilter) o; - return ( - Objects.equals(this.facet, automaticFacetFilter.facet) && - Objects.equals(this.score, automaticFacetFilter.score) && - Objects.equals(this.disjunctive, automaticFacetFilter.disjunctive) - ); - } - - @Override - public int hashCode() { - return Objects.hash(facet, score, disjunctive); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AutomaticFacetFilter {\n"); - sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); - sb.append(" score: ").append(toIndentedString(score)).append("\n"); - sb - .append(" disjunctive: ") - .append(toIndentedString(disjunctive)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseBrowseResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseBrowseResponse.java deleted file mode 100644 index 1657eccac5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseBrowseResponse.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** BaseBrowseResponse */ -public class BaseBrowseResponse { - - @SerializedName("cursor") - private String cursor; - - public BaseBrowseResponse cursor(String cursor) { - this.cursor = cursor; - return this; - } - - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the - * previous call. - * - * @return cursor - */ - @javax.annotation.Nonnull - public String getCursor() { - return cursor; - } - - public void setCursor(String cursor) { - this.cursor = cursor; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BaseBrowseResponse baseBrowseResponse = (BaseBrowseResponse) o; - return Objects.equals(this.cursor, baseBrowseResponse.cursor); - } - - @Override - public int hashCode() { - return Objects.hash(cursor); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseBrowseResponse {\n"); - sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java deleted file mode 100644 index 4b83049887..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ /dev/null @@ -1,494 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** BaseIndexSettings */ -public class BaseIndexSettings { - - @SerializedName("replicas") - private List replicas = null; - - @SerializedName("paginationLimitedTo") - private Integer paginationLimitedTo = 1000; - - @SerializedName("disableTypoToleranceOnWords") - private List disableTypoToleranceOnWords = null; - - @SerializedName("attributesToTransliterate") - private List attributesToTransliterate = null; - - @SerializedName("camelCaseAttributes") - private List camelCaseAttributes = null; - - @SerializedName("decompoundedAttributes") - private Object decompoundedAttributes = new Object(); - - @SerializedName("indexLanguages") - private List indexLanguages = null; - - @SerializedName("filterPromotes") - private Boolean filterPromotes = false; - - @SerializedName("disablePrefixOnAttributes") - private List disablePrefixOnAttributes = null; - - @SerializedName("allowCompressionOfIntegerArray") - private Boolean allowCompressionOfIntegerArray = false; - - @SerializedName("numericAttributesForFiltering") - private List numericAttributesForFiltering = null; - - @SerializedName("userData") - private Object userData = new Object(); - - public BaseIndexSettings replicas(List replicas) { - this.replicas = replicas; - return this; - } - - public BaseIndexSettings addReplicasItem(String replicasItem) { - if (this.replicas == null) { - this.replicas = new ArrayList<>(); - } - this.replicas.add(replicasItem); - return this; - } - - /** - * Creates replicas, exact copies of an index. - * - * @return replicas - */ - @javax.annotation.Nullable - public List getReplicas() { - return replicas; - } - - public void setReplicas(List replicas) { - this.replicas = replicas; - } - - public BaseIndexSettings paginationLimitedTo(Integer paginationLimitedTo) { - this.paginationLimitedTo = paginationLimitedTo; - return this; - } - - /** - * Set the maximum number of hits accessible via pagination. - * - * @return paginationLimitedTo - */ - @javax.annotation.Nullable - public Integer getPaginationLimitedTo() { - return paginationLimitedTo; - } - - public void setPaginationLimitedTo(Integer paginationLimitedTo) { - this.paginationLimitedTo = paginationLimitedTo; - } - - public BaseIndexSettings disableTypoToleranceOnWords( - List disableTypoToleranceOnWords - ) { - this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; - return this; - } - - public BaseIndexSettings addDisableTypoToleranceOnWordsItem( - String disableTypoToleranceOnWordsItem - ) { - if (this.disableTypoToleranceOnWords == null) { - this.disableTypoToleranceOnWords = new ArrayList<>(); - } - this.disableTypoToleranceOnWords.add(disableTypoToleranceOnWordsItem); - return this; - } - - /** - * A list of words for which you want to turn off typo tolerance. - * - * @return disableTypoToleranceOnWords - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnWords() { - return disableTypoToleranceOnWords; - } - - public void setDisableTypoToleranceOnWords( - List disableTypoToleranceOnWords - ) { - this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; - } - - public BaseIndexSettings attributesToTransliterate( - List attributesToTransliterate - ) { - this.attributesToTransliterate = attributesToTransliterate; - return this; - } - - public BaseIndexSettings addAttributesToTransliterateItem( - String attributesToTransliterateItem - ) { - if (this.attributesToTransliterate == null) { - this.attributesToTransliterate = new ArrayList<>(); - } - this.attributesToTransliterate.add(attributesToTransliterateItem); - return this; - } - - /** - * Specify on which attributes to apply transliteration. - * - * @return attributesToTransliterate - */ - @javax.annotation.Nullable - public List getAttributesToTransliterate() { - return attributesToTransliterate; - } - - public void setAttributesToTransliterate( - List attributesToTransliterate - ) { - this.attributesToTransliterate = attributesToTransliterate; - } - - public BaseIndexSettings camelCaseAttributes( - List camelCaseAttributes - ) { - this.camelCaseAttributes = camelCaseAttributes; - return this; - } - - public BaseIndexSettings addCamelCaseAttributesItem( - String camelCaseAttributesItem - ) { - if (this.camelCaseAttributes == null) { - this.camelCaseAttributes = new ArrayList<>(); - } - this.camelCaseAttributes.add(camelCaseAttributesItem); - return this; - } - - /** - * List of attributes on which to do a decomposition of camel case words. - * - * @return camelCaseAttributes - */ - @javax.annotation.Nullable - public List getCamelCaseAttributes() { - return camelCaseAttributes; - } - - public void setCamelCaseAttributes(List camelCaseAttributes) { - this.camelCaseAttributes = camelCaseAttributes; - } - - public BaseIndexSettings decompoundedAttributes( - Object decompoundedAttributes - ) { - this.decompoundedAttributes = decompoundedAttributes; - return this; - } - - /** - * Specify on which attributes in your index Algolia should apply word segmentation, also known as - * decompounding. - * - * @return decompoundedAttributes - */ - @javax.annotation.Nullable - public Object getDecompoundedAttributes() { - return decompoundedAttributes; - } - - public void setDecompoundedAttributes(Object decompoundedAttributes) { - this.decompoundedAttributes = decompoundedAttributes; - } - - public BaseIndexSettings indexLanguages(List indexLanguages) { - this.indexLanguages = indexLanguages; - return this; - } - - public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { - if (this.indexLanguages == null) { - this.indexLanguages = new ArrayList<>(); - } - this.indexLanguages.add(indexLanguagesItem); - return this; - } - - /** - * Sets the languages at the index level for language-specific processing such as tokenization and - * normalization. - * - * @return indexLanguages - */ - @javax.annotation.Nullable - public List getIndexLanguages() { - return indexLanguages; - } - - public void setIndexLanguages(List indexLanguages) { - this.indexLanguages = indexLanguages; - } - - public BaseIndexSettings filterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; - return this; - } - - /** - * Whether promoted results should match the filters of the current search, except for geographic - * filters. - * - * @return filterPromotes - */ - @javax.annotation.Nullable - public Boolean getFilterPromotes() { - return filterPromotes; - } - - public void setFilterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; - } - - public BaseIndexSettings disablePrefixOnAttributes( - List disablePrefixOnAttributes - ) { - this.disablePrefixOnAttributes = disablePrefixOnAttributes; - return this; - } - - public BaseIndexSettings addDisablePrefixOnAttributesItem( - String disablePrefixOnAttributesItem - ) { - if (this.disablePrefixOnAttributes == null) { - this.disablePrefixOnAttributes = new ArrayList<>(); - } - this.disablePrefixOnAttributes.add(disablePrefixOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable prefix matching. - * - * @return disablePrefixOnAttributes - */ - @javax.annotation.Nullable - public List getDisablePrefixOnAttributes() { - return disablePrefixOnAttributes; - } - - public void setDisablePrefixOnAttributes( - List disablePrefixOnAttributes - ) { - this.disablePrefixOnAttributes = disablePrefixOnAttributes; - } - - public BaseIndexSettings allowCompressionOfIntegerArray( - Boolean allowCompressionOfIntegerArray - ) { - this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; - return this; - } - - /** - * Enables compression of large integer arrays. - * - * @return allowCompressionOfIntegerArray - */ - @javax.annotation.Nullable - public Boolean getAllowCompressionOfIntegerArray() { - return allowCompressionOfIntegerArray; - } - - public void setAllowCompressionOfIntegerArray( - Boolean allowCompressionOfIntegerArray - ) { - this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; - } - - public BaseIndexSettings numericAttributesForFiltering( - List numericAttributesForFiltering - ) { - this.numericAttributesForFiltering = numericAttributesForFiltering; - return this; - } - - public BaseIndexSettings addNumericAttributesForFilteringItem( - String numericAttributesForFilteringItem - ) { - if (this.numericAttributesForFiltering == null) { - this.numericAttributesForFiltering = new ArrayList<>(); - } - this.numericAttributesForFiltering.add(numericAttributesForFilteringItem); - return this; - } - - /** - * List of numeric attributes that can be used as numerical filters. - * - * @return numericAttributesForFiltering - */ - @javax.annotation.Nullable - public List getNumericAttributesForFiltering() { - return numericAttributesForFiltering; - } - - public void setNumericAttributesForFiltering( - List numericAttributesForFiltering - ) { - this.numericAttributesForFiltering = numericAttributesForFiltering; - } - - public BaseIndexSettings userData(Object userData) { - this.userData = userData; - return this; - } - - /** - * Lets you store custom data in your indices. - * - * @return userData - */ - @javax.annotation.Nullable - public Object getUserData() { - return userData; - } - - public void setUserData(Object userData) { - this.userData = userData; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BaseIndexSettings baseIndexSettings = (BaseIndexSettings) o; - return ( - Objects.equals(this.replicas, baseIndexSettings.replicas) && - Objects.equals( - this.paginationLimitedTo, - baseIndexSettings.paginationLimitedTo - ) && - Objects.equals( - this.disableTypoToleranceOnWords, - baseIndexSettings.disableTypoToleranceOnWords - ) && - Objects.equals( - this.attributesToTransliterate, - baseIndexSettings.attributesToTransliterate - ) && - Objects.equals( - this.camelCaseAttributes, - baseIndexSettings.camelCaseAttributes - ) && - Objects.equals( - this.decompoundedAttributes, - baseIndexSettings.decompoundedAttributes - ) && - Objects.equals(this.indexLanguages, baseIndexSettings.indexLanguages) && - Objects.equals(this.filterPromotes, baseIndexSettings.filterPromotes) && - Objects.equals( - this.disablePrefixOnAttributes, - baseIndexSettings.disablePrefixOnAttributes - ) && - Objects.equals( - this.allowCompressionOfIntegerArray, - baseIndexSettings.allowCompressionOfIntegerArray - ) && - Objects.equals( - this.numericAttributesForFiltering, - baseIndexSettings.numericAttributesForFiltering - ) && - Objects.equals(this.userData, baseIndexSettings.userData) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - replicas, - paginationLimitedTo, - disableTypoToleranceOnWords, - attributesToTransliterate, - camelCaseAttributes, - decompoundedAttributes, - indexLanguages, - filterPromotes, - disablePrefixOnAttributes, - allowCompressionOfIntegerArray, - numericAttributesForFiltering, - userData - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseIndexSettings {\n"); - sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); - sb - .append(" paginationLimitedTo: ") - .append(toIndentedString(paginationLimitedTo)) - .append("\n"); - sb - .append(" disableTypoToleranceOnWords: ") - .append(toIndentedString(disableTypoToleranceOnWords)) - .append("\n"); - sb - .append(" attributesToTransliterate: ") - .append(toIndentedString(attributesToTransliterate)) - .append("\n"); - sb - .append(" camelCaseAttributes: ") - .append(toIndentedString(camelCaseAttributes)) - .append("\n"); - sb - .append(" decompoundedAttributes: ") - .append(toIndentedString(decompoundedAttributes)) - .append("\n"); - sb - .append(" indexLanguages: ") - .append(toIndentedString(indexLanguages)) - .append("\n"); - sb - .append(" filterPromotes: ") - .append(toIndentedString(filterPromotes)) - .append("\n"); - sb - .append(" disablePrefixOnAttributes: ") - .append(toIndentedString(disablePrefixOnAttributes)) - .append("\n"); - sb - .append(" allowCompressionOfIntegerArray: ") - .append(toIndentedString(allowCompressionOfIntegerArray)) - .append("\n"); - sb - .append(" numericAttributesForFiltering: ") - .append(toIndentedString(numericAttributesForFiltering)) - .append("\n"); - sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java deleted file mode 100644 index cbe3be160b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ /dev/null @@ -1,1050 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** BaseSearchParams */ -public class BaseSearchParams { - - @SerializedName("similarQuery") - private String similarQuery = ""; - - @SerializedName("filters") - private String filters = ""; - - @SerializedName("facetFilters") - private List facetFilters = null; - - @SerializedName("optionalFilters") - private List optionalFilters = null; - - @SerializedName("numericFilters") - private List numericFilters = null; - - @SerializedName("tagFilters") - private List tagFilters = null; - - @SerializedName("sumOrFiltersScores") - private Boolean sumOrFiltersScores = false; - - @SerializedName("facets") - private List facets = null; - - @SerializedName("maxValuesPerFacet") - private Integer maxValuesPerFacet = 100; - - @SerializedName("facetingAfterDistinct") - private Boolean facetingAfterDistinct = false; - - @SerializedName("sortFacetValuesBy") - private String sortFacetValuesBy = "count"; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("offset") - private Integer offset; - - @SerializedName("length") - private Integer length; - - @SerializedName("aroundLatLng") - private String aroundLatLng = ""; - - @SerializedName("aroundLatLngViaIP") - private Boolean aroundLatLngViaIP = false; - - @SerializedName("aroundRadius") - private OneOfintegerstring aroundRadius; - - @SerializedName("aroundPrecision") - private Integer aroundPrecision = 10; - - @SerializedName("minimumAroundRadius") - private Integer minimumAroundRadius; - - @SerializedName("insideBoundingBox") - private List insideBoundingBox = null; - - @SerializedName("insidePolygon") - private List insidePolygon = null; - - @SerializedName("naturalLanguages") - private List naturalLanguages = null; - - @SerializedName("ruleContexts") - private List ruleContexts = null; - - @SerializedName("personalizationImpact") - private Integer personalizationImpact = 100; - - @SerializedName("userToken") - private String userToken; - - @SerializedName("getRankingInfo") - private Boolean getRankingInfo = false; - - @SerializedName("clickAnalytics") - private Boolean clickAnalytics = false; - - @SerializedName("analytics") - private Boolean analytics = true; - - @SerializedName("analyticsTags") - private List analyticsTags = null; - - @SerializedName("percentileComputation") - private Boolean percentileComputation = true; - - @SerializedName("enableABTest") - private Boolean enableABTest = true; - - @SerializedName("enableReRanking") - private Boolean enableReRanking = true; - - public BaseSearchParams similarQuery(String similarQuery) { - this.similarQuery = similarQuery; - return this; - } - - /** - * Overrides the query parameter and performs a more generic search that can be used to find - * \"similar\" results. - * - * @return similarQuery - */ - @javax.annotation.Nullable - public String getSimilarQuery() { - return similarQuery; - } - - public void setSimilarQuery(String similarQuery) { - this.similarQuery = similarQuery; - } - - public BaseSearchParams filters(String filters) { - this.filters = filters; - return this; - } - - /** - * Filter the query with numeric, facet and/or tag filters. - * - * @return filters - */ - @javax.annotation.Nullable - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } - - public BaseSearchParams facetFilters(List facetFilters) { - this.facetFilters = facetFilters; - return this; - } - - public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - - /** - * Filter hits by facet value. - * - * @return facetFilters - */ - @javax.annotation.Nullable - public List getFacetFilters() { - return facetFilters; - } - - public void setFacetFilters(List facetFilters) { - this.facetFilters = facetFilters; - } - - public BaseSearchParams optionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - return this; - } - - public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { - if (this.optionalFilters == null) { - this.optionalFilters = new ArrayList<>(); - } - this.optionalFilters.add(optionalFiltersItem); - return this; - } - - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or - * lower in the case of a negative optional filter. - * - * @return optionalFilters - */ - @javax.annotation.Nullable - public List getOptionalFilters() { - return optionalFilters; - } - - public void setOptionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - } - - public BaseSearchParams numericFilters(List numericFilters) { - this.numericFilters = numericFilters; - return this; - } - - public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - - /** - * Filter on numeric attributes. - * - * @return numericFilters - */ - @javax.annotation.Nullable - public List getNumericFilters() { - return numericFilters; - } - - public void setNumericFilters(List numericFilters) { - this.numericFilters = numericFilters; - } - - public BaseSearchParams tagFilters(List tagFilters) { - this.tagFilters = tagFilters; - return this; - } - - public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - - /** - * Filter hits by tags. - * - * @return tagFilters - */ - @javax.annotation.Nullable - public List getTagFilters() { - return tagFilters; - } - - public void setTagFilters(List tagFilters) { - this.tagFilters = tagFilters; - } - - public BaseSearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - return this; - } - - /** - * Determines how to calculate the total score for filtering. - * - * @return sumOrFiltersScores - */ - @javax.annotation.Nullable - public Boolean getSumOrFiltersScores() { - return sumOrFiltersScores; - } - - public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - } - - public BaseSearchParams facets(List facets) { - this.facets = facets; - return this; - } - - public BaseSearchParams addFacetsItem(String facetsItem) { - if (this.facets == null) { - this.facets = new ArrayList<>(); - } - this.facets.add(facetsItem); - return this; - } - - /** - * Retrieve facets and their facet values. - * - * @return facets - */ - @javax.annotation.Nullable - public List getFacets() { - return facets; - } - - public void setFacets(List facets) { - this.facets = facets; - } - - public BaseSearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - return this; - } - - /** - * Maximum number of facet values to return for each facet during a regular search. - * - * @return maxValuesPerFacet - */ - @javax.annotation.Nullable - public Integer getMaxValuesPerFacet() { - return maxValuesPerFacet; - } - - public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - } - - public BaseSearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; - return this; - } - - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - * - * @return facetingAfterDistinct - */ - @javax.annotation.Nullable - public Boolean getFacetingAfterDistinct() { - return facetingAfterDistinct; - } - - public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; - } - - public BaseSearchParams sortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - return this; - } - - /** - * Controls how facet values are fetched. - * - * @return sortFacetValuesBy - */ - @javax.annotation.Nullable - public String getSortFacetValuesBy() { - return sortFacetValuesBy; - } - - public void setSortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - } - - public BaseSearchParams page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public BaseSearchParams offset(Integer offset) { - this.offset = offset; - return this; - } - - /** - * Specify the offset of the first hit to return. - * - * @return offset - */ - @javax.annotation.Nullable - public Integer getOffset() { - return offset; - } - - public void setOffset(Integer offset) { - this.offset = offset; - } - - public BaseSearchParams length(Integer length) { - this.length = length; - return this; - } - - /** - * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 - * - * @return length - */ - @javax.annotation.Nullable - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public BaseSearchParams aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public BaseSearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - return this; - } - - /** - * Search for entries around a given location automatically computed from the requester's IP - * address. - * - * @return aroundLatLngViaIP - */ - @javax.annotation.Nullable - public Boolean getAroundLatLngViaIP() { - return aroundLatLngViaIP; - } - - public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - } - - public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - return this; - } - - /** - * Define the maximum radius for a geo search (in meters). - * - * @return aroundRadius - */ - @javax.annotation.Nullable - public OneOfintegerstring getAroundRadius() { - return aroundRadius; - } - - public void setAroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - } - - public BaseSearchParams aroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - return this; - } - - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - * - * @return aroundPrecision - */ - @javax.annotation.Nullable - public Integer getAroundPrecision() { - return aroundPrecision; - } - - public void setAroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - } - - public BaseSearchParams minimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - return this; - } - - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 - * - * @return minimumAroundRadius - */ - @javax.annotation.Nullable - public Integer getMinimumAroundRadius() { - return minimumAroundRadius; - } - - public void setMinimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - } - - public BaseSearchParams insideBoundingBox( - List insideBoundingBox - ) { - this.insideBoundingBox = insideBoundingBox; - return this; - } - - public BaseSearchParams addInsideBoundingBoxItem( - BigDecimal insideBoundingBoxItem - ) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Search inside a rectangular area (in geo coordinates). - * - * @return insideBoundingBox - */ - @javax.annotation.Nullable - public List getInsideBoundingBox() { - return insideBoundingBox; - } - - public void setInsideBoundingBox(List insideBoundingBox) { - this.insideBoundingBox = insideBoundingBox; - } - - public BaseSearchParams insidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - return this; - } - - public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { - if (this.insidePolygon == null) { - this.insidePolygon = new ArrayList<>(); - } - this.insidePolygon.add(insidePolygonItem); - return this; - } - - /** - * Search inside a polygon (in geo coordinates). - * - * @return insidePolygon - */ - @javax.annotation.Nullable - public List getInsidePolygon() { - return insidePolygon; - } - - public void setInsidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - } - - public BaseSearchParams naturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - return this; - } - - public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { - if (this.naturalLanguages == null) { - this.naturalLanguages = new ArrayList<>(); - } - this.naturalLanguages.add(naturalLanguagesItem); - return this; - } - - /** - * This parameter changes the default values of certain parameters and settings that work best for - * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, - * analyticsTags and ruleContexts. These parameters and settings work well together when the query - * is formatted in natural language instead of keywords, for example when your user performs a - * voice search. - * - * @return naturalLanguages - */ - @javax.annotation.Nullable - public List getNaturalLanguages() { - return naturalLanguages; - } - - public void setNaturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - } - - public BaseSearchParams ruleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - return this; - } - - public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { - if (this.ruleContexts == null) { - this.ruleContexts = new ArrayList<>(); - } - this.ruleContexts.add(ruleContextsItem); - return this; - } - - /** - * Enables contextual rules. - * - * @return ruleContexts - */ - @javax.annotation.Nullable - public List getRuleContexts() { - return ruleContexts; - } - - public void setRuleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - } - - public BaseSearchParams personalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; - return this; - } - - /** - * Define the impact of the Personalization feature. - * - * @return personalizationImpact - */ - @javax.annotation.Nullable - public Integer getPersonalizationImpact() { - return personalizationImpact; - } - - public void setPersonalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; - } - - public BaseSearchParams userToken(String userToken) { - this.userToken = userToken; - return this; - } - - /** - * Associates a certain user token with the current search. - * - * @return userToken - */ - @javax.annotation.Nullable - public String getUserToken() { - return userToken; - } - - public void setUserToken(String userToken) { - this.userToken = userToken; - } - - public BaseSearchParams getRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - return this; - } - - /** - * Retrieve detailed ranking information. - * - * @return getRankingInfo - */ - @javax.annotation.Nullable - public Boolean getGetRankingInfo() { - return getRankingInfo; - } - - public void setGetRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - } - - public BaseSearchParams clickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - return this; - } - - /** - * Enable the Click Analytics feature. - * - * @return clickAnalytics - */ - @javax.annotation.Nullable - public Boolean getClickAnalytics() { - return clickAnalytics; - } - - public void setClickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - } - - public BaseSearchParams analytics(Boolean analytics) { - this.analytics = analytics; - return this; - } - - /** - * Whether the current query will be taken into account in the Analytics. - * - * @return analytics - */ - @javax.annotation.Nullable - public Boolean getAnalytics() { - return analytics; - } - - public void setAnalytics(Boolean analytics) { - this.analytics = analytics; - } - - public BaseSearchParams analyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - return this; - } - - public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { - if (this.analyticsTags == null) { - this.analyticsTags = new ArrayList<>(); - } - this.analyticsTags.add(analyticsTagsItem); - return this; - } - - /** - * List of tags to apply to the query for analytics purposes. - * - * @return analyticsTags - */ - @javax.annotation.Nullable - public List getAnalyticsTags() { - return analyticsTags; - } - - public void setAnalyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - } - - public BaseSearchParams percentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; - return this; - } - - /** - * Whether to include or exclude a query from the processing-time percentile computation. - * - * @return percentileComputation - */ - @javax.annotation.Nullable - public Boolean getPercentileComputation() { - return percentileComputation; - } - - public void setPercentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; - } - - public BaseSearchParams enableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - return this; - } - - /** - * Whether this search should participate in running AB tests. - * - * @return enableABTest - */ - @javax.annotation.Nullable - public Boolean getEnableABTest() { - return enableABTest; - } - - public void setEnableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - } - - public BaseSearchParams enableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - return this; - } - - /** - * Whether this search should use AI Re-Ranking. - * - * @return enableReRanking - */ - @javax.annotation.Nullable - public Boolean getEnableReRanking() { - return enableReRanking; - } - - public void setEnableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BaseSearchParams baseSearchParams = (BaseSearchParams) o; - return ( - Objects.equals(this.similarQuery, baseSearchParams.similarQuery) && - Objects.equals(this.filters, baseSearchParams.filters) && - Objects.equals(this.facetFilters, baseSearchParams.facetFilters) && - Objects.equals(this.optionalFilters, baseSearchParams.optionalFilters) && - Objects.equals(this.numericFilters, baseSearchParams.numericFilters) && - Objects.equals(this.tagFilters, baseSearchParams.tagFilters) && - Objects.equals( - this.sumOrFiltersScores, - baseSearchParams.sumOrFiltersScores - ) && - Objects.equals(this.facets, baseSearchParams.facets) && - Objects.equals( - this.maxValuesPerFacet, - baseSearchParams.maxValuesPerFacet - ) && - Objects.equals( - this.facetingAfterDistinct, - baseSearchParams.facetingAfterDistinct - ) && - Objects.equals( - this.sortFacetValuesBy, - baseSearchParams.sortFacetValuesBy - ) && - Objects.equals(this.page, baseSearchParams.page) && - Objects.equals(this.offset, baseSearchParams.offset) && - Objects.equals(this.length, baseSearchParams.length) && - Objects.equals(this.aroundLatLng, baseSearchParams.aroundLatLng) && - Objects.equals( - this.aroundLatLngViaIP, - baseSearchParams.aroundLatLngViaIP - ) && - Objects.equals(this.aroundRadius, baseSearchParams.aroundRadius) && - Objects.equals(this.aroundPrecision, baseSearchParams.aroundPrecision) && - Objects.equals( - this.minimumAroundRadius, - baseSearchParams.minimumAroundRadius - ) && - Objects.equals( - this.insideBoundingBox, - baseSearchParams.insideBoundingBox - ) && - Objects.equals(this.insidePolygon, baseSearchParams.insidePolygon) && - Objects.equals( - this.naturalLanguages, - baseSearchParams.naturalLanguages - ) && - Objects.equals(this.ruleContexts, baseSearchParams.ruleContexts) && - Objects.equals( - this.personalizationImpact, - baseSearchParams.personalizationImpact - ) && - Objects.equals(this.userToken, baseSearchParams.userToken) && - Objects.equals(this.getRankingInfo, baseSearchParams.getRankingInfo) && - Objects.equals(this.clickAnalytics, baseSearchParams.clickAnalytics) && - Objects.equals(this.analytics, baseSearchParams.analytics) && - Objects.equals(this.analyticsTags, baseSearchParams.analyticsTags) && - Objects.equals( - this.percentileComputation, - baseSearchParams.percentileComputation - ) && - Objects.equals(this.enableABTest, baseSearchParams.enableABTest) && - Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - similarQuery, - filters, - facetFilters, - optionalFilters, - numericFilters, - tagFilters, - sumOrFiltersScores, - facets, - maxValuesPerFacet, - facetingAfterDistinct, - sortFacetValuesBy, - page, - offset, - length, - aroundLatLng, - aroundLatLngViaIP, - aroundRadius, - aroundPrecision, - minimumAroundRadius, - insideBoundingBox, - insidePolygon, - naturalLanguages, - ruleContexts, - personalizationImpact, - userToken, - getRankingInfo, - clickAnalytics, - analytics, - analyticsTags, - percentileComputation, - enableABTest, - enableReRanking - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseSearchParams {\n"); - sb - .append(" similarQuery: ") - .append(toIndentedString(similarQuery)) - .append("\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb - .append(" facetFilters: ") - .append(toIndentedString(facetFilters)) - .append("\n"); - sb - .append(" optionalFilters: ") - .append(toIndentedString(optionalFilters)) - .append("\n"); - sb - .append(" numericFilters: ") - .append(toIndentedString(numericFilters)) - .append("\n"); - sb - .append(" tagFilters: ") - .append(toIndentedString(tagFilters)) - .append("\n"); - sb - .append(" sumOrFiltersScores: ") - .append(toIndentedString(sumOrFiltersScores)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" maxValuesPerFacet: ") - .append(toIndentedString(maxValuesPerFacet)) - .append("\n"); - sb - .append(" facetingAfterDistinct: ") - .append(toIndentedString(facetingAfterDistinct)) - .append("\n"); - sb - .append(" sortFacetValuesBy: ") - .append(toIndentedString(sortFacetValuesBy)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" aroundLatLngViaIP: ") - .append(toIndentedString(aroundLatLngViaIP)) - .append("\n"); - sb - .append(" aroundRadius: ") - .append(toIndentedString(aroundRadius)) - .append("\n"); - sb - .append(" aroundPrecision: ") - .append(toIndentedString(aroundPrecision)) - .append("\n"); - sb - .append(" minimumAroundRadius: ") - .append(toIndentedString(minimumAroundRadius)) - .append("\n"); - sb - .append(" insideBoundingBox: ") - .append(toIndentedString(insideBoundingBox)) - .append("\n"); - sb - .append(" insidePolygon: ") - .append(toIndentedString(insidePolygon)) - .append("\n"); - sb - .append(" naturalLanguages: ") - .append(toIndentedString(naturalLanguages)) - .append("\n"); - sb - .append(" ruleContexts: ") - .append(toIndentedString(ruleContexts)) - .append("\n"); - sb - .append(" personalizationImpact: ") - .append(toIndentedString(personalizationImpact)) - .append("\n"); - sb - .append(" userToken: ") - .append(toIndentedString(userToken)) - .append("\n"); - sb - .append(" getRankingInfo: ") - .append(toIndentedString(getRankingInfo)) - .append("\n"); - sb - .append(" clickAnalytics: ") - .append(toIndentedString(clickAnalytics)) - .append("\n"); - sb - .append(" analytics: ") - .append(toIndentedString(analytics)) - .append("\n"); - sb - .append(" analyticsTags: ") - .append(toIndentedString(analyticsTags)) - .append("\n"); - sb - .append(" percentileComputation: ") - .append(toIndentedString(percentileComputation)) - .append("\n"); - sb - .append(" enableABTest: ") - .append(toIndentedString(enableABTest)) - .append("\n"); - sb - .append(" enableReRanking: ") - .append(toIndentedString(enableReRanking)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java deleted file mode 100644 index b39969cca6..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ /dev/null @@ -1,741 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** BaseSearchResponse */ -public class BaseSearchResponse { - - @SerializedName("abTestID") - private Integer abTestID; - - @SerializedName("abTestVariantID") - private Integer abTestVariantID; - - @SerializedName("aroundLatLng") - private String aroundLatLng; - - @SerializedName("automaticRadius") - private String automaticRadius; - - @SerializedName("exhaustiveFacetsCount") - private Boolean exhaustiveFacetsCount; - - @SerializedName("exhaustiveNbHits") - private Boolean exhaustiveNbHits; - - @SerializedName("exhaustiveTypo") - private Boolean exhaustiveTypo; - - @SerializedName("facets") - private Map> facets = null; - - @SerializedName("facets_stats") - private Map facetsStats = null; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("index") - private String index; - - @SerializedName("indexUsed") - private String indexUsed; - - @SerializedName("message") - private String message; - - @SerializedName("nbHits") - private Integer nbHits; - - @SerializedName("nbPages") - private Integer nbPages; - - @SerializedName("nbSortedHits") - private Integer nbSortedHits; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("params") - private String params; - - @SerializedName("parsedQuery") - private String parsedQuery; - - @SerializedName("processingTimeMS") - private Integer processingTimeMS; - - @SerializedName("query") - private String query = ""; - - @SerializedName("queryAfterRemoval") - private String queryAfterRemoval; - - @SerializedName("serverUsed") - private String serverUsed; - - @SerializedName("userData") - private Object userData = new Object(); - - public BaseSearchResponse abTestID(Integer abTestID) { - this.abTestID = abTestID; - return this; - } - - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test - * ID. - * - * @return abTestID - */ - @javax.annotation.Nullable - public Integer getAbTestID() { - return abTestID; - } - - public void setAbTestID(Integer abTestID) { - this.abTestID = abTestID; - } - - public BaseSearchResponse abTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; - return this; - } - - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant - * ID of the index used. - * - * @return abTestVariantID - */ - @javax.annotation.Nullable - public Integer getAbTestVariantID() { - return abTestVariantID; - } - - public void setAbTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; - } - - public BaseSearchResponse aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * The computed geo location. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public BaseSearchResponse automaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; - return this; - } - - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an - * integer. - * - * @return automaticRadius - */ - @javax.annotation.Nullable - public String getAutomaticRadius() { - return automaticRadius; - } - - public void setAutomaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; - } - - public BaseSearchResponse exhaustiveFacetsCount( - Boolean exhaustiveFacetsCount - ) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; - return this; - } - - /** - * Whether the facet count is exhaustive or approximate. - * - * @return exhaustiveFacetsCount - */ - @javax.annotation.Nullable - public Boolean getExhaustiveFacetsCount() { - return exhaustiveFacetsCount; - } - - public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; - } - - public BaseSearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; - return this; - } - - /** - * Indicate if the nbHits count was exhaustive or approximate - * - * @return exhaustiveNbHits - */ - @javax.annotation.Nonnull - public Boolean getExhaustiveNbHits() { - return exhaustiveNbHits; - } - - public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; - } - - public BaseSearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; - return this; - } - - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when - * typo-tolerance is enabled) - * - * @return exhaustiveTypo - */ - @javax.annotation.Nonnull - public Boolean getExhaustiveTypo() { - return exhaustiveTypo; - } - - public void setExhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; - } - - public BaseSearchResponse facets(Map> facets) { - this.facets = facets; - return this; - } - - public BaseSearchResponse putFacetsItem( - String key, - Map facetsItem - ) { - if (this.facets == null) { - this.facets = new HashMap<>(); - } - this.facets.put(key, facetsItem); - return this; - } - - /** - * A mapping of each facet name to the corresponding facet counts. - * - * @return facets - */ - @javax.annotation.Nullable - public Map> getFacets() { - return facets; - } - - public void setFacets(Map> facets) { - this.facets = facets; - } - - public BaseSearchResponse facetsStats( - Map facetsStats - ) { - this.facetsStats = facetsStats; - return this; - } - - public BaseSearchResponse putFacetsStatsItem( - String key, - BaseSearchResponseFacetsStats facetsStatsItem - ) { - if (this.facetsStats == null) { - this.facetsStats = new HashMap<>(); - } - this.facetsStats.put(key, facetsStatsItem); - return this; - } - - /** - * Statistics for numerical facets. - * - * @return facetsStats - */ - @javax.annotation.Nullable - public Map getFacetsStats() { - return facetsStats; - } - - public void setFacetsStats( - Map facetsStats - ) { - this.facetsStats = facetsStats; - } - - public BaseSearchResponse hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public BaseSearchResponse index(String index) { - this.index = index; - return this; - } - - /** - * Index name used for the query. - * - * @return index - */ - @javax.annotation.Nullable - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - - public BaseSearchResponse indexUsed(String indexUsed) { - this.indexUsed = indexUsed; - return this; - } - - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn't always the - * index used by the query. - * - * @return indexUsed - */ - @javax.annotation.Nullable - public String getIndexUsed() { - return indexUsed; - } - - public void setIndexUsed(String indexUsed) { - this.indexUsed = indexUsed; - } - - public BaseSearchResponse message(String message) { - this.message = message; - return this; - } - - /** - * Used to return warnings about the query. - * - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public BaseSearchResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** - * Number of hits that the search query matched. - * - * @return nbHits - */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public void setNbHits(Integer nbHits) { - this.nbHits = nbHits; - } - - public BaseSearchResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** - * Number of pages available for the current query - * - * @return nbPages - */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - - public void setNbPages(Integer nbPages) { - this.nbPages = nbPages; - } - - public BaseSearchResponse nbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; - return this; - } - - /** - * The number of hits selected and sorted by the relevant sort algorithm - * - * @return nbSortedHits - */ - @javax.annotation.Nullable - public Integer getNbSortedHits() { - return nbSortedHits; - } - - public void setNbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; - } - - public BaseSearchResponse page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public BaseSearchResponse params(String params) { - this.params = params; - return this; - } - - /** - * A url-encoded string of all search parameters. - * - * @return params - */ - @javax.annotation.Nonnull - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public BaseSearchResponse parsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; - return this; - } - - /** - * The query string that will be searched, after normalization. - * - * @return parsedQuery - */ - @javax.annotation.Nullable - public String getParsedQuery() { - return parsedQuery; - } - - public void setParsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; - } - - public BaseSearchResponse processingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; - return this; - } - - /** - * Time the server took to process the request, in milliseconds. - * - * @return processingTimeMS - */ - @javax.annotation.Nonnull - public Integer getProcessingTimeMS() { - return processingTimeMS; - } - - public void setProcessingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; - } - - public BaseSearchResponse query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public BaseSearchResponse queryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; - return this; - } - - /** - * A markup text indicating which parts of the original query have been removed in order to - * retrieve a non-empty result set. - * - * @return queryAfterRemoval - */ - @javax.annotation.Nullable - public String getQueryAfterRemoval() { - return queryAfterRemoval; - } - - public void setQueryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; - } - - public BaseSearchResponse serverUsed(String serverUsed) { - this.serverUsed = serverUsed; - return this; - } - - /** - * Actual host name of the server that processed the request. - * - * @return serverUsed - */ - @javax.annotation.Nullable - public String getServerUsed() { - return serverUsed; - } - - public void setServerUsed(String serverUsed) { - this.serverUsed = serverUsed; - } - - public BaseSearchResponse userData(Object userData) { - this.userData = userData; - return this; - } - - /** - * Lets you store custom data in your indices. - * - * @return userData - */ - @javax.annotation.Nullable - public Object getUserData() { - return userData; - } - - public void setUserData(Object userData) { - this.userData = userData; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BaseSearchResponse baseSearchResponse = (BaseSearchResponse) o; - return ( - Objects.equals(this.abTestID, baseSearchResponse.abTestID) && - Objects.equals( - this.abTestVariantID, - baseSearchResponse.abTestVariantID - ) && - Objects.equals(this.aroundLatLng, baseSearchResponse.aroundLatLng) && - Objects.equals( - this.automaticRadius, - baseSearchResponse.automaticRadius - ) && - Objects.equals( - this.exhaustiveFacetsCount, - baseSearchResponse.exhaustiveFacetsCount - ) && - Objects.equals( - this.exhaustiveNbHits, - baseSearchResponse.exhaustiveNbHits - ) && - Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && - Objects.equals(this.facets, baseSearchResponse.facets) && - Objects.equals(this.facetsStats, baseSearchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, baseSearchResponse.hitsPerPage) && - Objects.equals(this.index, baseSearchResponse.index) && - Objects.equals(this.indexUsed, baseSearchResponse.indexUsed) && - Objects.equals(this.message, baseSearchResponse.message) && - Objects.equals(this.nbHits, baseSearchResponse.nbHits) && - Objects.equals(this.nbPages, baseSearchResponse.nbPages) && - Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && - Objects.equals(this.page, baseSearchResponse.page) && - Objects.equals(this.params, baseSearchResponse.params) && - Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && - Objects.equals( - this.processingTimeMS, - baseSearchResponse.processingTimeMS - ) && - Objects.equals(this.query, baseSearchResponse.query) && - Objects.equals( - this.queryAfterRemoval, - baseSearchResponse.queryAfterRemoval - ) && - Objects.equals(this.serverUsed, baseSearchResponse.serverUsed) && - Objects.equals(this.userData, baseSearchResponse.userData) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - abTestID, - abTestVariantID, - aroundLatLng, - automaticRadius, - exhaustiveFacetsCount, - exhaustiveNbHits, - exhaustiveTypo, - facets, - facetsStats, - hitsPerPage, - index, - indexUsed, - message, - nbHits, - nbPages, - nbSortedHits, - page, - params, - parsedQuery, - processingTimeMS, - query, - queryAfterRemoval, - serverUsed, - userData - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseSearchResponse {\n"); - sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); - sb - .append(" abTestVariantID: ") - .append(toIndentedString(abTestVariantID)) - .append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" automaticRadius: ") - .append(toIndentedString(automaticRadius)) - .append("\n"); - sb - .append(" exhaustiveFacetsCount: ") - .append(toIndentedString(exhaustiveFacetsCount)) - .append("\n"); - sb - .append(" exhaustiveNbHits: ") - .append(toIndentedString(exhaustiveNbHits)) - .append("\n"); - sb - .append(" exhaustiveTypo: ") - .append(toIndentedString(exhaustiveTypo)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" facetsStats: ") - .append(toIndentedString(facetsStats)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb.append(" index: ").append(toIndentedString(index)).append("\n"); - sb - .append(" indexUsed: ") - .append(toIndentedString(indexUsed)) - .append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb - .append(" nbSortedHits: ") - .append(toIndentedString(nbSortedHits)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb - .append(" parsedQuery: ") - .append(toIndentedString(parsedQuery)) - .append("\n"); - sb - .append(" processingTimeMS: ") - .append(toIndentedString(processingTimeMS)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" queryAfterRemoval: ") - .append(toIndentedString(queryAfterRemoval)) - .append("\n"); - sb - .append(" serverUsed: ") - .append(toIndentedString(serverUsed)) - .append("\n"); - sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java deleted file mode 100644 index ddf47b6774..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** BaseSearchResponseFacetsStats */ -public class BaseSearchResponseFacetsStats { - - @SerializedName("min") - private Integer min; - - @SerializedName("max") - private Integer max; - - @SerializedName("avg") - private Integer avg; - - @SerializedName("sum") - private Integer sum; - - public BaseSearchResponseFacetsStats min(Integer min) { - this.min = min; - return this; - } - - /** - * The minimum value in the result set. - * - * @return min - */ - @javax.annotation.Nullable - public Integer getMin() { - return min; - } - - public void setMin(Integer min) { - this.min = min; - } - - public BaseSearchResponseFacetsStats max(Integer max) { - this.max = max; - return this; - } - - /** - * The maximum value in the result set. - * - * @return max - */ - @javax.annotation.Nullable - public Integer getMax() { - return max; - } - - public void setMax(Integer max) { - this.max = max; - } - - public BaseSearchResponseFacetsStats avg(Integer avg) { - this.avg = avg; - return this; - } - - /** - * The average facet value in the result set. - * - * @return avg - */ - @javax.annotation.Nullable - public Integer getAvg() { - return avg; - } - - public void setAvg(Integer avg) { - this.avg = avg; - } - - public BaseSearchResponseFacetsStats sum(Integer sum) { - this.sum = sum; - return this; - } - - /** - * The sum of all values in the result set. - * - * @return sum - */ - @javax.annotation.Nullable - public Integer getSum() { - return sum; - } - - public void setSum(Integer sum) { - this.sum = sum; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BaseSearchResponseFacetsStats baseSearchResponseFacetsStats = (BaseSearchResponseFacetsStats) o; - return ( - Objects.equals(this.min, baseSearchResponseFacetsStats.min) && - Objects.equals(this.max, baseSearchResponseFacetsStats.max) && - Objects.equals(this.avg, baseSearchResponseFacetsStats.avg) && - Objects.equals(this.sum, baseSearchResponseFacetsStats.sum) - ); - } - - @Override - public int hashCode() { - return Objects.hash(min, max, avg, sum); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseSearchResponseFacetsStats {\n"); - sb.append(" min: ").append(toIndentedString(min)).append("\n"); - sb.append(" max: ").append(toIndentedString(max)).append("\n"); - sb.append(" avg: ").append(toIndentedString(avg)).append("\n"); - sb.append(" sum: ").append(toIndentedString(sum)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchAssignUserIdsParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchAssignUserIdsParams.java deleted file mode 100644 index d2c89235a9..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchAssignUserIdsParams.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Assign userID parameters. */ -public class BatchAssignUserIdsParams { - - @SerializedName("cluster") - private String cluster; - - @SerializedName("users") - private List users = new ArrayList<>(); - - public BatchAssignUserIdsParams cluster(String cluster) { - this.cluster = cluster; - return this; - } - - /** - * Name of the cluster. - * - * @return cluster - */ - @javax.annotation.Nonnull - public String getCluster() { - return cluster; - } - - public void setCluster(String cluster) { - this.cluster = cluster; - } - - public BatchAssignUserIdsParams users(List users) { - this.users = users; - return this; - } - - public BatchAssignUserIdsParams addUsersItem(String usersItem) { - this.users.add(usersItem); - return this; - } - - /** - * userIDs to assign. Note you cannot move users with this method. - * - * @return users - */ - @javax.annotation.Nonnull - public List getUsers() { - return users; - } - - public void setUsers(List users) { - this.users = users; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BatchAssignUserIdsParams batchAssignUserIdsParams = (BatchAssignUserIdsParams) o; - return ( - Objects.equals(this.cluster, batchAssignUserIdsParams.cluster) && - Objects.equals(this.users, batchAssignUserIdsParams.users) - ); - } - - @Override - public int hashCode() { - return Objects.hash(cluster, users); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchAssignUserIdsParams {\n"); - sb.append(" cluster: ").append(toIndentedString(cluster)).append("\n"); - sb.append(" users: ").append(toIndentedString(users)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesParams.java deleted file mode 100644 index 41bfc9d320..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesParams.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** The `batchDictionaryEntries` parameters. */ -public class BatchDictionaryEntriesParams { - - @SerializedName("clearExistingDictionaryEntries") - private Boolean clearExistingDictionaryEntries = false; - - @SerializedName("requests") - private List requests = new ArrayList<>(); - - public BatchDictionaryEntriesParams clearExistingDictionaryEntries( - Boolean clearExistingDictionaryEntries - ) { - this.clearExistingDictionaryEntries = clearExistingDictionaryEntries; - return this; - } - - /** - * When `true`, start the batch by removing all the custom entries from the dictionary. - * - * @return clearExistingDictionaryEntries - */ - @javax.annotation.Nullable - public Boolean getClearExistingDictionaryEntries() { - return clearExistingDictionaryEntries; - } - - public void setClearExistingDictionaryEntries( - Boolean clearExistingDictionaryEntries - ) { - this.clearExistingDictionaryEntries = clearExistingDictionaryEntries; - } - - public BatchDictionaryEntriesParams requests( - List requests - ) { - this.requests = requests; - return this; - } - - public BatchDictionaryEntriesParams addRequestsItem( - BatchDictionaryEntriesRequest requestsItem - ) { - this.requests.add(requestsItem); - return this; - } - - /** - * List of operations to batch. Each operation is described by an `action` and a `body`. - * - * @return requests - */ - @javax.annotation.Nonnull - public List getRequests() { - return requests; - } - - public void setRequests(List requests) { - this.requests = requests; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BatchDictionaryEntriesParams batchDictionaryEntriesParams = (BatchDictionaryEntriesParams) o; - return ( - Objects.equals( - this.clearExistingDictionaryEntries, - batchDictionaryEntriesParams.clearExistingDictionaryEntries - ) && - Objects.equals(this.requests, batchDictionaryEntriesParams.requests) - ); - } - - @Override - public int hashCode() { - return Objects.hash(clearExistingDictionaryEntries, requests); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchDictionaryEntriesParams {\n"); - sb - .append(" clearExistingDictionaryEntries: ") - .append(toIndentedString(clearExistingDictionaryEntries)) - .append("\n"); - sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesRequest.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesRequest.java deleted file mode 100644 index d356b71b3c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchDictionaryEntriesRequest.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** BatchDictionaryEntriesRequest */ -public class BatchDictionaryEntriesRequest { - - @SerializedName("action") - private DictionaryAction action; - - @SerializedName("body") - private DictionaryEntry body; - - public BatchDictionaryEntriesRequest action(DictionaryAction action) { - this.action = action; - return this; - } - - /** - * Get action - * - * @return action - */ - @javax.annotation.Nonnull - public DictionaryAction getAction() { - return action; - } - - public void setAction(DictionaryAction action) { - this.action = action; - } - - public BatchDictionaryEntriesRequest body(DictionaryEntry body) { - this.body = body; - return this; - } - - /** - * Get body - * - * @return body - */ - @javax.annotation.Nonnull - public DictionaryEntry getBody() { - return body; - } - - public void setBody(DictionaryEntry body) { - this.body = body; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BatchDictionaryEntriesRequest batchDictionaryEntriesRequest = (BatchDictionaryEntriesRequest) o; - return ( - Objects.equals(this.action, batchDictionaryEntriesRequest.action) && - Objects.equals(this.body, batchDictionaryEntriesRequest.body) - ); - } - - @Override - public int hashCode() { - return Objects.hash(action, body); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchDictionaryEntriesRequest {\n"); - sb.append(" action: ").append(toIndentedString(action)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchParams.java deleted file mode 100644 index eaff3a9760..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchParams.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** The `multipleBatch` parameters. */ -public class BatchParams { - - @SerializedName("requests") - private List requests = null; - - public BatchParams requests(List requests) { - this.requests = requests; - return this; - } - - public BatchParams addRequestsItem(Operation requestsItem) { - if (this.requests == null) { - this.requests = new ArrayList<>(); - } - this.requests.add(requestsItem); - return this; - } - - /** - * Get requests - * - * @return requests - */ - @javax.annotation.Nullable - public List getRequests() { - return requests; - } - - public void setRequests(List requests) { - this.requests = requests; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BatchParams batchParams = (BatchParams) o; - return Objects.equals(this.requests, batchParams.requests); - } - - @Override - public int hashCode() { - return Objects.hash(requests); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchParams {\n"); - sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java deleted file mode 100644 index 80cc720c27..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** BatchResponse */ -public class BatchResponse { - - @SerializedName("taskID") - private Integer taskID; - - @SerializedName("objectIDs") - private List objectIDs = null; - - public BatchResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public BatchResponse objectIDs(List objectIDs) { - this.objectIDs = objectIDs; - return this; - } - - public BatchResponse addObjectIDsItem(String objectIDsItem) { - if (this.objectIDs == null) { - this.objectIDs = new ArrayList<>(); - } - this.objectIDs.add(objectIDsItem); - return this; - } - - /** - * List of objectID. - * - * @return objectIDs - */ - @javax.annotation.Nullable - public List getObjectIDs() { - return objectIDs; - } - - public void setObjectIDs(List objectIDs) { - this.objectIDs = objectIDs; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BatchResponse batchResponse = (BatchResponse) o; - return ( - Objects.equals(this.taskID, batchResponse.taskID) && - Objects.equals(this.objectIDs, batchResponse.objectIDs) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, objectIDs); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchResponse {\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb - .append(" objectIDs: ") - .append(toIndentedString(objectIDs)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchWriteParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchWriteParams.java deleted file mode 100644 index 3eace6978b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchWriteParams.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** The `batch` parameters. */ -public class BatchWriteParams { - - @SerializedName("requests") - private List requests = null; - - public BatchWriteParams requests(List requests) { - this.requests = requests; - return this; - } - - public BatchWriteParams addRequestsItem(Operation requestsItem) { - if (this.requests == null) { - this.requests = new ArrayList<>(); - } - this.requests.add(requestsItem); - return this; - } - - /** - * Get requests - * - * @return requests - */ - @javax.annotation.Nullable - public List getRequests() { - return requests; - } - - public void setRequests(List requests) { - this.requests = requests; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BatchWriteParams batchWriteParams = (BatchWriteParams) o; - return Objects.equals(this.requests, batchWriteParams.requests); - } - - @Override - public int hashCode() { - return Objects.hash(requests); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchWriteParams {\n"); - sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseRequest.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseRequest.java deleted file mode 100644 index c412ea0fee..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseRequest.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** BrowseRequest */ -public class BrowseRequest { - - @SerializedName("params") - private String params = ""; - - @SerializedName("cursor") - private String cursor; - - public BrowseRequest params(String params) { - this.params = params; - return this; - } - - /** - * Search parameters as URL-encoded query string. - * - * @return params - */ - @javax.annotation.Nullable - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public BrowseRequest cursor(String cursor) { - this.cursor = cursor; - return this; - } - - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the - * previous call. - * - * @return cursor - */ - @javax.annotation.Nullable - public String getCursor() { - return cursor; - } - - public void setCursor(String cursor) { - this.cursor = cursor; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BrowseRequest browseRequest = (BrowseRequest) o; - return ( - Objects.equals(this.params, browseRequest.params) && - Objects.equals(this.cursor, browseRequest.cursor) - ); - } - - @Override - public int hashCode() { - return Objects.hash(params, cursor); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BrowseRequest {\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseResponse.java deleted file mode 100644 index 17d13c58f0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BrowseResponse.java +++ /dev/null @@ -1,785 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** BrowseResponse */ -public class BrowseResponse { - - @SerializedName("abTestID") - private Integer abTestID; - - @SerializedName("abTestVariantID") - private Integer abTestVariantID; - - @SerializedName("aroundLatLng") - private String aroundLatLng; - - @SerializedName("automaticRadius") - private String automaticRadius; - - @SerializedName("exhaustiveFacetsCount") - private Boolean exhaustiveFacetsCount; - - @SerializedName("exhaustiveNbHits") - private Boolean exhaustiveNbHits; - - @SerializedName("exhaustiveTypo") - private Boolean exhaustiveTypo; - - @SerializedName("facets") - private Map> facets = null; - - @SerializedName("facets_stats") - private Map facetsStats = null; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("index") - private String index; - - @SerializedName("indexUsed") - private String indexUsed; - - @SerializedName("message") - private String message; - - @SerializedName("nbHits") - private Integer nbHits; - - @SerializedName("nbPages") - private Integer nbPages; - - @SerializedName("nbSortedHits") - private Integer nbSortedHits; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("params") - private String params; - - @SerializedName("parsedQuery") - private String parsedQuery; - - @SerializedName("processingTimeMS") - private Integer processingTimeMS; - - @SerializedName("query") - private String query = ""; - - @SerializedName("queryAfterRemoval") - private String queryAfterRemoval; - - @SerializedName("serverUsed") - private String serverUsed; - - @SerializedName("userData") - private Object userData = new Object(); - - @SerializedName("hits") - private List hits = new ArrayList<>(); - - @SerializedName("cursor") - private String cursor; - - public BrowseResponse abTestID(Integer abTestID) { - this.abTestID = abTestID; - return this; - } - - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test - * ID. - * - * @return abTestID - */ - @javax.annotation.Nullable - public Integer getAbTestID() { - return abTestID; - } - - public void setAbTestID(Integer abTestID) { - this.abTestID = abTestID; - } - - public BrowseResponse abTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; - return this; - } - - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant - * ID of the index used. - * - * @return abTestVariantID - */ - @javax.annotation.Nullable - public Integer getAbTestVariantID() { - return abTestVariantID; - } - - public void setAbTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; - } - - public BrowseResponse aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * The computed geo location. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public BrowseResponse automaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; - return this; - } - - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an - * integer. - * - * @return automaticRadius - */ - @javax.annotation.Nullable - public String getAutomaticRadius() { - return automaticRadius; - } - - public void setAutomaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; - } - - public BrowseResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; - return this; - } - - /** - * Whether the facet count is exhaustive or approximate. - * - * @return exhaustiveFacetsCount - */ - @javax.annotation.Nullable - public Boolean getExhaustiveFacetsCount() { - return exhaustiveFacetsCount; - } - - public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; - } - - public BrowseResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; - return this; - } - - /** - * Indicate if the nbHits count was exhaustive or approximate - * - * @return exhaustiveNbHits - */ - @javax.annotation.Nonnull - public Boolean getExhaustiveNbHits() { - return exhaustiveNbHits; - } - - public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; - } - - public BrowseResponse exhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; - return this; - } - - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when - * typo-tolerance is enabled) - * - * @return exhaustiveTypo - */ - @javax.annotation.Nonnull - public Boolean getExhaustiveTypo() { - return exhaustiveTypo; - } - - public void setExhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; - } - - public BrowseResponse facets(Map> facets) { - this.facets = facets; - return this; - } - - public BrowseResponse putFacetsItem( - String key, - Map facetsItem - ) { - if (this.facets == null) { - this.facets = new HashMap<>(); - } - this.facets.put(key, facetsItem); - return this; - } - - /** - * A mapping of each facet name to the corresponding facet counts. - * - * @return facets - */ - @javax.annotation.Nullable - public Map> getFacets() { - return facets; - } - - public void setFacets(Map> facets) { - this.facets = facets; - } - - public BrowseResponse facetsStats( - Map facetsStats - ) { - this.facetsStats = facetsStats; - return this; - } - - public BrowseResponse putFacetsStatsItem( - String key, - BaseSearchResponseFacetsStats facetsStatsItem - ) { - if (this.facetsStats == null) { - this.facetsStats = new HashMap<>(); - } - this.facetsStats.put(key, facetsStatsItem); - return this; - } - - /** - * Statistics for numerical facets. - * - * @return facetsStats - */ - @javax.annotation.Nullable - public Map getFacetsStats() { - return facetsStats; - } - - public void setFacetsStats( - Map facetsStats - ) { - this.facetsStats = facetsStats; - } - - public BrowseResponse hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public BrowseResponse index(String index) { - this.index = index; - return this; - } - - /** - * Index name used for the query. - * - * @return index - */ - @javax.annotation.Nullable - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - - public BrowseResponse indexUsed(String indexUsed) { - this.indexUsed = indexUsed; - return this; - } - - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn't always the - * index used by the query. - * - * @return indexUsed - */ - @javax.annotation.Nullable - public String getIndexUsed() { - return indexUsed; - } - - public void setIndexUsed(String indexUsed) { - this.indexUsed = indexUsed; - } - - public BrowseResponse message(String message) { - this.message = message; - return this; - } - - /** - * Used to return warnings about the query. - * - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public BrowseResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** - * Number of hits that the search query matched. - * - * @return nbHits - */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public void setNbHits(Integer nbHits) { - this.nbHits = nbHits; - } - - public BrowseResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** - * Number of pages available for the current query - * - * @return nbPages - */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - - public void setNbPages(Integer nbPages) { - this.nbPages = nbPages; - } - - public BrowseResponse nbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; - return this; - } - - /** - * The number of hits selected and sorted by the relevant sort algorithm - * - * @return nbSortedHits - */ - @javax.annotation.Nullable - public Integer getNbSortedHits() { - return nbSortedHits; - } - - public void setNbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; - } - - public BrowseResponse page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public BrowseResponse params(String params) { - this.params = params; - return this; - } - - /** - * A url-encoded string of all search parameters. - * - * @return params - */ - @javax.annotation.Nonnull - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public BrowseResponse parsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; - return this; - } - - /** - * The query string that will be searched, after normalization. - * - * @return parsedQuery - */ - @javax.annotation.Nullable - public String getParsedQuery() { - return parsedQuery; - } - - public void setParsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; - } - - public BrowseResponse processingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; - return this; - } - - /** - * Time the server took to process the request, in milliseconds. - * - * @return processingTimeMS - */ - @javax.annotation.Nonnull - public Integer getProcessingTimeMS() { - return processingTimeMS; - } - - public void setProcessingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; - } - - public BrowseResponse query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public BrowseResponse queryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; - return this; - } - - /** - * A markup text indicating which parts of the original query have been removed in order to - * retrieve a non-empty result set. - * - * @return queryAfterRemoval - */ - @javax.annotation.Nullable - public String getQueryAfterRemoval() { - return queryAfterRemoval; - } - - public void setQueryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; - } - - public BrowseResponse serverUsed(String serverUsed) { - this.serverUsed = serverUsed; - return this; - } - - /** - * Actual host name of the server that processed the request. - * - * @return serverUsed - */ - @javax.annotation.Nullable - public String getServerUsed() { - return serverUsed; - } - - public void setServerUsed(String serverUsed) { - this.serverUsed = serverUsed; - } - - public BrowseResponse userData(Object userData) { - this.userData = userData; - return this; - } - - /** - * Lets you store custom data in your indices. - * - * @return userData - */ - @javax.annotation.Nullable - public Object getUserData() { - return userData; - } - - public void setUserData(Object userData) { - this.userData = userData; - } - - public BrowseResponse hits(List hits) { - this.hits = hits; - return this; - } - - public BrowseResponse addHitsItem(Hit hitsItem) { - this.hits.add(hitsItem); - return this; - } - - /** - * Get hits - * - * @return hits - */ - @javax.annotation.Nonnull - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - public BrowseResponse cursor(String cursor) { - this.cursor = cursor; - return this; - } - - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the - * previous call. - * - * @return cursor - */ - @javax.annotation.Nonnull - public String getCursor() { - return cursor; - } - - public void setCursor(String cursor) { - this.cursor = cursor; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BrowseResponse browseResponse = (BrowseResponse) o; - return ( - Objects.equals(this.abTestID, browseResponse.abTestID) && - Objects.equals(this.abTestVariantID, browseResponse.abTestVariantID) && - Objects.equals(this.aroundLatLng, browseResponse.aroundLatLng) && - Objects.equals(this.automaticRadius, browseResponse.automaticRadius) && - Objects.equals( - this.exhaustiveFacetsCount, - browseResponse.exhaustiveFacetsCount - ) && - Objects.equals(this.exhaustiveNbHits, browseResponse.exhaustiveNbHits) && - Objects.equals(this.exhaustiveTypo, browseResponse.exhaustiveTypo) && - Objects.equals(this.facets, browseResponse.facets) && - Objects.equals(this.facetsStats, browseResponse.facetsStats) && - Objects.equals(this.hitsPerPage, browseResponse.hitsPerPage) && - Objects.equals(this.index, browseResponse.index) && - Objects.equals(this.indexUsed, browseResponse.indexUsed) && - Objects.equals(this.message, browseResponse.message) && - Objects.equals(this.nbHits, browseResponse.nbHits) && - Objects.equals(this.nbPages, browseResponse.nbPages) && - Objects.equals(this.nbSortedHits, browseResponse.nbSortedHits) && - Objects.equals(this.page, browseResponse.page) && - Objects.equals(this.params, browseResponse.params) && - Objects.equals(this.parsedQuery, browseResponse.parsedQuery) && - Objects.equals(this.processingTimeMS, browseResponse.processingTimeMS) && - Objects.equals(this.query, browseResponse.query) && - Objects.equals( - this.queryAfterRemoval, - browseResponse.queryAfterRemoval - ) && - Objects.equals(this.serverUsed, browseResponse.serverUsed) && - Objects.equals(this.userData, browseResponse.userData) && - Objects.equals(this.hits, browseResponse.hits) && - Objects.equals(this.cursor, browseResponse.cursor) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - abTestID, - abTestVariantID, - aroundLatLng, - automaticRadius, - exhaustiveFacetsCount, - exhaustiveNbHits, - exhaustiveTypo, - facets, - facetsStats, - hitsPerPage, - index, - indexUsed, - message, - nbHits, - nbPages, - nbSortedHits, - page, - params, - parsedQuery, - processingTimeMS, - query, - queryAfterRemoval, - serverUsed, - userData, - hits, - cursor - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BrowseResponse {\n"); - sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); - sb - .append(" abTestVariantID: ") - .append(toIndentedString(abTestVariantID)) - .append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" automaticRadius: ") - .append(toIndentedString(automaticRadius)) - .append("\n"); - sb - .append(" exhaustiveFacetsCount: ") - .append(toIndentedString(exhaustiveFacetsCount)) - .append("\n"); - sb - .append(" exhaustiveNbHits: ") - .append(toIndentedString(exhaustiveNbHits)) - .append("\n"); - sb - .append(" exhaustiveTypo: ") - .append(toIndentedString(exhaustiveTypo)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" facetsStats: ") - .append(toIndentedString(facetsStats)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb.append(" index: ").append(toIndentedString(index)).append("\n"); - sb - .append(" indexUsed: ") - .append(toIndentedString(indexUsed)) - .append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb - .append(" nbSortedHits: ") - .append(toIndentedString(nbSortedHits)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb - .append(" parsedQuery: ") - .append(toIndentedString(parsedQuery)) - .append("\n"); - sb - .append(" processingTimeMS: ") - .append(toIndentedString(processingTimeMS)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" queryAfterRemoval: ") - .append(toIndentedString(queryAfterRemoval)) - .append("\n"); - sb - .append(" serverUsed: ") - .append(toIndentedString(serverUsed)) - .append("\n"); - sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); - sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BuiltInOperation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BuiltInOperation.java deleted file mode 100644 index b9ff646ce2..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BuiltInOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** - * To update an attribute without pushing the entire record, you can use these built-in operations. - */ -public class BuiltInOperation { - - /** The operation to apply on the attribute. */ - @JsonAdapter(OperationEnum.Adapter.class) - public enum OperationEnum { - INCREMENT("Increment"), - - DECREMENT("Decrement"), - - ADD("Add"), - - REMOVE("Remove"), - - ADDUNIQUE("AddUnique"), - - INCREMENTFROM("IncrementFrom"), - - INCREMENTSET("IncrementSet"); - - private String value; - - OperationEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static OperationEnum fromValue(String value) { - for (OperationEnum b : OperationEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final OperationEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public OperationEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return OperationEnum.fromValue(value); - } - } - } - - @SerializedName("_operation") - private OperationEnum operation; - - @SerializedName("value") - private String value; - - public BuiltInOperation operation(OperationEnum operation) { - this.operation = operation; - return this; - } - - /** - * The operation to apply on the attribute. - * - * @return operation - */ - @javax.annotation.Nonnull - public OperationEnum getOperation() { - return operation; - } - - public void setOperation(OperationEnum operation) { - this.operation = operation; - } - - public BuiltInOperation value(String value) { - this.value = value; - return this; - } - - /** - * the right-hand side argument to the operation, for example, increment or decrement step, value - * to add or remove. - * - * @return value - */ - @javax.annotation.Nonnull - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BuiltInOperation builtInOperation = (BuiltInOperation) o; - return ( - Objects.equals(this.operation, builtInOperation.operation) && - Objects.equals(this.value, builtInOperation.value) - ); - } - - @Override - public int hashCode() { - return Objects.hash(operation, value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BuiltInOperation {\n"); - sb - .append(" operation: ") - .append(toIndentedString(operation)) - .append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Condition.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Condition.java deleted file mode 100644 index c445c6bd59..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Condition.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Condition */ -public class Condition { - - @SerializedName("pattern") - private String pattern; - - @SerializedName("anchoring") - private Anchoring anchoring; - - @SerializedName("alternatives") - private Boolean alternatives = false; - - @SerializedName("context") - private String context; - - public Condition pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Query pattern syntax - * - * @return pattern - */ - @javax.annotation.Nullable - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public Condition anchoring(Anchoring anchoring) { - this.anchoring = anchoring; - return this; - } - - /** - * Get anchoring - * - * @return anchoring - */ - @javax.annotation.Nullable - public Anchoring getAnchoring() { - return anchoring; - } - - public void setAnchoring(Anchoring anchoring) { - this.anchoring = anchoring; - } - - public Condition alternatives(Boolean alternatives) { - this.alternatives = alternatives; - return this; - } - - /** - * Whether the pattern matches on plurals, synonyms, and typos. - * - * @return alternatives - */ - @javax.annotation.Nullable - public Boolean getAlternatives() { - return alternatives; - } - - public void setAlternatives(Boolean alternatives) { - this.alternatives = alternatives; - } - - public Condition context(String context) { - this.context = context; - return this; - } - - /** - * Rule context format: [A-Za-z0-9_-]+). - * - * @return context - */ - @javax.annotation.Nullable - public String getContext() { - return context; - } - - public void setContext(String context) { - this.context = context; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Condition condition = (Condition) o; - return ( - Objects.equals(this.pattern, condition.pattern) && - Objects.equals(this.anchoring, condition.anchoring) && - Objects.equals(this.alternatives, condition.alternatives) && - Objects.equals(this.context, condition.context) - ); - } - - @Override - public int hashCode() { - return Objects.hash(pattern, anchoring, alternatives, context); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Condition {\n"); - sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n"); - sb - .append(" anchoring: ") - .append(toIndentedString(anchoring)) - .append("\n"); - sb - .append(" alternatives: ") - .append(toIndentedString(alternatives)) - .append("\n"); - sb.append(" context: ").append(toIndentedString(context)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java deleted file mode 100644 index 039564519f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Consequence of the Rule. */ -public class Consequence { - - @SerializedName("params") - private ConsequenceParams params; - - @SerializedName("promote") - private List promote = null; - - @SerializedName("filterPromotes") - private Boolean filterPromotes = false; - - @SerializedName("hide") - private List hide = null; - - @SerializedName("userData") - private Object userData; - - public Consequence params(ConsequenceParams params) { - this.params = params; - return this; - } - - /** - * Get params - * - * @return params - */ - @javax.annotation.Nullable - public ConsequenceParams getParams() { - return params; - } - - public void setParams(ConsequenceParams params) { - this.params = params; - } - - public Consequence promote(List promote) { - this.promote = promote; - return this; - } - - public Consequence addPromoteItem(Promote promoteItem) { - if (this.promote == null) { - this.promote = new ArrayList<>(); - } - this.promote.add(promoteItem); - return this; - } - - /** - * Objects to promote as hits. - * - * @return promote - */ - @javax.annotation.Nullable - public List getPromote() { - return promote; - } - - public void setPromote(List promote) { - this.promote = promote; - } - - public Consequence filterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; - return this; - } - - /** - * Only use in combination with the promote consequence. When true, promoted results will be - * restricted to match the filters of the current search. When false, the promoted results will - * show up regardless of the filters. - * - * @return filterPromotes - */ - @javax.annotation.Nullable - public Boolean getFilterPromotes() { - return filterPromotes; - } - - public void setFilterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; - } - - public Consequence hide(List hide) { - this.hide = hide; - return this; - } - - public Consequence addHideItem(ConsequenceHide hideItem) { - if (this.hide == null) { - this.hide = new ArrayList<>(); - } - this.hide.add(hideItem); - return this; - } - - /** - * Objects to hide from hits. Each object must contain an objectID field. By default, you can hide - * up to 50 items per rule. - * - * @return hide - */ - @javax.annotation.Nullable - public List getHide() { - return hide; - } - - public void setHide(List hide) { - this.hide = hide; - } - - public Consequence userData(Object userData) { - this.userData = userData; - return this; - } - - /** - * Custom JSON object that will be appended to the userData array in the response. This object - * isn't interpreted by the API. It's limited to 1kB of minified JSON. - * - * @return userData - */ - @javax.annotation.Nullable - public Object getUserData() { - return userData; - } - - public void setUserData(Object userData) { - this.userData = userData; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Consequence consequence = (Consequence) o; - return ( - Objects.equals(this.params, consequence.params) && - Objects.equals(this.promote, consequence.promote) && - Objects.equals(this.filterPromotes, consequence.filterPromotes) && - Objects.equals(this.hide, consequence.hide) && - Objects.equals(this.userData, consequence.userData) - ); - } - - @Override - public int hashCode() { - return Objects.hash(params, promote, filterPromotes, hide, userData); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Consequence {\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append(" promote: ").append(toIndentedString(promote)).append("\n"); - sb - .append(" filterPromotes: ") - .append(toIndentedString(filterPromotes)) - .append("\n"); - sb.append(" hide: ").append(toIndentedString(hide)).append("\n"); - sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceHide.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceHide.java deleted file mode 100644 index eb08e8b59a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceHide.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Unique identifier of the object to hide. */ -public class ConsequenceHide { - - @SerializedName("objectID") - private String objectID; - - public ConsequenceHide objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConsequenceHide consequenceHide = (ConsequenceHide) o; - return Objects.equals(this.objectID, consequenceHide.objectID); - } - - @Override - public int hashCode() { - return Objects.hash(objectID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConsequenceHide {\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java deleted file mode 100644 index 2fd6c440a6..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java +++ /dev/null @@ -1,3018 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ConsequenceParams */ -public class ConsequenceParams { - - @SerializedName("query") - private String query; - - @SerializedName("automaticFacetFilters") - private List automaticFacetFilters = null; - - @SerializedName("automaticOptionalFacetFilters") - private List automaticOptionalFacetFilters = null; - - @SerializedName("similarQuery") - private String similarQuery = ""; - - @SerializedName("filters") - private String filters = ""; - - @SerializedName("facetFilters") - private List facetFilters = null; - - @SerializedName("optionalFilters") - private List optionalFilters = null; - - @SerializedName("numericFilters") - private List numericFilters = null; - - @SerializedName("tagFilters") - private List tagFilters = null; - - @SerializedName("sumOrFiltersScores") - private Boolean sumOrFiltersScores = false; - - @SerializedName("facets") - private List facets = null; - - @SerializedName("maxValuesPerFacet") - private Integer maxValuesPerFacet = 100; - - @SerializedName("facetingAfterDistinct") - private Boolean facetingAfterDistinct = false; - - @SerializedName("sortFacetValuesBy") - private String sortFacetValuesBy = "count"; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("offset") - private Integer offset; - - @SerializedName("length") - private Integer length; - - @SerializedName("aroundLatLng") - private String aroundLatLng = ""; - - @SerializedName("aroundLatLngViaIP") - private Boolean aroundLatLngViaIP = false; - - @SerializedName("aroundRadius") - private OneOfintegerstring aroundRadius; - - @SerializedName("aroundPrecision") - private Integer aroundPrecision = 10; - - @SerializedName("minimumAroundRadius") - private Integer minimumAroundRadius; - - @SerializedName("insideBoundingBox") - private List insideBoundingBox = null; - - @SerializedName("insidePolygon") - private List insidePolygon = null; - - @SerializedName("naturalLanguages") - private List naturalLanguages = null; - - @SerializedName("ruleContexts") - private List ruleContexts = null; - - @SerializedName("personalizationImpact") - private Integer personalizationImpact = 100; - - @SerializedName("userToken") - private String userToken; - - @SerializedName("getRankingInfo") - private Boolean getRankingInfo = false; - - @SerializedName("clickAnalytics") - private Boolean clickAnalytics = false; - - @SerializedName("analytics") - private Boolean analytics = true; - - @SerializedName("analyticsTags") - private List analyticsTags = null; - - @SerializedName("percentileComputation") - private Boolean percentileComputation = true; - - @SerializedName("enableABTest") - private Boolean enableABTest = true; - - @SerializedName("enableReRanking") - private Boolean enableReRanking = true; - - @SerializedName("searchableAttributes") - private List searchableAttributes = null; - - @SerializedName("attributesForFaceting") - private List attributesForFaceting = null; - - @SerializedName("unretrievableAttributes") - private List unretrievableAttributes = null; - - @SerializedName("attributesToRetrieve") - private List attributesToRetrieve = null; - - @SerializedName("restrictSearchableAttributes") - private List restrictSearchableAttributes = null; - - @SerializedName("ranking") - private List ranking = null; - - @SerializedName("customRanking") - private List customRanking = null; - - @SerializedName("relevancyStrictness") - private Integer relevancyStrictness = 100; - - @SerializedName("attributesToHighlight") - private List attributesToHighlight = null; - - @SerializedName("attributesToSnippet") - private List attributesToSnippet = null; - - @SerializedName("highlightPreTag") - private String highlightPreTag = ""; - - @SerializedName("highlightPostTag") - private String highlightPostTag = ""; - - @SerializedName("snippetEllipsisText") - private String snippetEllipsisText = "…"; - - @SerializedName("restrictHighlightAndSnippetArrays") - private Boolean restrictHighlightAndSnippetArrays = false; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("minWordSizefor1Typo") - private Integer minWordSizefor1Typo = 4; - - @SerializedName("minWordSizefor2Typos") - private Integer minWordSizefor2Typos = 8; - - /** Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) - public enum TypoToleranceEnum { - TRUE("true"), - - FALSE("false"), - - MIN("min"), - - STRICT("strict"); - - private String value; - - TypoToleranceEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static TypoToleranceEnum fromValue(String value) { - for (TypoToleranceEnum b : TypoToleranceEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } - } - - @SerializedName("typoTolerance") - private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - - @SerializedName("allowTyposOnNumericTokens") - private Boolean allowTyposOnNumericTokens = true; - - @SerializedName("disableTypoToleranceOnAttributes") - private List disableTypoToleranceOnAttributes = null; - - @SerializedName("separatorsToIndex") - private String separatorsToIndex = ""; - - @SerializedName("ignorePlurals") - private String ignorePlurals = "false"; - - @SerializedName("removeStopWords") - private String removeStopWords = "false"; - - @SerializedName("keepDiacriticsOnCharacters") - private String keepDiacriticsOnCharacters = ""; - - @SerializedName("queryLanguages") - private List queryLanguages = null; - - @SerializedName("decompoundQuery") - private Boolean decompoundQuery = true; - - @SerializedName("enableRules") - private Boolean enableRules = true; - - @SerializedName("enablePersonalization") - private Boolean enablePersonalization = false; - - /** Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) - public enum QueryTypeEnum { - PREFIXLAST("prefixLast"), - - PREFIXALL("prefixAll"), - - PREFIXNONE("prefixNone"); - - private String value; - - QueryTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static QueryTypeEnum fromValue(String value) { - for (QueryTypeEnum b : QueryTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } - } - - @SerializedName("queryType") - private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - - /** Selects a strategy to remove words from the query when it doesn't match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) - public enum RemoveWordsIfNoResultsEnum { - NONE("none"), - - LASTWORDS("lastWords"), - - FIRSTWORDS("firstWords"), - - ALLOPTIONAL("allOptional"); - - private String value; - - RemoveWordsIfNoResultsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RemoveWordsIfNoResultsEnum fromValue(String value) { - for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } - } - - @SerializedName("removeWordsIfNoResults") - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = - RemoveWordsIfNoResultsEnum.NONE; - - @SerializedName("advancedSyntax") - private Boolean advancedSyntax = false; - - @SerializedName("optionalWords") - private List optionalWords = null; - - @SerializedName("disableExactOnAttributes") - private List disableExactOnAttributes = null; - - /** Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) - public enum ExactOnSingleWordQueryEnum { - ATTRIBUTE("attribute"), - - NONE("none"), - - WORD("word"); - - private String value; - - ExactOnSingleWordQueryEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ExactOnSingleWordQueryEnum fromValue(String value) { - for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } - } - - @SerializedName("exactOnSingleWordQuery") - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = - ExactOnSingleWordQueryEnum.ATTRIBUTE; - - /** Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) - public enum AlternativesAsExactEnum { - IGNOREPLURALS("ignorePlurals"), - - SINGLEWORDSYNONYM("singleWordSynonym"), - - MULTIWORDSSYNONYM("multiWordsSynonym"); - - private String value; - - AlternativesAsExactEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AlternativesAsExactEnum fromValue(String value) { - for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } - } - - @SerializedName("alternativesAsExact") - private List alternativesAsExact = null; - - /** Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) - public enum AdvancedSyntaxFeaturesEnum { - EXACTPHRASE("exactPhrase"), - - EXCLUDEWORDS("excludeWords"); - - private String value; - - AdvancedSyntaxFeaturesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AdvancedSyntaxFeaturesEnum fromValue(String value) { - for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } - } - - @SerializedName("advancedSyntaxFeatures") - private List advancedSyntaxFeatures = null; - - @SerializedName("distinct") - private Integer distinct = 0; - - @SerializedName("synonyms") - private Boolean synonyms = true; - - @SerializedName("replaceSynonymsInHighlight") - private Boolean replaceSynonymsInHighlight = false; - - @SerializedName("minProximity") - private Integer minProximity = 1; - - @SerializedName("responseFields") - private List responseFields = null; - - @SerializedName("maxFacetHits") - private Integer maxFacetHits = 10; - - @SerializedName("attributeCriteriaComputedByMinProximity") - private Boolean attributeCriteriaComputedByMinProximity = false; - - @SerializedName("renderingContent") - private Object renderingContent = new Object(); - - public ConsequenceParams query(String query) { - this.query = query; - return this; - } - - /** - * Query string. - * - * @return query - */ - @javax.annotation.Nullable - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public ConsequenceParams automaticFacetFilters( - List automaticFacetFilters - ) { - this.automaticFacetFilters = automaticFacetFilters; - return this; - } - - public ConsequenceParams addAutomaticFacetFiltersItem( - AutomaticFacetFilter automaticFacetFiltersItem - ) { - if (this.automaticFacetFilters == null) { - this.automaticFacetFilters = new ArrayList<>(); - } - this.automaticFacetFilters.add(automaticFacetFiltersItem); - return this; - } - - /** - * Names of facets to which automatic filtering must be applied; they must match the facet name of - * a facet value placeholder in the query pattern. - * - * @return automaticFacetFilters - */ - @javax.annotation.Nullable - public List getAutomaticFacetFilters() { - return automaticFacetFilters; - } - - public void setAutomaticFacetFilters( - List automaticFacetFilters - ) { - this.automaticFacetFilters = automaticFacetFilters; - } - - public ConsequenceParams automaticOptionalFacetFilters( - List automaticOptionalFacetFilters - ) { - this.automaticOptionalFacetFilters = automaticOptionalFacetFilters; - return this; - } - - public ConsequenceParams addAutomaticOptionalFacetFiltersItem( - AutomaticFacetFilter automaticOptionalFacetFiltersItem - ) { - if (this.automaticOptionalFacetFilters == null) { - this.automaticOptionalFacetFilters = new ArrayList<>(); - } - this.automaticOptionalFacetFilters.add(automaticOptionalFacetFiltersItem); - return this; - } - - /** - * Same syntax as automaticFacetFilters, but the engine treats the filters as optional. - * - * @return automaticOptionalFacetFilters - */ - @javax.annotation.Nullable - public List getAutomaticOptionalFacetFilters() { - return automaticOptionalFacetFilters; - } - - public void setAutomaticOptionalFacetFilters( - List automaticOptionalFacetFilters - ) { - this.automaticOptionalFacetFilters = automaticOptionalFacetFilters; - } - - public ConsequenceParams similarQuery(String similarQuery) { - this.similarQuery = similarQuery; - return this; - } - - /** - * Overrides the query parameter and performs a more generic search that can be used to find - * \"similar\" results. - * - * @return similarQuery - */ - @javax.annotation.Nullable - public String getSimilarQuery() { - return similarQuery; - } - - public void setSimilarQuery(String similarQuery) { - this.similarQuery = similarQuery; - } - - public ConsequenceParams filters(String filters) { - this.filters = filters; - return this; - } - - /** - * Filter the query with numeric, facet and/or tag filters. - * - * @return filters - */ - @javax.annotation.Nullable - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } - - public ConsequenceParams facetFilters(List facetFilters) { - this.facetFilters = facetFilters; - return this; - } - - public ConsequenceParams addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - - /** - * Filter hits by facet value. - * - * @return facetFilters - */ - @javax.annotation.Nullable - public List getFacetFilters() { - return facetFilters; - } - - public void setFacetFilters(List facetFilters) { - this.facetFilters = facetFilters; - } - - public ConsequenceParams optionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - return this; - } - - public ConsequenceParams addOptionalFiltersItem(String optionalFiltersItem) { - if (this.optionalFilters == null) { - this.optionalFilters = new ArrayList<>(); - } - this.optionalFilters.add(optionalFiltersItem); - return this; - } - - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or - * lower in the case of a negative optional filter. - * - * @return optionalFilters - */ - @javax.annotation.Nullable - public List getOptionalFilters() { - return optionalFilters; - } - - public void setOptionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - } - - public ConsequenceParams numericFilters(List numericFilters) { - this.numericFilters = numericFilters; - return this; - } - - public ConsequenceParams addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - - /** - * Filter on numeric attributes. - * - * @return numericFilters - */ - @javax.annotation.Nullable - public List getNumericFilters() { - return numericFilters; - } - - public void setNumericFilters(List numericFilters) { - this.numericFilters = numericFilters; - } - - public ConsequenceParams tagFilters(List tagFilters) { - this.tagFilters = tagFilters; - return this; - } - - public ConsequenceParams addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - - /** - * Filter hits by tags. - * - * @return tagFilters - */ - @javax.annotation.Nullable - public List getTagFilters() { - return tagFilters; - } - - public void setTagFilters(List tagFilters) { - this.tagFilters = tagFilters; - } - - public ConsequenceParams sumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - return this; - } - - /** - * Determines how to calculate the total score for filtering. - * - * @return sumOrFiltersScores - */ - @javax.annotation.Nullable - public Boolean getSumOrFiltersScores() { - return sumOrFiltersScores; - } - - public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - } - - public ConsequenceParams facets(List facets) { - this.facets = facets; - return this; - } - - public ConsequenceParams addFacetsItem(String facetsItem) { - if (this.facets == null) { - this.facets = new ArrayList<>(); - } - this.facets.add(facetsItem); - return this; - } - - /** - * Retrieve facets and their facet values. - * - * @return facets - */ - @javax.annotation.Nullable - public List getFacets() { - return facets; - } - - public void setFacets(List facets) { - this.facets = facets; - } - - public ConsequenceParams maxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - return this; - } - - /** - * Maximum number of facet values to return for each facet during a regular search. - * - * @return maxValuesPerFacet - */ - @javax.annotation.Nullable - public Integer getMaxValuesPerFacet() { - return maxValuesPerFacet; - } - - public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - } - - public ConsequenceParams facetingAfterDistinct( - Boolean facetingAfterDistinct - ) { - this.facetingAfterDistinct = facetingAfterDistinct; - return this; - } - - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - * - * @return facetingAfterDistinct - */ - @javax.annotation.Nullable - public Boolean getFacetingAfterDistinct() { - return facetingAfterDistinct; - } - - public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; - } - - public ConsequenceParams sortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - return this; - } - - /** - * Controls how facet values are fetched. - * - * @return sortFacetValuesBy - */ - @javax.annotation.Nullable - public String getSortFacetValuesBy() { - return sortFacetValuesBy; - } - - public void setSortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - } - - public ConsequenceParams page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public ConsequenceParams offset(Integer offset) { - this.offset = offset; - return this; - } - - /** - * Specify the offset of the first hit to return. - * - * @return offset - */ - @javax.annotation.Nullable - public Integer getOffset() { - return offset; - } - - public void setOffset(Integer offset) { - this.offset = offset; - } - - public ConsequenceParams length(Integer length) { - this.length = length; - return this; - } - - /** - * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 - * - * @return length - */ - @javax.annotation.Nullable - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public ConsequenceParams aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public ConsequenceParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - return this; - } - - /** - * Search for entries around a given location automatically computed from the requester's IP - * address. - * - * @return aroundLatLngViaIP - */ - @javax.annotation.Nullable - public Boolean getAroundLatLngViaIP() { - return aroundLatLngViaIP; - } - - public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - } - - public ConsequenceParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - return this; - } - - /** - * Define the maximum radius for a geo search (in meters). - * - * @return aroundRadius - */ - @javax.annotation.Nullable - public OneOfintegerstring getAroundRadius() { - return aroundRadius; - } - - public void setAroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - } - - public ConsequenceParams aroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - return this; - } - - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - * - * @return aroundPrecision - */ - @javax.annotation.Nullable - public Integer getAroundPrecision() { - return aroundPrecision; - } - - public void setAroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - } - - public ConsequenceParams minimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - return this; - } - - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 - * - * @return minimumAroundRadius - */ - @javax.annotation.Nullable - public Integer getMinimumAroundRadius() { - return minimumAroundRadius; - } - - public void setMinimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - } - - public ConsequenceParams insideBoundingBox( - List insideBoundingBox - ) { - this.insideBoundingBox = insideBoundingBox; - return this; - } - - public ConsequenceParams addInsideBoundingBoxItem( - BigDecimal insideBoundingBoxItem - ) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Search inside a rectangular area (in geo coordinates). - * - * @return insideBoundingBox - */ - @javax.annotation.Nullable - public List getInsideBoundingBox() { - return insideBoundingBox; - } - - public void setInsideBoundingBox(List insideBoundingBox) { - this.insideBoundingBox = insideBoundingBox; - } - - public ConsequenceParams insidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - return this; - } - - public ConsequenceParams addInsidePolygonItem(BigDecimal insidePolygonItem) { - if (this.insidePolygon == null) { - this.insidePolygon = new ArrayList<>(); - } - this.insidePolygon.add(insidePolygonItem); - return this; - } - - /** - * Search inside a polygon (in geo coordinates). - * - * @return insidePolygon - */ - @javax.annotation.Nullable - public List getInsidePolygon() { - return insidePolygon; - } - - public void setInsidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - } - - public ConsequenceParams naturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - return this; - } - - public ConsequenceParams addNaturalLanguagesItem( - String naturalLanguagesItem - ) { - if (this.naturalLanguages == null) { - this.naturalLanguages = new ArrayList<>(); - } - this.naturalLanguages.add(naturalLanguagesItem); - return this; - } - - /** - * This parameter changes the default values of certain parameters and settings that work best for - * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, - * analyticsTags and ruleContexts. These parameters and settings work well together when the query - * is formatted in natural language instead of keywords, for example when your user performs a - * voice search. - * - * @return naturalLanguages - */ - @javax.annotation.Nullable - public List getNaturalLanguages() { - return naturalLanguages; - } - - public void setNaturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - } - - public ConsequenceParams ruleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - return this; - } - - public ConsequenceParams addRuleContextsItem(String ruleContextsItem) { - if (this.ruleContexts == null) { - this.ruleContexts = new ArrayList<>(); - } - this.ruleContexts.add(ruleContextsItem); - return this; - } - - /** - * Enables contextual rules. - * - * @return ruleContexts - */ - @javax.annotation.Nullable - public List getRuleContexts() { - return ruleContexts; - } - - public void setRuleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - } - - public ConsequenceParams personalizationImpact( - Integer personalizationImpact - ) { - this.personalizationImpact = personalizationImpact; - return this; - } - - /** - * Define the impact of the Personalization feature. - * - * @return personalizationImpact - */ - @javax.annotation.Nullable - public Integer getPersonalizationImpact() { - return personalizationImpact; - } - - public void setPersonalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; - } - - public ConsequenceParams userToken(String userToken) { - this.userToken = userToken; - return this; - } - - /** - * Associates a certain user token with the current search. - * - * @return userToken - */ - @javax.annotation.Nullable - public String getUserToken() { - return userToken; - } - - public void setUserToken(String userToken) { - this.userToken = userToken; - } - - public ConsequenceParams getRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - return this; - } - - /** - * Retrieve detailed ranking information. - * - * @return getRankingInfo - */ - @javax.annotation.Nullable - public Boolean getGetRankingInfo() { - return getRankingInfo; - } - - public void setGetRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - } - - public ConsequenceParams clickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - return this; - } - - /** - * Enable the Click Analytics feature. - * - * @return clickAnalytics - */ - @javax.annotation.Nullable - public Boolean getClickAnalytics() { - return clickAnalytics; - } - - public void setClickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - } - - public ConsequenceParams analytics(Boolean analytics) { - this.analytics = analytics; - return this; - } - - /** - * Whether the current query will be taken into account in the Analytics. - * - * @return analytics - */ - @javax.annotation.Nullable - public Boolean getAnalytics() { - return analytics; - } - - public void setAnalytics(Boolean analytics) { - this.analytics = analytics; - } - - public ConsequenceParams analyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - return this; - } - - public ConsequenceParams addAnalyticsTagsItem(String analyticsTagsItem) { - if (this.analyticsTags == null) { - this.analyticsTags = new ArrayList<>(); - } - this.analyticsTags.add(analyticsTagsItem); - return this; - } - - /** - * List of tags to apply to the query for analytics purposes. - * - * @return analyticsTags - */ - @javax.annotation.Nullable - public List getAnalyticsTags() { - return analyticsTags; - } - - public void setAnalyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - } - - public ConsequenceParams percentileComputation( - Boolean percentileComputation - ) { - this.percentileComputation = percentileComputation; - return this; - } - - /** - * Whether to include or exclude a query from the processing-time percentile computation. - * - * @return percentileComputation - */ - @javax.annotation.Nullable - public Boolean getPercentileComputation() { - return percentileComputation; - } - - public void setPercentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; - } - - public ConsequenceParams enableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - return this; - } - - /** - * Whether this search should participate in running AB tests. - * - * @return enableABTest - */ - @javax.annotation.Nullable - public Boolean getEnableABTest() { - return enableABTest; - } - - public void setEnableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - } - - public ConsequenceParams enableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - return this; - } - - /** - * Whether this search should use AI Re-Ranking. - * - * @return enableReRanking - */ - @javax.annotation.Nullable - public Boolean getEnableReRanking() { - return enableReRanking; - } - - public void setEnableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - } - - public ConsequenceParams searchableAttributes( - List searchableAttributes - ) { - this.searchableAttributes = searchableAttributes; - return this; - } - - public ConsequenceParams addSearchableAttributesItem( - String searchableAttributesItem - ) { - if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList<>(); - } - this.searchableAttributes.add(searchableAttributesItem); - return this; - } - - /** - * The complete list of attributes used for searching. - * - * @return searchableAttributes - */ - @javax.annotation.Nullable - public List getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public ConsequenceParams attributesForFaceting( - List attributesForFaceting - ) { - this.attributesForFaceting = attributesForFaceting; - return this; - } - - public ConsequenceParams addAttributesForFacetingItem( - String attributesForFacetingItem - ) { - if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList<>(); - } - this.attributesForFaceting.add(attributesForFacetingItem); - return this; - } - - /** - * The complete list of attributes that will be used for faceting. - * - * @return attributesForFaceting - */ - @javax.annotation.Nullable - public List getAttributesForFaceting() { - return attributesForFaceting; - } - - public void setAttributesForFaceting(List attributesForFaceting) { - this.attributesForFaceting = attributesForFaceting; - } - - public ConsequenceParams unretrievableAttributes( - List unretrievableAttributes - ) { - this.unretrievableAttributes = unretrievableAttributes; - return this; - } - - public ConsequenceParams addUnretrievableAttributesItem( - String unretrievableAttributesItem - ) { - if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList<>(); - } - this.unretrievableAttributes.add(unretrievableAttributesItem); - return this; - } - - /** - * List of attributes that can't be retrieved at query time. - * - * @return unretrievableAttributes - */ - @javax.annotation.Nullable - public List getUnretrievableAttributes() { - return unretrievableAttributes; - } - - public void setUnretrievableAttributes(List unretrievableAttributes) { - this.unretrievableAttributes = unretrievableAttributes; - } - - public ConsequenceParams attributesToRetrieve( - List attributesToRetrieve - ) { - this.attributesToRetrieve = attributesToRetrieve; - return this; - } - - public ConsequenceParams addAttributesToRetrieveItem( - String attributesToRetrieveItem - ) { - if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList<>(); - } - this.attributesToRetrieve.add(attributesToRetrieveItem); - return this; - } - - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - * - * @return attributesToRetrieve - */ - @javax.annotation.Nullable - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public void setAttributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - } - - public ConsequenceParams restrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - return this; - } - - public ConsequenceParams addRestrictSearchableAttributesItem( - String restrictSearchableAttributesItem - ) { - if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList<>(); - } - this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); - return this; - } - - /** - * Restricts a given query to look in only a subset of your searchable attributes. - * - * @return restrictSearchableAttributes - */ - @javax.annotation.Nullable - public List getRestrictSearchableAttributes() { - return restrictSearchableAttributes; - } - - public void setRestrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - } - - public ConsequenceParams ranking(List ranking) { - this.ranking = ranking; - return this; - } - - public ConsequenceParams addRankingItem(String rankingItem) { - if (this.ranking == null) { - this.ranking = new ArrayList<>(); - } - this.ranking.add(rankingItem); - return this; - } - - /** - * Controls how Algolia should sort your results. - * - * @return ranking - */ - @javax.annotation.Nullable - public List getRanking() { - return ranking; - } - - public void setRanking(List ranking) { - this.ranking = ranking; - } - - public ConsequenceParams customRanking(List customRanking) { - this.customRanking = customRanking; - return this; - } - - public ConsequenceParams addCustomRankingItem(String customRankingItem) { - if (this.customRanking == null) { - this.customRanking = new ArrayList<>(); - } - this.customRanking.add(customRankingItem); - return this; - } - - /** - * Specifies the custom ranking criterion. - * - * @return customRanking - */ - @javax.annotation.Nullable - public List getCustomRanking() { - return customRanking; - } - - public void setCustomRanking(List customRanking) { - this.customRanking = customRanking; - } - - public ConsequenceParams relevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - return this; - } - - /** - * Controls the relevancy threshold below which less relevant results aren't included in the - * results. - * - * @return relevancyStrictness - */ - @javax.annotation.Nullable - public Integer getRelevancyStrictness() { - return relevancyStrictness; - } - - public void setRelevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - } - - public ConsequenceParams attributesToHighlight( - List attributesToHighlight - ) { - this.attributesToHighlight = attributesToHighlight; - return this; - } - - public ConsequenceParams addAttributesToHighlightItem( - String attributesToHighlightItem - ) { - if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList<>(); - } - this.attributesToHighlight.add(attributesToHighlightItem); - return this; - } - - /** - * List of attributes to highlight. - * - * @return attributesToHighlight - */ - @javax.annotation.Nullable - public List getAttributesToHighlight() { - return attributesToHighlight; - } - - public void setAttributesToHighlight(List attributesToHighlight) { - this.attributesToHighlight = attributesToHighlight; - } - - public ConsequenceParams attributesToSnippet( - List attributesToSnippet - ) { - this.attributesToSnippet = attributesToSnippet; - return this; - } - - public ConsequenceParams addAttributesToSnippetItem( - String attributesToSnippetItem - ) { - if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList<>(); - } - this.attributesToSnippet.add(attributesToSnippetItem); - return this; - } - - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - * - * @return attributesToSnippet - */ - @javax.annotation.Nullable - public List getAttributesToSnippet() { - return attributesToSnippet; - } - - public void setAttributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - } - - public ConsequenceParams highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - return this; - } - - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - * - * @return highlightPreTag - */ - @javax.annotation.Nullable - public String getHighlightPreTag() { - return highlightPreTag; - } - - public void setHighlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - } - - public ConsequenceParams highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - return this; - } - - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - * - * @return highlightPostTag - */ - @javax.annotation.Nullable - public String getHighlightPostTag() { - return highlightPostTag; - } - - public void setHighlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - } - - public ConsequenceParams snippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - return this; - } - - /** - * String used as an ellipsis indicator when a snippet is truncated. - * - * @return snippetEllipsisText - */ - @javax.annotation.Nullable - public String getSnippetEllipsisText() { - return snippetEllipsisText; - } - - public void setSnippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - } - - public ConsequenceParams restrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - return this; - } - - /** - * Restrict highlighting and snippeting to items that matched the query. - * - * @return restrictHighlightAndSnippetArrays - */ - @javax.annotation.Nullable - public Boolean getRestrictHighlightAndSnippetArrays() { - return restrictHighlightAndSnippetArrays; - } - - public void setRestrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - } - - public ConsequenceParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public ConsequenceParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 - * typo. - * - * @return minWordSizefor1Typo - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor1Typo() { - return minWordSizefor1Typo; - } - - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - } - - public ConsequenceParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 - * typos. - * - * @return minWordSizefor2Typos - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor2Typos() { - return minWordSizefor2Typos; - } - - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - } - - public ConsequenceParams typoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - return this; - } - - /** - * Controls whether typo tolerance is enabled and how it is applied. - * - * @return typoTolerance - */ - @javax.annotation.Nullable - public TypoToleranceEnum getTypoTolerance() { - return typoTolerance; - } - - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - } - - public ConsequenceParams allowTyposOnNumericTokens( - Boolean allowTyposOnNumericTokens - ) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - return this; - } - - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - * - * @return allowTyposOnNumericTokens - */ - @javax.annotation.Nullable - public Boolean getAllowTyposOnNumericTokens() { - return allowTyposOnNumericTokens; - } - - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - } - - public ConsequenceParams disableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - return this; - } - - public ConsequenceParams addDisableTypoToleranceOnAttributesItem( - String disableTypoToleranceOnAttributesItem - ) { - if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList<>(); - } - this.disableTypoToleranceOnAttributes.add( - disableTypoToleranceOnAttributesItem - ); - return this; - } - - /** - * List of attributes on which you want to disable typo tolerance. - * - * @return disableTypoToleranceOnAttributes - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnAttributes() { - return disableTypoToleranceOnAttributes; - } - - public void setDisableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - } - - public ConsequenceParams separatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - return this; - } - - /** - * Control which separators are indexed. - * - * @return separatorsToIndex - */ - @javax.annotation.Nullable - public String getSeparatorsToIndex() { - return separatorsToIndex; - } - - public void setSeparatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - } - - public ConsequenceParams ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - return this; - } - - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - * - * @return ignorePlurals - */ - @javax.annotation.Nullable - public String getIgnorePlurals() { - return ignorePlurals; - } - - public void setIgnorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - } - - public ConsequenceParams removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - return this; - } - - /** - * Removes stop (common) words from the query before executing it. - * - * @return removeStopWords - */ - @javax.annotation.Nullable - public String getRemoveStopWords() { - return removeStopWords; - } - - public void setRemoveStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - } - - public ConsequenceParams keepDiacriticsOnCharacters( - String keepDiacriticsOnCharacters - ) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - return this; - } - - /** - * List of characters that the engine shouldn't automatically normalize. - * - * @return keepDiacriticsOnCharacters - */ - @javax.annotation.Nullable - public String getKeepDiacriticsOnCharacters() { - return keepDiacriticsOnCharacters; - } - - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - } - - public ConsequenceParams queryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - return this; - } - - public ConsequenceParams addQueryLanguagesItem(String queryLanguagesItem) { - if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList<>(); - } - this.queryLanguages.add(queryLanguagesItem); - return this; - } - - /** - * Sets the languages to be used by language-specific settings and functionalities such as - * ignorePlurals, removeStopWords, and CJK word-detection. - * - * @return queryLanguages - */ - @javax.annotation.Nullable - public List getQueryLanguages() { - return queryLanguages; - } - - public void setQueryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - } - - public ConsequenceParams decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - return this; - } - - /** - * Splits compound words into their composing atoms in the query. - * - * @return decompoundQuery - */ - @javax.annotation.Nullable - public Boolean getDecompoundQuery() { - return decompoundQuery; - } - - public void setDecompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - } - - public ConsequenceParams enableRules(Boolean enableRules) { - this.enableRules = enableRules; - return this; - } - - /** - * Whether Rules should be globally enabled. - * - * @return enableRules - */ - @javax.annotation.Nullable - public Boolean getEnableRules() { - return enableRules; - } - - public void setEnableRules(Boolean enableRules) { - this.enableRules = enableRules; - } - - public ConsequenceParams enablePersonalization( - Boolean enablePersonalization - ) { - this.enablePersonalization = enablePersonalization; - return this; - } - - /** - * Enable the Personalization feature. - * - * @return enablePersonalization - */ - @javax.annotation.Nullable - public Boolean getEnablePersonalization() { - return enablePersonalization; - } - - public void setEnablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - } - - public ConsequenceParams queryType(QueryTypeEnum queryType) { - this.queryType = queryType; - return this; - } - - /** - * Controls if and how query words are interpreted as prefixes. - * - * @return queryType - */ - @javax.annotation.Nullable - public QueryTypeEnum getQueryType() { - return queryType; - } - - public void setQueryType(QueryTypeEnum queryType) { - this.queryType = queryType; - } - - public ConsequenceParams removeWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - return this; - } - - /** - * Selects a strategy to remove words from the query when it doesn't match any hits. - * - * @return removeWordsIfNoResults - */ - @javax.annotation.Nullable - public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { - return removeWordsIfNoResults; - } - - public void setRemoveWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - } - - public ConsequenceParams advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - return this; - } - - /** - * Enables the advanced query syntax. - * - * @return advancedSyntax - */ - @javax.annotation.Nullable - public Boolean getAdvancedSyntax() { - return advancedSyntax; - } - - public void setAdvancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - } - - public ConsequenceParams optionalWords(List optionalWords) { - this.optionalWords = optionalWords; - return this; - } - - public ConsequenceParams addOptionalWordsItem(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * A list of words that should be considered as optional when found in the query. - * - * @return optionalWords - */ - @javax.annotation.Nullable - public List getOptionalWords() { - return optionalWords; - } - - public void setOptionalWords(List optionalWords) { - this.optionalWords = optionalWords; - } - - public ConsequenceParams disableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - return this; - } - - public ConsequenceParams addDisableExactOnAttributesItem( - String disableExactOnAttributesItem - ) { - if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList<>(); - } - this.disableExactOnAttributes.add(disableExactOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable the exact ranking criterion. - * - * @return disableExactOnAttributes - */ - @javax.annotation.Nullable - public List getDisableExactOnAttributes() { - return disableExactOnAttributes; - } - - public void setDisableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - } - - public ConsequenceParams exactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - return this; - } - - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - * - * @return exactOnSingleWordQuery - */ - @javax.annotation.Nullable - public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { - return exactOnSingleWordQuery; - } - - public void setExactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - } - - public ConsequenceParams alternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - return this; - } - - public ConsequenceParams addAlternativesAsExactItem( - AlternativesAsExactEnum alternativesAsExactItem - ) { - if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList<>(); - } - this.alternativesAsExact.add(alternativesAsExactItem); - return this; - } - - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - * - * @return alternativesAsExact - */ - @javax.annotation.Nullable - public List getAlternativesAsExact() { - return alternativesAsExact; - } - - public void setAlternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - } - - public ConsequenceParams advancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - return this; - } - - public ConsequenceParams addAdvancedSyntaxFeaturesItem( - AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem - ) { - if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList<>(); - } - this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); - return this; - } - - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is - * enabled. - * - * @return advancedSyntaxFeatures - */ - @javax.annotation.Nullable - public List getAdvancedSyntaxFeatures() { - return advancedSyntaxFeatures; - } - - public void setAdvancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - } - - public ConsequenceParams distinct(Integer distinct) { - this.distinct = distinct; - return this; - } - - /** - * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 - * - * @return distinct - */ - @javax.annotation.Nullable - public Integer getDistinct() { - return distinct; - } - - public void setDistinct(Integer distinct) { - this.distinct = distinct; - } - - public ConsequenceParams synonyms(Boolean synonyms) { - this.synonyms = synonyms; - return this; - } - - /** - * Whether to take into account an index's synonyms for a particular search. - * - * @return synonyms - */ - @javax.annotation.Nullable - public Boolean getSynonyms() { - return synonyms; - } - - public void setSynonyms(Boolean synonyms) { - this.synonyms = synonyms; - } - - public ConsequenceParams replaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - return this; - } - - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym - * itself. - * - * @return replaceSynonymsInHighlight - */ - @javax.annotation.Nullable - public Boolean getReplaceSynonymsInHighlight() { - return replaceSynonymsInHighlight; - } - - public void setReplaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - } - - public ConsequenceParams minProximity(Integer minProximity) { - this.minProximity = minProximity; - return this; - } - - /** - * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 - * - * @return minProximity - */ - @javax.annotation.Nullable - public Integer getMinProximity() { - return minProximity; - } - - public void setMinProximity(Integer minProximity) { - this.minProximity = minProximity; - } - - public ConsequenceParams responseFields(List responseFields) { - this.responseFields = responseFields; - return this; - } - - public ConsequenceParams addResponseFieldsItem(String responseFieldsItem) { - if (this.responseFields == null) { - this.responseFields = new ArrayList<>(); - } - this.responseFields.add(responseFieldsItem); - return this; - } - - /** - * Choose which fields to return in the API response. This parameters applies to search and browse - * queries. - * - * @return responseFields - */ - @javax.annotation.Nullable - public List getResponseFields() { - return responseFields; - } - - public void setResponseFields(List responseFields) { - this.responseFields = responseFields; - } - - public ConsequenceParams maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet hits to return during a search for facet values. For performance - * reasons, the maximum allowed number of returned values is 100. maximum: 100 - * - * @return maxFacetHits - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - - public void setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - } - - public ConsequenceParams attributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - return this; - } - - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select - * which searchable attribute is matched in the attribute ranking stage. - * - * @return attributeCriteriaComputedByMinProximity - */ - @javax.annotation.Nullable - public Boolean getAttributeCriteriaComputedByMinProximity() { - return attributeCriteriaComputedByMinProximity; - } - - public void setAttributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - } - - public ConsequenceParams renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a - * default value and can be overridden via rules. - * - * @return renderingContent - */ - @javax.annotation.Nullable - public Object getRenderingContent() { - return renderingContent; - } - - public void setRenderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConsequenceParams consequenceParams = (ConsequenceParams) o; - return ( - Objects.equals(this.query, consequenceParams.query) && - Objects.equals( - this.automaticFacetFilters, - consequenceParams.automaticFacetFilters - ) && - Objects.equals( - this.automaticOptionalFacetFilters, - consequenceParams.automaticOptionalFacetFilters - ) && - Objects.equals(this.similarQuery, consequenceParams.similarQuery) && - Objects.equals(this.filters, consequenceParams.filters) && - Objects.equals(this.facetFilters, consequenceParams.facetFilters) && - Objects.equals(this.optionalFilters, consequenceParams.optionalFilters) && - Objects.equals(this.numericFilters, consequenceParams.numericFilters) && - Objects.equals(this.tagFilters, consequenceParams.tagFilters) && - Objects.equals( - this.sumOrFiltersScores, - consequenceParams.sumOrFiltersScores - ) && - Objects.equals(this.facets, consequenceParams.facets) && - Objects.equals( - this.maxValuesPerFacet, - consequenceParams.maxValuesPerFacet - ) && - Objects.equals( - this.facetingAfterDistinct, - consequenceParams.facetingAfterDistinct - ) && - Objects.equals( - this.sortFacetValuesBy, - consequenceParams.sortFacetValuesBy - ) && - Objects.equals(this.page, consequenceParams.page) && - Objects.equals(this.offset, consequenceParams.offset) && - Objects.equals(this.length, consequenceParams.length) && - Objects.equals(this.aroundLatLng, consequenceParams.aroundLatLng) && - Objects.equals( - this.aroundLatLngViaIP, - consequenceParams.aroundLatLngViaIP - ) && - Objects.equals(this.aroundRadius, consequenceParams.aroundRadius) && - Objects.equals(this.aroundPrecision, consequenceParams.aroundPrecision) && - Objects.equals( - this.minimumAroundRadius, - consequenceParams.minimumAroundRadius - ) && - Objects.equals( - this.insideBoundingBox, - consequenceParams.insideBoundingBox - ) && - Objects.equals(this.insidePolygon, consequenceParams.insidePolygon) && - Objects.equals( - this.naturalLanguages, - consequenceParams.naturalLanguages - ) && - Objects.equals(this.ruleContexts, consequenceParams.ruleContexts) && - Objects.equals( - this.personalizationImpact, - consequenceParams.personalizationImpact - ) && - Objects.equals(this.userToken, consequenceParams.userToken) && - Objects.equals(this.getRankingInfo, consequenceParams.getRankingInfo) && - Objects.equals(this.clickAnalytics, consequenceParams.clickAnalytics) && - Objects.equals(this.analytics, consequenceParams.analytics) && - Objects.equals(this.analyticsTags, consequenceParams.analyticsTags) && - Objects.equals( - this.percentileComputation, - consequenceParams.percentileComputation - ) && - Objects.equals(this.enableABTest, consequenceParams.enableABTest) && - Objects.equals(this.enableReRanking, consequenceParams.enableReRanking) && - Objects.equals( - this.searchableAttributes, - consequenceParams.searchableAttributes - ) && - Objects.equals( - this.attributesForFaceting, - consequenceParams.attributesForFaceting - ) && - Objects.equals( - this.unretrievableAttributes, - consequenceParams.unretrievableAttributes - ) && - Objects.equals( - this.attributesToRetrieve, - consequenceParams.attributesToRetrieve - ) && - Objects.equals( - this.restrictSearchableAttributes, - consequenceParams.restrictSearchableAttributes - ) && - Objects.equals(this.ranking, consequenceParams.ranking) && - Objects.equals(this.customRanking, consequenceParams.customRanking) && - Objects.equals( - this.relevancyStrictness, - consequenceParams.relevancyStrictness - ) && - Objects.equals( - this.attributesToHighlight, - consequenceParams.attributesToHighlight - ) && - Objects.equals( - this.attributesToSnippet, - consequenceParams.attributesToSnippet - ) && - Objects.equals(this.highlightPreTag, consequenceParams.highlightPreTag) && - Objects.equals( - this.highlightPostTag, - consequenceParams.highlightPostTag - ) && - Objects.equals( - this.snippetEllipsisText, - consequenceParams.snippetEllipsisText - ) && - Objects.equals( - this.restrictHighlightAndSnippetArrays, - consequenceParams.restrictHighlightAndSnippetArrays - ) && - Objects.equals(this.hitsPerPage, consequenceParams.hitsPerPage) && - Objects.equals( - this.minWordSizefor1Typo, - consequenceParams.minWordSizefor1Typo - ) && - Objects.equals( - this.minWordSizefor2Typos, - consequenceParams.minWordSizefor2Typos - ) && - Objects.equals(this.typoTolerance, consequenceParams.typoTolerance) && - Objects.equals( - this.allowTyposOnNumericTokens, - consequenceParams.allowTyposOnNumericTokens - ) && - Objects.equals( - this.disableTypoToleranceOnAttributes, - consequenceParams.disableTypoToleranceOnAttributes - ) && - Objects.equals( - this.separatorsToIndex, - consequenceParams.separatorsToIndex - ) && - Objects.equals(this.ignorePlurals, consequenceParams.ignorePlurals) && - Objects.equals(this.removeStopWords, consequenceParams.removeStopWords) && - Objects.equals( - this.keepDiacriticsOnCharacters, - consequenceParams.keepDiacriticsOnCharacters - ) && - Objects.equals(this.queryLanguages, consequenceParams.queryLanguages) && - Objects.equals(this.decompoundQuery, consequenceParams.decompoundQuery) && - Objects.equals(this.enableRules, consequenceParams.enableRules) && - Objects.equals( - this.enablePersonalization, - consequenceParams.enablePersonalization - ) && - Objects.equals(this.queryType, consequenceParams.queryType) && - Objects.equals( - this.removeWordsIfNoResults, - consequenceParams.removeWordsIfNoResults - ) && - Objects.equals(this.advancedSyntax, consequenceParams.advancedSyntax) && - Objects.equals(this.optionalWords, consequenceParams.optionalWords) && - Objects.equals( - this.disableExactOnAttributes, - consequenceParams.disableExactOnAttributes - ) && - Objects.equals( - this.exactOnSingleWordQuery, - consequenceParams.exactOnSingleWordQuery - ) && - Objects.equals( - this.alternativesAsExact, - consequenceParams.alternativesAsExact - ) && - Objects.equals( - this.advancedSyntaxFeatures, - consequenceParams.advancedSyntaxFeatures - ) && - Objects.equals(this.distinct, consequenceParams.distinct) && - Objects.equals(this.synonyms, consequenceParams.synonyms) && - Objects.equals( - this.replaceSynonymsInHighlight, - consequenceParams.replaceSynonymsInHighlight - ) && - Objects.equals(this.minProximity, consequenceParams.minProximity) && - Objects.equals(this.responseFields, consequenceParams.responseFields) && - Objects.equals(this.maxFacetHits, consequenceParams.maxFacetHits) && - Objects.equals( - this.attributeCriteriaComputedByMinProximity, - consequenceParams.attributeCriteriaComputedByMinProximity - ) && - Objects.equals(this.renderingContent, consequenceParams.renderingContent) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - query, - automaticFacetFilters, - automaticOptionalFacetFilters, - similarQuery, - filters, - facetFilters, - optionalFilters, - numericFilters, - tagFilters, - sumOrFiltersScores, - facets, - maxValuesPerFacet, - facetingAfterDistinct, - sortFacetValuesBy, - page, - offset, - length, - aroundLatLng, - aroundLatLngViaIP, - aroundRadius, - aroundPrecision, - minimumAroundRadius, - insideBoundingBox, - insidePolygon, - naturalLanguages, - ruleContexts, - personalizationImpact, - userToken, - getRankingInfo, - clickAnalytics, - analytics, - analyticsTags, - percentileComputation, - enableABTest, - enableReRanking, - searchableAttributes, - attributesForFaceting, - unretrievableAttributes, - attributesToRetrieve, - restrictSearchableAttributes, - ranking, - customRanking, - relevancyStrictness, - attributesToHighlight, - attributesToSnippet, - highlightPreTag, - highlightPostTag, - snippetEllipsisText, - restrictHighlightAndSnippetArrays, - hitsPerPage, - minWordSizefor1Typo, - minWordSizefor2Typos, - typoTolerance, - allowTyposOnNumericTokens, - disableTypoToleranceOnAttributes, - separatorsToIndex, - ignorePlurals, - removeStopWords, - keepDiacriticsOnCharacters, - queryLanguages, - decompoundQuery, - enableRules, - enablePersonalization, - queryType, - removeWordsIfNoResults, - advancedSyntax, - optionalWords, - disableExactOnAttributes, - exactOnSingleWordQuery, - alternativesAsExact, - advancedSyntaxFeatures, - distinct, - synonyms, - replaceSynonymsInHighlight, - minProximity, - responseFields, - maxFacetHits, - attributeCriteriaComputedByMinProximity, - renderingContent - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConsequenceParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" automaticFacetFilters: ") - .append(toIndentedString(automaticFacetFilters)) - .append("\n"); - sb - .append(" automaticOptionalFacetFilters: ") - .append(toIndentedString(automaticOptionalFacetFilters)) - .append("\n"); - sb - .append(" similarQuery: ") - .append(toIndentedString(similarQuery)) - .append("\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb - .append(" facetFilters: ") - .append(toIndentedString(facetFilters)) - .append("\n"); - sb - .append(" optionalFilters: ") - .append(toIndentedString(optionalFilters)) - .append("\n"); - sb - .append(" numericFilters: ") - .append(toIndentedString(numericFilters)) - .append("\n"); - sb - .append(" tagFilters: ") - .append(toIndentedString(tagFilters)) - .append("\n"); - sb - .append(" sumOrFiltersScores: ") - .append(toIndentedString(sumOrFiltersScores)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" maxValuesPerFacet: ") - .append(toIndentedString(maxValuesPerFacet)) - .append("\n"); - sb - .append(" facetingAfterDistinct: ") - .append(toIndentedString(facetingAfterDistinct)) - .append("\n"); - sb - .append(" sortFacetValuesBy: ") - .append(toIndentedString(sortFacetValuesBy)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" aroundLatLngViaIP: ") - .append(toIndentedString(aroundLatLngViaIP)) - .append("\n"); - sb - .append(" aroundRadius: ") - .append(toIndentedString(aroundRadius)) - .append("\n"); - sb - .append(" aroundPrecision: ") - .append(toIndentedString(aroundPrecision)) - .append("\n"); - sb - .append(" minimumAroundRadius: ") - .append(toIndentedString(minimumAroundRadius)) - .append("\n"); - sb - .append(" insideBoundingBox: ") - .append(toIndentedString(insideBoundingBox)) - .append("\n"); - sb - .append(" insidePolygon: ") - .append(toIndentedString(insidePolygon)) - .append("\n"); - sb - .append(" naturalLanguages: ") - .append(toIndentedString(naturalLanguages)) - .append("\n"); - sb - .append(" ruleContexts: ") - .append(toIndentedString(ruleContexts)) - .append("\n"); - sb - .append(" personalizationImpact: ") - .append(toIndentedString(personalizationImpact)) - .append("\n"); - sb - .append(" userToken: ") - .append(toIndentedString(userToken)) - .append("\n"); - sb - .append(" getRankingInfo: ") - .append(toIndentedString(getRankingInfo)) - .append("\n"); - sb - .append(" clickAnalytics: ") - .append(toIndentedString(clickAnalytics)) - .append("\n"); - sb - .append(" analytics: ") - .append(toIndentedString(analytics)) - .append("\n"); - sb - .append(" analyticsTags: ") - .append(toIndentedString(analyticsTags)) - .append("\n"); - sb - .append(" percentileComputation: ") - .append(toIndentedString(percentileComputation)) - .append("\n"); - sb - .append(" enableABTest: ") - .append(toIndentedString(enableABTest)) - .append("\n"); - sb - .append(" enableReRanking: ") - .append(toIndentedString(enableReRanking)) - .append("\n"); - sb - .append(" searchableAttributes: ") - .append(toIndentedString(searchableAttributes)) - .append("\n"); - sb - .append(" attributesForFaceting: ") - .append(toIndentedString(attributesForFaceting)) - .append("\n"); - sb - .append(" unretrievableAttributes: ") - .append(toIndentedString(unretrievableAttributes)) - .append("\n"); - sb - .append(" attributesToRetrieve: ") - .append(toIndentedString(attributesToRetrieve)) - .append("\n"); - sb - .append(" restrictSearchableAttributes: ") - .append(toIndentedString(restrictSearchableAttributes)) - .append("\n"); - sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb - .append(" customRanking: ") - .append(toIndentedString(customRanking)) - .append("\n"); - sb - .append(" relevancyStrictness: ") - .append(toIndentedString(relevancyStrictness)) - .append("\n"); - sb - .append(" attributesToHighlight: ") - .append(toIndentedString(attributesToHighlight)) - .append("\n"); - sb - .append(" attributesToSnippet: ") - .append(toIndentedString(attributesToSnippet)) - .append("\n"); - sb - .append(" highlightPreTag: ") - .append(toIndentedString(highlightPreTag)) - .append("\n"); - sb - .append(" highlightPostTag: ") - .append(toIndentedString(highlightPostTag)) - .append("\n"); - sb - .append(" snippetEllipsisText: ") - .append(toIndentedString(snippetEllipsisText)) - .append("\n"); - sb - .append(" restrictHighlightAndSnippetArrays: ") - .append(toIndentedString(restrictHighlightAndSnippetArrays)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb - .append(" minWordSizefor1Typo: ") - .append(toIndentedString(minWordSizefor1Typo)) - .append("\n"); - sb - .append(" minWordSizefor2Typos: ") - .append(toIndentedString(minWordSizefor2Typos)) - .append("\n"); - sb - .append(" typoTolerance: ") - .append(toIndentedString(typoTolerance)) - .append("\n"); - sb - .append(" allowTyposOnNumericTokens: ") - .append(toIndentedString(allowTyposOnNumericTokens)) - .append("\n"); - sb - .append(" disableTypoToleranceOnAttributes: ") - .append(toIndentedString(disableTypoToleranceOnAttributes)) - .append("\n"); - sb - .append(" separatorsToIndex: ") - .append(toIndentedString(separatorsToIndex)) - .append("\n"); - sb - .append(" ignorePlurals: ") - .append(toIndentedString(ignorePlurals)) - .append("\n"); - sb - .append(" removeStopWords: ") - .append(toIndentedString(removeStopWords)) - .append("\n"); - sb - .append(" keepDiacriticsOnCharacters: ") - .append(toIndentedString(keepDiacriticsOnCharacters)) - .append("\n"); - sb - .append(" queryLanguages: ") - .append(toIndentedString(queryLanguages)) - .append("\n"); - sb - .append(" decompoundQuery: ") - .append(toIndentedString(decompoundQuery)) - .append("\n"); - sb - .append(" enableRules: ") - .append(toIndentedString(enableRules)) - .append("\n"); - sb - .append(" enablePersonalization: ") - .append(toIndentedString(enablePersonalization)) - .append("\n"); - sb - .append(" queryType: ") - .append(toIndentedString(queryType)) - .append("\n"); - sb - .append(" removeWordsIfNoResults: ") - .append(toIndentedString(removeWordsIfNoResults)) - .append("\n"); - sb - .append(" advancedSyntax: ") - .append(toIndentedString(advancedSyntax)) - .append("\n"); - sb - .append(" optionalWords: ") - .append(toIndentedString(optionalWords)) - .append("\n"); - sb - .append(" disableExactOnAttributes: ") - .append(toIndentedString(disableExactOnAttributes)) - .append("\n"); - sb - .append(" exactOnSingleWordQuery: ") - .append(toIndentedString(exactOnSingleWordQuery)) - .append("\n"); - sb - .append(" alternativesAsExact: ") - .append(toIndentedString(alternativesAsExact)) - .append("\n"); - sb - .append(" advancedSyntaxFeatures: ") - .append(toIndentedString(advancedSyntaxFeatures)) - .append("\n"); - sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb - .append(" replaceSynonymsInHighlight: ") - .append(toIndentedString(replaceSynonymsInHighlight)) - .append("\n"); - sb - .append(" minProximity: ") - .append(toIndentedString(minProximity)) - .append("\n"); - sb - .append(" responseFields: ") - .append(toIndentedString(responseFields)) - .append("\n"); - sb - .append(" maxFacetHits: ") - .append(toIndentedString(maxFacetHits)) - .append("\n"); - sb - .append(" attributeCriteriaComputedByMinProximity: ") - .append(toIndentedString(attributeCriteriaComputedByMinProximity)) - .append("\n"); - sb - .append(" renderingContent: ") - .append(toIndentedString(renderingContent)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtObject.java deleted file mode 100644 index f8a04ae4f0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtObject.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** CreatedAtObject */ -public class CreatedAtObject { - - @SerializedName("createdAt") - private String createdAt; - - public CreatedAtObject createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Date of creation (ISO-8601 format). - * - * @return createdAt - */ - @javax.annotation.Nonnull - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreatedAtObject createdAtObject = (CreatedAtObject) o; - return Objects.equals(this.createdAt, createdAtObject.createdAt); - } - - @Override - public int hashCode() { - return Objects.hash(createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreatedAtObject {\n"); - sb - .append(" createdAt: ") - .append(toIndentedString(createdAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtResponse.java deleted file mode 100644 index 2dcbfd7c2f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/CreatedAtResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** The response with a createdAt timestamp. */ -public class CreatedAtResponse { - - @SerializedName("createdAt") - private String createdAt; - - public CreatedAtResponse createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Date of creation (ISO-8601 format). - * - * @return createdAt - */ - @javax.annotation.Nonnull - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreatedAtResponse createdAtResponse = (CreatedAtResponse) o; - return Objects.equals(this.createdAt, createdAtResponse.createdAt); - } - - @Override - public int hashCode() { - return Objects.hash(createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreatedAtResponse {\n"); - sb - .append(" createdAt: ") - .append(toIndentedString(createdAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteApiKeyResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteApiKeyResponse.java deleted file mode 100644 index 7f2ce42eff..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteApiKeyResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** DeleteApiKeyResponse */ -public class DeleteApiKeyResponse { - - @SerializedName("deletedAt") - private String deletedAt; - - public DeleteApiKeyResponse deletedAt(String deletedAt) { - this.deletedAt = deletedAt; - return this; - } - - /** - * Date of deletion (ISO-8601 format). - * - * @return deletedAt - */ - @javax.annotation.Nonnull - public String getDeletedAt() { - return deletedAt; - } - - public void setDeletedAt(String deletedAt) { - this.deletedAt = deletedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeleteApiKeyResponse deleteApiKeyResponse = (DeleteApiKeyResponse) o; - return Objects.equals(this.deletedAt, deleteApiKeyResponse.deletedAt); - } - - @Override - public int hashCode() { - return Objects.hash(deletedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteApiKeyResponse {\n"); - sb - .append(" deletedAt: ") - .append(toIndentedString(deletedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java deleted file mode 100644 index e68fac932e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** DeleteSourceResponse */ -public class DeleteSourceResponse { - - @SerializedName("deletedAt") - private String deletedAt; - - public DeleteSourceResponse deletedAt(String deletedAt) { - this.deletedAt = deletedAt; - return this; - } - - /** - * Date of deletion (ISO-8601 format). - * - * @return deletedAt - */ - @javax.annotation.Nonnull - public String getDeletedAt() { - return deletedAt; - } - - public void setDeletedAt(String deletedAt) { - this.deletedAt = deletedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeleteSourceResponse deleteSourceResponse = (DeleteSourceResponse) o; - return Objects.equals(this.deletedAt, deleteSourceResponse.deletedAt); - } - - @Override - public int hashCode() { - return Objects.hash(deletedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteSourceResponse {\n"); - sb - .append(" deletedAt: ") - .append(toIndentedString(deletedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java deleted file mode 100644 index 352e3f257d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** The response with a taskID and a deletedAt timestamp. */ -public class DeletedAtResponse { - - @SerializedName("taskID") - private Integer taskID; - - @SerializedName("deletedAt") - private String deletedAt; - - public DeletedAtResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nonnull - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public DeletedAtResponse deletedAt(String deletedAt) { - this.deletedAt = deletedAt; - return this; - } - - /** - * Date of deletion (ISO-8601 format). - * - * @return deletedAt - */ - @javax.annotation.Nonnull - public String getDeletedAt() { - return deletedAt; - } - - public void setDeletedAt(String deletedAt) { - this.deletedAt = deletedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeletedAtResponse deletedAtResponse = (DeletedAtResponse) o; - return ( - Objects.equals(this.taskID, deletedAtResponse.taskID) && - Objects.equals(this.deletedAt, deletedAtResponse.deletedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, deletedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeletedAtResponse {\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb - .append(" deletedAt: ") - .append(toIndentedString(deletedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryAction.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryAction.java deleted file mode 100644 index e5de49834b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryAction.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Actions to perform. */ -@JsonAdapter(DictionaryAction.Adapter.class) -public enum DictionaryAction { - ADDENTRY("addEntry"), - - DELETEENTRY("deleteEntry"); - - private String value; - - DictionaryAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static DictionaryAction fromValue(String value) { - for (DictionaryAction b : DictionaryAction.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final DictionaryAction enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public DictionaryAction read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return DictionaryAction.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntry.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntry.java deleted file mode 100644 index d0b4bb179f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntry.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; - -/** A dictionary entry. */ -public class DictionaryEntry extends HashMap { - - @SerializedName("objectID") - private String objectID; - - @SerializedName("language") - private String language; - - @SerializedName("word") - private String word; - - @SerializedName("words") - private List words = null; - - @SerializedName("decomposition") - private List decomposition = null; - - @SerializedName("state") - private DictionaryEntryState state = DictionaryEntryState.ENABLED; - - public DictionaryEntry objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public DictionaryEntry language(String language) { - this.language = language; - return this; - } - - /** - * Language ISO code supported by the dictionary (e.g., \"en\" for English). - * - * @return language - */ - @javax.annotation.Nonnull - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public DictionaryEntry word(String word) { - this.word = word; - return this; - } - - /** - * The word of the dictionary entry. - * - * @return word - */ - @javax.annotation.Nullable - public String getWord() { - return word; - } - - public void setWord(String word) { - this.word = word; - } - - public DictionaryEntry words(List words) { - this.words = words; - return this; - } - - public DictionaryEntry addWordsItem(String wordsItem) { - if (this.words == null) { - this.words = new ArrayList<>(); - } - this.words.add(wordsItem); - return this; - } - - /** - * The words of the dictionary entry. - * - * @return words - */ - @javax.annotation.Nullable - public List getWords() { - return words; - } - - public void setWords(List words) { - this.words = words; - } - - public DictionaryEntry decomposition(List decomposition) { - this.decomposition = decomposition; - return this; - } - - public DictionaryEntry addDecompositionItem(String decompositionItem) { - if (this.decomposition == null) { - this.decomposition = new ArrayList<>(); - } - this.decomposition.add(decompositionItem); - return this; - } - - /** - * A decomposition of the word of the dictionary entry. - * - * @return decomposition - */ - @javax.annotation.Nullable - public List getDecomposition() { - return decomposition; - } - - public void setDecomposition(List decomposition) { - this.decomposition = decomposition; - } - - public DictionaryEntry state(DictionaryEntryState state) { - this.state = state; - return this; - } - - /** - * Get state - * - * @return state - */ - @javax.annotation.Nullable - public DictionaryEntryState getState() { - return state; - } - - public void setState(DictionaryEntryState state) { - this.state = state; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DictionaryEntry dictionaryEntry = (DictionaryEntry) o; - return ( - Objects.equals(this.objectID, dictionaryEntry.objectID) && - Objects.equals(this.language, dictionaryEntry.language) && - Objects.equals(this.word, dictionaryEntry.word) && - Objects.equals(this.words, dictionaryEntry.words) && - Objects.equals(this.decomposition, dictionaryEntry.decomposition) && - Objects.equals(this.state, dictionaryEntry.state) && - super.equals(o) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - objectID, - language, - word, - words, - decomposition, - state, - super.hashCode() - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DictionaryEntry {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb.append(" language: ").append(toIndentedString(language)).append("\n"); - sb.append(" word: ").append(toIndentedString(word)).append("\n"); - sb.append(" words: ").append(toIndentedString(words)).append("\n"); - sb - .append(" decomposition: ") - .append(toIndentedString(decomposition)) - .append("\n"); - sb.append(" state: ").append(toIndentedString(state)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntryState.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntryState.java deleted file mode 100644 index 99d55c2bce..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryEntryState.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** The state of the dictionary entry. */ -@JsonAdapter(DictionaryEntryState.Adapter.class) -public enum DictionaryEntryState { - ENABLED("enabled"), - - DISABLED("disabled"); - - private String value; - - DictionaryEntryState(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static DictionaryEntryState fromValue(String value) { - for (DictionaryEntryState b : DictionaryEntryState.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final DictionaryEntryState enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public DictionaryEntryState read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return DictionaryEntryState.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryLanguage.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryLanguage.java deleted file mode 100644 index fce794e0dc..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionaryLanguage.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Custom entries for a dictionary */ -public class DictionaryLanguage { - - @SerializedName("nbCustomEntires") - private Integer nbCustomEntires; - - public DictionaryLanguage nbCustomEntires(Integer nbCustomEntires) { - this.nbCustomEntires = nbCustomEntires; - return this; - } - - /** - * When nbCustomEntries is set to 0, the user didn't customize the dictionary. The dictionary is - * still supported with standard, Algolia-provided entries. - * - * @return nbCustomEntires - */ - @javax.annotation.Nullable - public Integer getNbCustomEntires() { - return nbCustomEntires; - } - - public void setNbCustomEntires(Integer nbCustomEntires) { - this.nbCustomEntires = nbCustomEntires; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DictionaryLanguage dictionaryLanguage = (DictionaryLanguage) o; - return Objects.equals( - this.nbCustomEntires, - dictionaryLanguage.nbCustomEntires - ); - } - - @Override - public int hashCode() { - return Objects.hash(nbCustomEntires); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DictionaryLanguage {\n"); - sb - .append(" nbCustomEntires: ") - .append(toIndentedString(nbCustomEntires)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionarySettingsParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionarySettingsParams.java deleted file mode 100644 index f4ca451420..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DictionarySettingsParams.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Disable the builtin Algolia entries for a type of dictionary per language. */ -public class DictionarySettingsParams { - - @SerializedName("disableStandardEntries") - private StandardEntries disableStandardEntries; - - public DictionarySettingsParams disableStandardEntries( - StandardEntries disableStandardEntries - ) { - this.disableStandardEntries = disableStandardEntries; - return this; - } - - /** - * Get disableStandardEntries - * - * @return disableStandardEntries - */ - @javax.annotation.Nonnull - public StandardEntries getDisableStandardEntries() { - return disableStandardEntries; - } - - public void setDisableStandardEntries( - StandardEntries disableStandardEntries - ) { - this.disableStandardEntries = disableStandardEntries; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DictionarySettingsParams dictionarySettingsParams = (DictionarySettingsParams) o; - return Objects.equals( - this.disableStandardEntries, - dictionarySettingsParams.disableStandardEntries - ); - } - - @Override - public int hashCode() { - return Objects.hash(disableStandardEntries); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DictionarySettingsParams {\n"); - sb - .append(" disableStandardEntries: ") - .append(toIndentedString(disableStandardEntries)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java deleted file mode 100644 index c2828bf5d9..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Objects; - -/** Error. */ -public class ErrorBase extends HashMap { - - @SerializedName("message") - private String message; - - public ErrorBase message(String message) { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ErrorBase errorBase = (ErrorBase) o; - return Objects.equals(this.message, errorBase.message) && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(message, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorBase {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetDictionarySettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetDictionarySettingsResponse.java deleted file mode 100644 index d622f2b32f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetDictionarySettingsResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** GetDictionarySettingsResponse */ -public class GetDictionarySettingsResponse { - - @SerializedName("disableStandardEntries") - private StandardEntries disableStandardEntries; - - public GetDictionarySettingsResponse disableStandardEntries( - StandardEntries disableStandardEntries - ) { - this.disableStandardEntries = disableStandardEntries; - return this; - } - - /** - * Get disableStandardEntries - * - * @return disableStandardEntries - */ - @javax.annotation.Nonnull - public StandardEntries getDisableStandardEntries() { - return disableStandardEntries; - } - - public void setDisableStandardEntries( - StandardEntries disableStandardEntries - ) { - this.disableStandardEntries = disableStandardEntries; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetDictionarySettingsResponse getDictionarySettingsResponse = (GetDictionarySettingsResponse) o; - return Objects.equals( - this.disableStandardEntries, - getDictionarySettingsResponse.disableStandardEntries - ); - } - - @Override - public int hashCode() { - return Objects.hash(disableStandardEntries); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDictionarySettingsResponse {\n"); - sb - .append(" disableStandardEntries: ") - .append(toIndentedString(disableStandardEntries)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponse.java deleted file mode 100644 index 346ab735ec..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** GetLogsResponse */ -public class GetLogsResponse { - - @SerializedName("logs") - private List logs = new ArrayList<>(); - - public GetLogsResponse logs(List logs) { - this.logs = logs; - return this; - } - - public GetLogsResponse addLogsItem(GetLogsResponseLogs logsItem) { - this.logs.add(logsItem); - return this; - } - - /** - * Get logs - * - * @return logs - */ - @javax.annotation.Nonnull - public List getLogs() { - return logs; - } - - public void setLogs(List logs) { - this.logs = logs; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetLogsResponse getLogsResponse = (GetLogsResponse) o; - return Objects.equals(this.logs, getLogsResponse.logs); - } - - @Override - public int hashCode() { - return Objects.hash(logs); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetLogsResponse {\n"); - sb.append(" logs: ").append(toIndentedString(logs)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseInnerQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseInnerQueries.java deleted file mode 100644 index 31a764dc56..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseInnerQueries.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** GetLogsResponseInnerQueries */ -public class GetLogsResponseInnerQueries { - - @SerializedName("index_name") - private String indexName; - - @SerializedName("user_token") - private String userToken; - - @SerializedName("query_id") - private String queryId; - - public GetLogsResponseInnerQueries indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - * Index targeted by the query. - * - * @return indexName - */ - @javax.annotation.Nullable - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - public GetLogsResponseInnerQueries userToken(String userToken) { - this.userToken = userToken; - return this; - } - - /** - * User identifier. - * - * @return userToken - */ - @javax.annotation.Nullable - public String getUserToken() { - return userToken; - } - - public void setUserToken(String userToken) { - this.userToken = userToken; - } - - public GetLogsResponseInnerQueries queryId(String queryId) { - this.queryId = queryId; - return this; - } - - /** - * QueryID for the given query. - * - * @return queryId - */ - @javax.annotation.Nullable - public String getQueryId() { - return queryId; - } - - public void setQueryId(String queryId) { - this.queryId = queryId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetLogsResponseInnerQueries getLogsResponseInnerQueries = (GetLogsResponseInnerQueries) o; - return ( - Objects.equals(this.indexName, getLogsResponseInnerQueries.indexName) && - Objects.equals(this.userToken, getLogsResponseInnerQueries.userToken) && - Objects.equals(this.queryId, getLogsResponseInnerQueries.queryId) - ); - } - - @Override - public int hashCode() { - return Objects.hash(indexName, userToken, queryId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetLogsResponseInnerQueries {\n"); - sb - .append(" indexName: ") - .append(toIndentedString(indexName)) - .append("\n"); - sb - .append(" userToken: ") - .append(toIndentedString(userToken)) - .append("\n"); - sb.append(" queryId: ").append(toIndentedString(queryId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseLogs.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseLogs.java deleted file mode 100644 index 0438a94650..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetLogsResponseLogs.java +++ /dev/null @@ -1,464 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** GetLogsResponseLogs */ -public class GetLogsResponseLogs { - - @SerializedName("timestamp") - private String timestamp; - - @SerializedName("method") - private String method; - - @SerializedName("answer_code") - private String answerCode; - - @SerializedName("query_body") - private String queryBody; - - @SerializedName("answer") - private String answer; - - @SerializedName("url") - private String url; - - @SerializedName("ip") - private String ip; - - @SerializedName("query_headers") - private String queryHeaders; - - @SerializedName("sha1") - private String sha1; - - @SerializedName("nb_api_calls") - private String nbApiCalls; - - @SerializedName("processing_time_ms") - private String processingTimeMs; - - @SerializedName("index") - private String index; - - @SerializedName("query_params") - private String queryParams; - - @SerializedName("query_nb_hits") - private String queryNbHits; - - @SerializedName("inner_queries") - private List innerQueries = null; - - public GetLogsResponseLogs timestamp(String timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * Timestamp in ISO-8601 format. - * - * @return timestamp - */ - @javax.annotation.Nonnull - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public GetLogsResponseLogs method(String method) { - this.method = method; - return this; - } - - /** - * HTTP method of the perfomed request. - * - * @return method - */ - @javax.annotation.Nonnull - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - public GetLogsResponseLogs answerCode(String answerCode) { - this.answerCode = answerCode; - return this; - } - - /** - * HTTP response code. - * - * @return answerCode - */ - @javax.annotation.Nonnull - public String getAnswerCode() { - return answerCode; - } - - public void setAnswerCode(String answerCode) { - this.answerCode = answerCode; - } - - public GetLogsResponseLogs queryBody(String queryBody) { - this.queryBody = queryBody; - return this; - } - - /** - * Request body. Truncated after 1000 characters. - * - * @return queryBody - */ - @javax.annotation.Nonnull - public String getQueryBody() { - return queryBody; - } - - public void setQueryBody(String queryBody) { - this.queryBody = queryBody; - } - - public GetLogsResponseLogs answer(String answer) { - this.answer = answer; - return this; - } - - /** - * Answer body. Truncated after 1000 characters. - * - * @return answer - */ - @javax.annotation.Nonnull - public String getAnswer() { - return answer; - } - - public void setAnswer(String answer) { - this.answer = answer; - } - - public GetLogsResponseLogs url(String url) { - this.url = url; - return this; - } - - /** - * Request URL. - * - * @return url - */ - @javax.annotation.Nonnull - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public GetLogsResponseLogs ip(String ip) { - this.ip = ip; - return this; - } - - /** - * IP of the client which perfomed the request. - * - * @return ip - */ - @javax.annotation.Nonnull - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public GetLogsResponseLogs queryHeaders(String queryHeaders) { - this.queryHeaders = queryHeaders; - return this; - } - - /** - * Request Headers (API Key is obfuscated). - * - * @return queryHeaders - */ - @javax.annotation.Nonnull - public String getQueryHeaders() { - return queryHeaders; - } - - public void setQueryHeaders(String queryHeaders) { - this.queryHeaders = queryHeaders; - } - - public GetLogsResponseLogs sha1(String sha1) { - this.sha1 = sha1; - return this; - } - - /** - * SHA1 signature of the log entry. - * - * @return sha1 - */ - @javax.annotation.Nonnull - public String getSha1() { - return sha1; - } - - public void setSha1(String sha1) { - this.sha1 = sha1; - } - - public GetLogsResponseLogs nbApiCalls(String nbApiCalls) { - this.nbApiCalls = nbApiCalls; - return this; - } - - /** - * Number of API calls. - * - * @return nbApiCalls - */ - @javax.annotation.Nonnull - public String getNbApiCalls() { - return nbApiCalls; - } - - public void setNbApiCalls(String nbApiCalls) { - this.nbApiCalls = nbApiCalls; - } - - public GetLogsResponseLogs processingTimeMs(String processingTimeMs) { - this.processingTimeMs = processingTimeMs; - return this; - } - - /** - * Processing time for the query. It doesn't include network time. - * - * @return processingTimeMs - */ - @javax.annotation.Nonnull - public String getProcessingTimeMs() { - return processingTimeMs; - } - - public void setProcessingTimeMs(String processingTimeMs) { - this.processingTimeMs = processingTimeMs; - } - - public GetLogsResponseLogs index(String index) { - this.index = index; - return this; - } - - /** - * Index targeted by the query. - * - * @return index - */ - @javax.annotation.Nullable - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - - public GetLogsResponseLogs queryParams(String queryParams) { - this.queryParams = queryParams; - return this; - } - - /** - * Query parameters sent with the request. - * - * @return queryParams - */ - @javax.annotation.Nullable - public String getQueryParams() { - return queryParams; - } - - public void setQueryParams(String queryParams) { - this.queryParams = queryParams; - } - - public GetLogsResponseLogs queryNbHits(String queryNbHits) { - this.queryNbHits = queryNbHits; - return this; - } - - /** - * Number of hits returned for the query. - * - * @return queryNbHits - */ - @javax.annotation.Nullable - public String getQueryNbHits() { - return queryNbHits; - } - - public void setQueryNbHits(String queryNbHits) { - this.queryNbHits = queryNbHits; - } - - public GetLogsResponseLogs innerQueries( - List innerQueries - ) { - this.innerQueries = innerQueries; - return this; - } - - public GetLogsResponseLogs addInnerQueriesItem( - GetLogsResponseInnerQueries innerQueriesItem - ) { - if (this.innerQueries == null) { - this.innerQueries = new ArrayList<>(); - } - this.innerQueries.add(innerQueriesItem); - return this; - } - - /** - * Array of all performed queries for the given request. - * - * @return innerQueries - */ - @javax.annotation.Nullable - public List getInnerQueries() { - return innerQueries; - } - - public void setInnerQueries(List innerQueries) { - this.innerQueries = innerQueries; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetLogsResponseLogs getLogsResponseLogs = (GetLogsResponseLogs) o; - return ( - Objects.equals(this.timestamp, getLogsResponseLogs.timestamp) && - Objects.equals(this.method, getLogsResponseLogs.method) && - Objects.equals(this.answerCode, getLogsResponseLogs.answerCode) && - Objects.equals(this.queryBody, getLogsResponseLogs.queryBody) && - Objects.equals(this.answer, getLogsResponseLogs.answer) && - Objects.equals(this.url, getLogsResponseLogs.url) && - Objects.equals(this.ip, getLogsResponseLogs.ip) && - Objects.equals(this.queryHeaders, getLogsResponseLogs.queryHeaders) && - Objects.equals(this.sha1, getLogsResponseLogs.sha1) && - Objects.equals(this.nbApiCalls, getLogsResponseLogs.nbApiCalls) && - Objects.equals( - this.processingTimeMs, - getLogsResponseLogs.processingTimeMs - ) && - Objects.equals(this.index, getLogsResponseLogs.index) && - Objects.equals(this.queryParams, getLogsResponseLogs.queryParams) && - Objects.equals(this.queryNbHits, getLogsResponseLogs.queryNbHits) && - Objects.equals(this.innerQueries, getLogsResponseLogs.innerQueries) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - timestamp, - method, - answerCode, - queryBody, - answer, - url, - ip, - queryHeaders, - sha1, - nbApiCalls, - processingTimeMs, - index, - queryParams, - queryNbHits, - innerQueries - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetLogsResponseLogs {\n"); - sb - .append(" timestamp: ") - .append(toIndentedString(timestamp)) - .append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb - .append(" answerCode: ") - .append(toIndentedString(answerCode)) - .append("\n"); - sb - .append(" queryBody: ") - .append(toIndentedString(queryBody)) - .append("\n"); - sb.append(" answer: ").append(toIndentedString(answer)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); - sb - .append(" queryHeaders: ") - .append(toIndentedString(queryHeaders)) - .append("\n"); - sb.append(" sha1: ").append(toIndentedString(sha1)).append("\n"); - sb - .append(" nbApiCalls: ") - .append(toIndentedString(nbApiCalls)) - .append("\n"); - sb - .append(" processingTimeMs: ") - .append(toIndentedString(processingTimeMs)) - .append("\n"); - sb.append(" index: ").append(toIndentedString(index)).append("\n"); - sb - .append(" queryParams: ") - .append(toIndentedString(queryParams)) - .append("\n"); - sb - .append(" queryNbHits: ") - .append(toIndentedString(queryNbHits)) - .append("\n"); - sb - .append(" innerQueries: ") - .append(toIndentedString(innerQueries)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsParams.java deleted file mode 100644 index f6808cb8f0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsParams.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** The `getObjects` parameters. */ -public class GetObjectsParams { - - @SerializedName("requests") - private List requests = null; - - public GetObjectsParams requests(List requests) { - this.requests = requests; - return this; - } - - public GetObjectsParams addRequestsItem( - MultipleGetObjectsParams requestsItem - ) { - if (this.requests == null) { - this.requests = new ArrayList<>(); - } - this.requests.add(requestsItem); - return this; - } - - /** - * Get requests - * - * @return requests - */ - @javax.annotation.Nullable - public List getRequests() { - return requests; - } - - public void setRequests(List requests) { - this.requests = requests; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetObjectsParams getObjectsParams = (GetObjectsParams) o; - return Objects.equals(this.requests, getObjectsParams.requests); - } - - @Override - public int hashCode() { - return Objects.hash(requests); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetObjectsParams {\n"); - sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsResponse.java deleted file mode 100644 index 7a96b37e9a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetObjectsResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** GetObjectsResponse */ -public class GetObjectsResponse { - - @SerializedName("results") - private List results = null; - - public GetObjectsResponse results(List results) { - this.results = results; - return this; - } - - public GetObjectsResponse addResultsItem(Object resultsItem) { - if (this.results == null) { - this.results = new ArrayList<>(); - } - this.results.add(resultsItem); - return this; - } - - /** - * List of results fetched. - * - * @return results - */ - @javax.annotation.Nullable - public List getResults() { - return results; - } - - public void setResults(List results) { - this.results = results; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetObjectsResponse getObjectsResponse = (GetObjectsResponse) o; - return Objects.equals(this.results, getObjectsResponse.results); - } - - @Override - public int hashCode() { - return Objects.hash(results); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetObjectsResponse {\n"); - sb.append(" results: ").append(toIndentedString(results)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTaskResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTaskResponse.java deleted file mode 100644 index 06fe5e2406..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTaskResponse.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** GetTaskResponse */ -public class GetTaskResponse { - - /** Gets or Sets status */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - PUBLISHED("published"), - - NOTPUBLISHED("notPublished"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final StatusEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public StatusEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return StatusEnum.fromValue(value); - } - } - } - - @SerializedName("status") - private StatusEnum status; - - public GetTaskResponse status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status - */ - @javax.annotation.Nonnull - public StatusEnum getStatus() { - return status; - } - - public void setStatus(StatusEnum status) { - this.status = status; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetTaskResponse getTaskResponse = (GetTaskResponse) o; - return Objects.equals(this.status, getTaskResponse.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetTaskResponse {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTopUserIdsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTopUserIdsResponse.java deleted file mode 100644 index 94cf46ab3f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/GetTopUserIdsResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** Array of userIDs and clusters. */ -public class GetTopUserIdsResponse { - - @SerializedName("topUsers") - private List>> topUsers = new ArrayList<>(); - - public GetTopUserIdsResponse topUsers( - List>> topUsers - ) { - this.topUsers = topUsers; - return this; - } - - public GetTopUserIdsResponse addTopUsersItem( - Map> topUsersItem - ) { - this.topUsers.add(topUsersItem); - return this; - } - - /** - * Mapping of cluster names to top users. - * - * @return topUsers - */ - @javax.annotation.Nonnull - public List>> getTopUsers() { - return topUsers; - } - - public void setTopUsers(List>> topUsers) { - this.topUsers = topUsers; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetTopUserIdsResponse getTopUserIdsResponse = (GetTopUserIdsResponse) o; - return Objects.equals(this.topUsers, getTopUserIdsResponse.topUsers); - } - - @Override - public int hashCode() { - return Objects.hash(topUsers); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetTopUserIdsResponse {\n"); - sb.append(" topUsers: ").append(toIndentedString(topUsers)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java deleted file mode 100644 index 18aea7db1d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Highlighted attributes. */ -public class HighlightResult { - - @SerializedName("value") - private String value; - - /** Indicates how well the attribute matched the search query. */ - @JsonAdapter(MatchLevelEnum.Adapter.class) - public enum MatchLevelEnum { - NONE("none"), - - PARTIAL("partial"), - - FULL("full"); - - private String value; - - MatchLevelEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MatchLevelEnum fromValue(String value) { - for (MatchLevelEnum b : MatchLevelEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MatchLevelEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MatchLevelEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MatchLevelEnum.fromValue(value); - } - } - } - - @SerializedName("matchLevel") - private MatchLevelEnum matchLevel; - - @SerializedName("matchedWords") - private List matchedWords = null; - - @SerializedName("fullyHighlighted") - private Boolean fullyHighlighted; - - public HighlightResult value(String value) { - this.value = value; - return this; - } - - /** - * Markup text with occurrences highlighted. - * - * @return value - */ - @javax.annotation.Nullable - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public HighlightResult matchLevel(MatchLevelEnum matchLevel) { - this.matchLevel = matchLevel; - return this; - } - - /** - * Indicates how well the attribute matched the search query. - * - * @return matchLevel - */ - @javax.annotation.Nullable - public MatchLevelEnum getMatchLevel() { - return matchLevel; - } - - public void setMatchLevel(MatchLevelEnum matchLevel) { - this.matchLevel = matchLevel; - } - - public HighlightResult matchedWords(List matchedWords) { - this.matchedWords = matchedWords; - return this; - } - - public HighlightResult addMatchedWordsItem(String matchedWordsItem) { - if (this.matchedWords == null) { - this.matchedWords = new ArrayList<>(); - } - this.matchedWords.add(matchedWordsItem); - return this; - } - - /** - * List of words from the query that matched the object. - * - * @return matchedWords - */ - @javax.annotation.Nullable - public List getMatchedWords() { - return matchedWords; - } - - public void setMatchedWords(List matchedWords) { - this.matchedWords = matchedWords; - } - - public HighlightResult fullyHighlighted(Boolean fullyHighlighted) { - this.fullyHighlighted = fullyHighlighted; - return this; - } - - /** - * Whether the entire attribute value is highlighted. - * - * @return fullyHighlighted - */ - @javax.annotation.Nullable - public Boolean getFullyHighlighted() { - return fullyHighlighted; - } - - public void setFullyHighlighted(Boolean fullyHighlighted) { - this.fullyHighlighted = fullyHighlighted; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - HighlightResult highlightResult = (HighlightResult) o; - return ( - Objects.equals(this.value, highlightResult.value) && - Objects.equals(this.matchLevel, highlightResult.matchLevel) && - Objects.equals(this.matchedWords, highlightResult.matchedWords) && - Objects.equals(this.fullyHighlighted, highlightResult.fullyHighlighted) - ); - } - - @Override - public int hashCode() { - return Objects.hash(value, matchLevel, matchedWords, fullyHighlighted); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class HighlightResult {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb - .append(" matchLevel: ") - .append(toIndentedString(matchLevel)) - .append("\n"); - sb - .append(" matchedWords: ") - .append(toIndentedString(matchedWords)) - .append("\n"); - sb - .append(" fullyHighlighted: ") - .append(toIndentedString(fullyHighlighted)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Hit.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Hit.java deleted file mode 100644 index 5b6f67f71f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Hit.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Objects; - -/** A single hit. */ -public class Hit extends HashMap { - - @SerializedName("objectID") - private String objectID; - - @SerializedName("_highlightResult") - private HighlightResult highlightResult; - - @SerializedName("_snippetResult") - private SnippetResult snippetResult; - - @SerializedName("_rankingInfo") - private RankingInfo rankingInfo; - - @SerializedName("_distinctSeqID") - private Integer distinctSeqID; - - public Hit objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public Hit highlightResult(HighlightResult highlightResult) { - this.highlightResult = highlightResult; - return this; - } - - /** - * Get highlightResult - * - * @return highlightResult - */ - @javax.annotation.Nullable - public HighlightResult getHighlightResult() { - return highlightResult; - } - - public void setHighlightResult(HighlightResult highlightResult) { - this.highlightResult = highlightResult; - } - - public Hit snippetResult(SnippetResult snippetResult) { - this.snippetResult = snippetResult; - return this; - } - - /** - * Get snippetResult - * - * @return snippetResult - */ - @javax.annotation.Nullable - public SnippetResult getSnippetResult() { - return snippetResult; - } - - public void setSnippetResult(SnippetResult snippetResult) { - this.snippetResult = snippetResult; - } - - public Hit rankingInfo(RankingInfo rankingInfo) { - this.rankingInfo = rankingInfo; - return this; - } - - /** - * Get rankingInfo - * - * @return rankingInfo - */ - @javax.annotation.Nullable - public RankingInfo getRankingInfo() { - return rankingInfo; - } - - public void setRankingInfo(RankingInfo rankingInfo) { - this.rankingInfo = rankingInfo; - } - - public Hit distinctSeqID(Integer distinctSeqID) { - this.distinctSeqID = distinctSeqID; - return this; - } - - /** - * Get distinctSeqID - * - * @return distinctSeqID - */ - @javax.annotation.Nullable - public Integer getDistinctSeqID() { - return distinctSeqID; - } - - public void setDistinctSeqID(Integer distinctSeqID) { - this.distinctSeqID = distinctSeqID; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Hit hit = (Hit) o; - return ( - Objects.equals(this.objectID, hit.objectID) && - Objects.equals(this.highlightResult, hit.highlightResult) && - Objects.equals(this.snippetResult, hit.snippetResult) && - Objects.equals(this.rankingInfo, hit.rankingInfo) && - Objects.equals(this.distinctSeqID, hit.distinctSeqID) && - super.equals(o) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - objectID, - highlightResult, - snippetResult, - rankingInfo, - distinctSeqID, - super.hashCode() - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Hit {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb - .append(" highlightResult: ") - .append(toIndentedString(highlightResult)) - .append("\n"); - sb - .append(" snippetResult: ") - .append(toIndentedString(snippetResult)) - .append("\n"); - sb - .append(" rankingInfo: ") - .append(toIndentedString(rankingInfo)) - .append("\n"); - sb - .append(" distinctSeqID: ") - .append(toIndentedString(distinctSeqID)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java deleted file mode 100644 index 7a788bbe3e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ /dev/null @@ -1,2320 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** The Algolia index settings. */ -public class IndexSettings { - - @SerializedName("replicas") - private List replicas = null; - - @SerializedName("paginationLimitedTo") - private Integer paginationLimitedTo = 1000; - - @SerializedName("disableTypoToleranceOnWords") - private List disableTypoToleranceOnWords = null; - - @SerializedName("attributesToTransliterate") - private List attributesToTransliterate = null; - - @SerializedName("camelCaseAttributes") - private List camelCaseAttributes = null; - - @SerializedName("decompoundedAttributes") - private Object decompoundedAttributes = new Object(); - - @SerializedName("indexLanguages") - private List indexLanguages = null; - - @SerializedName("filterPromotes") - private Boolean filterPromotes = false; - - @SerializedName("disablePrefixOnAttributes") - private List disablePrefixOnAttributes = null; - - @SerializedName("allowCompressionOfIntegerArray") - private Boolean allowCompressionOfIntegerArray = false; - - @SerializedName("numericAttributesForFiltering") - private List numericAttributesForFiltering = null; - - @SerializedName("userData") - private Object userData = new Object(); - - @SerializedName("searchableAttributes") - private List searchableAttributes = null; - - @SerializedName("attributesForFaceting") - private List attributesForFaceting = null; - - @SerializedName("unretrievableAttributes") - private List unretrievableAttributes = null; - - @SerializedName("attributesToRetrieve") - private List attributesToRetrieve = null; - - @SerializedName("restrictSearchableAttributes") - private List restrictSearchableAttributes = null; - - @SerializedName("ranking") - private List ranking = null; - - @SerializedName("customRanking") - private List customRanking = null; - - @SerializedName("relevancyStrictness") - private Integer relevancyStrictness = 100; - - @SerializedName("attributesToHighlight") - private List attributesToHighlight = null; - - @SerializedName("attributesToSnippet") - private List attributesToSnippet = null; - - @SerializedName("highlightPreTag") - private String highlightPreTag = ""; - - @SerializedName("highlightPostTag") - private String highlightPostTag = ""; - - @SerializedName("snippetEllipsisText") - private String snippetEllipsisText = "…"; - - @SerializedName("restrictHighlightAndSnippetArrays") - private Boolean restrictHighlightAndSnippetArrays = false; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("minWordSizefor1Typo") - private Integer minWordSizefor1Typo = 4; - - @SerializedName("minWordSizefor2Typos") - private Integer minWordSizefor2Typos = 8; - - /** Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) - public enum TypoToleranceEnum { - TRUE("true"), - - FALSE("false"), - - MIN("min"), - - STRICT("strict"); - - private String value; - - TypoToleranceEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static TypoToleranceEnum fromValue(String value) { - for (TypoToleranceEnum b : TypoToleranceEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } - } - - @SerializedName("typoTolerance") - private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - - @SerializedName("allowTyposOnNumericTokens") - private Boolean allowTyposOnNumericTokens = true; - - @SerializedName("disableTypoToleranceOnAttributes") - private List disableTypoToleranceOnAttributes = null; - - @SerializedName("separatorsToIndex") - private String separatorsToIndex = ""; - - @SerializedName("ignorePlurals") - private String ignorePlurals = "false"; - - @SerializedName("removeStopWords") - private String removeStopWords = "false"; - - @SerializedName("keepDiacriticsOnCharacters") - private String keepDiacriticsOnCharacters = ""; - - @SerializedName("queryLanguages") - private List queryLanguages = null; - - @SerializedName("decompoundQuery") - private Boolean decompoundQuery = true; - - @SerializedName("enableRules") - private Boolean enableRules = true; - - @SerializedName("enablePersonalization") - private Boolean enablePersonalization = false; - - /** Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) - public enum QueryTypeEnum { - PREFIXLAST("prefixLast"), - - PREFIXALL("prefixAll"), - - PREFIXNONE("prefixNone"); - - private String value; - - QueryTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static QueryTypeEnum fromValue(String value) { - for (QueryTypeEnum b : QueryTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } - } - - @SerializedName("queryType") - private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - - /** Selects a strategy to remove words from the query when it doesn't match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) - public enum RemoveWordsIfNoResultsEnum { - NONE("none"), - - LASTWORDS("lastWords"), - - FIRSTWORDS("firstWords"), - - ALLOPTIONAL("allOptional"); - - private String value; - - RemoveWordsIfNoResultsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RemoveWordsIfNoResultsEnum fromValue(String value) { - for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } - } - - @SerializedName("removeWordsIfNoResults") - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = - RemoveWordsIfNoResultsEnum.NONE; - - @SerializedName("advancedSyntax") - private Boolean advancedSyntax = false; - - @SerializedName("optionalWords") - private List optionalWords = null; - - @SerializedName("disableExactOnAttributes") - private List disableExactOnAttributes = null; - - /** Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) - public enum ExactOnSingleWordQueryEnum { - ATTRIBUTE("attribute"), - - NONE("none"), - - WORD("word"); - - private String value; - - ExactOnSingleWordQueryEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ExactOnSingleWordQueryEnum fromValue(String value) { - for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } - } - - @SerializedName("exactOnSingleWordQuery") - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = - ExactOnSingleWordQueryEnum.ATTRIBUTE; - - /** Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) - public enum AlternativesAsExactEnum { - IGNOREPLURALS("ignorePlurals"), - - SINGLEWORDSYNONYM("singleWordSynonym"), - - MULTIWORDSSYNONYM("multiWordsSynonym"); - - private String value; - - AlternativesAsExactEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AlternativesAsExactEnum fromValue(String value) { - for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } - } - - @SerializedName("alternativesAsExact") - private List alternativesAsExact = null; - - /** Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) - public enum AdvancedSyntaxFeaturesEnum { - EXACTPHRASE("exactPhrase"), - - EXCLUDEWORDS("excludeWords"); - - private String value; - - AdvancedSyntaxFeaturesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AdvancedSyntaxFeaturesEnum fromValue(String value) { - for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } - } - - @SerializedName("advancedSyntaxFeatures") - private List advancedSyntaxFeatures = null; - - @SerializedName("distinct") - private Integer distinct = 0; - - @SerializedName("synonyms") - private Boolean synonyms = true; - - @SerializedName("replaceSynonymsInHighlight") - private Boolean replaceSynonymsInHighlight = false; - - @SerializedName("minProximity") - private Integer minProximity = 1; - - @SerializedName("responseFields") - private List responseFields = null; - - @SerializedName("maxFacetHits") - private Integer maxFacetHits = 10; - - @SerializedName("attributeCriteriaComputedByMinProximity") - private Boolean attributeCriteriaComputedByMinProximity = false; - - @SerializedName("renderingContent") - private Object renderingContent = new Object(); - - public IndexSettings replicas(List replicas) { - this.replicas = replicas; - return this; - } - - public IndexSettings addReplicasItem(String replicasItem) { - if (this.replicas == null) { - this.replicas = new ArrayList<>(); - } - this.replicas.add(replicasItem); - return this; - } - - /** - * Creates replicas, exact copies of an index. - * - * @return replicas - */ - @javax.annotation.Nullable - public List getReplicas() { - return replicas; - } - - public void setReplicas(List replicas) { - this.replicas = replicas; - } - - public IndexSettings paginationLimitedTo(Integer paginationLimitedTo) { - this.paginationLimitedTo = paginationLimitedTo; - return this; - } - - /** - * Set the maximum number of hits accessible via pagination. - * - * @return paginationLimitedTo - */ - @javax.annotation.Nullable - public Integer getPaginationLimitedTo() { - return paginationLimitedTo; - } - - public void setPaginationLimitedTo(Integer paginationLimitedTo) { - this.paginationLimitedTo = paginationLimitedTo; - } - - public IndexSettings disableTypoToleranceOnWords( - List disableTypoToleranceOnWords - ) { - this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; - return this; - } - - public IndexSettings addDisableTypoToleranceOnWordsItem( - String disableTypoToleranceOnWordsItem - ) { - if (this.disableTypoToleranceOnWords == null) { - this.disableTypoToleranceOnWords = new ArrayList<>(); - } - this.disableTypoToleranceOnWords.add(disableTypoToleranceOnWordsItem); - return this; - } - - /** - * A list of words for which you want to turn off typo tolerance. - * - * @return disableTypoToleranceOnWords - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnWords() { - return disableTypoToleranceOnWords; - } - - public void setDisableTypoToleranceOnWords( - List disableTypoToleranceOnWords - ) { - this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; - } - - public IndexSettings attributesToTransliterate( - List attributesToTransliterate - ) { - this.attributesToTransliterate = attributesToTransliterate; - return this; - } - - public IndexSettings addAttributesToTransliterateItem( - String attributesToTransliterateItem - ) { - if (this.attributesToTransliterate == null) { - this.attributesToTransliterate = new ArrayList<>(); - } - this.attributesToTransliterate.add(attributesToTransliterateItem); - return this; - } - - /** - * Specify on which attributes to apply transliteration. - * - * @return attributesToTransliterate - */ - @javax.annotation.Nullable - public List getAttributesToTransliterate() { - return attributesToTransliterate; - } - - public void setAttributesToTransliterate( - List attributesToTransliterate - ) { - this.attributesToTransliterate = attributesToTransliterate; - } - - public IndexSettings camelCaseAttributes(List camelCaseAttributes) { - this.camelCaseAttributes = camelCaseAttributes; - return this; - } - - public IndexSettings addCamelCaseAttributesItem( - String camelCaseAttributesItem - ) { - if (this.camelCaseAttributes == null) { - this.camelCaseAttributes = new ArrayList<>(); - } - this.camelCaseAttributes.add(camelCaseAttributesItem); - return this; - } - - /** - * List of attributes on which to do a decomposition of camel case words. - * - * @return camelCaseAttributes - */ - @javax.annotation.Nullable - public List getCamelCaseAttributes() { - return camelCaseAttributes; - } - - public void setCamelCaseAttributes(List camelCaseAttributes) { - this.camelCaseAttributes = camelCaseAttributes; - } - - public IndexSettings decompoundedAttributes(Object decompoundedAttributes) { - this.decompoundedAttributes = decompoundedAttributes; - return this; - } - - /** - * Specify on which attributes in your index Algolia should apply word segmentation, also known as - * decompounding. - * - * @return decompoundedAttributes - */ - @javax.annotation.Nullable - public Object getDecompoundedAttributes() { - return decompoundedAttributes; - } - - public void setDecompoundedAttributes(Object decompoundedAttributes) { - this.decompoundedAttributes = decompoundedAttributes; - } - - public IndexSettings indexLanguages(List indexLanguages) { - this.indexLanguages = indexLanguages; - return this; - } - - public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { - if (this.indexLanguages == null) { - this.indexLanguages = new ArrayList<>(); - } - this.indexLanguages.add(indexLanguagesItem); - return this; - } - - /** - * Sets the languages at the index level for language-specific processing such as tokenization and - * normalization. - * - * @return indexLanguages - */ - @javax.annotation.Nullable - public List getIndexLanguages() { - return indexLanguages; - } - - public void setIndexLanguages(List indexLanguages) { - this.indexLanguages = indexLanguages; - } - - public IndexSettings filterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; - return this; - } - - /** - * Whether promoted results should match the filters of the current search, except for geographic - * filters. - * - * @return filterPromotes - */ - @javax.annotation.Nullable - public Boolean getFilterPromotes() { - return filterPromotes; - } - - public void setFilterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; - } - - public IndexSettings disablePrefixOnAttributes( - List disablePrefixOnAttributes - ) { - this.disablePrefixOnAttributes = disablePrefixOnAttributes; - return this; - } - - public IndexSettings addDisablePrefixOnAttributesItem( - String disablePrefixOnAttributesItem - ) { - if (this.disablePrefixOnAttributes == null) { - this.disablePrefixOnAttributes = new ArrayList<>(); - } - this.disablePrefixOnAttributes.add(disablePrefixOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable prefix matching. - * - * @return disablePrefixOnAttributes - */ - @javax.annotation.Nullable - public List getDisablePrefixOnAttributes() { - return disablePrefixOnAttributes; - } - - public void setDisablePrefixOnAttributes( - List disablePrefixOnAttributes - ) { - this.disablePrefixOnAttributes = disablePrefixOnAttributes; - } - - public IndexSettings allowCompressionOfIntegerArray( - Boolean allowCompressionOfIntegerArray - ) { - this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; - return this; - } - - /** - * Enables compression of large integer arrays. - * - * @return allowCompressionOfIntegerArray - */ - @javax.annotation.Nullable - public Boolean getAllowCompressionOfIntegerArray() { - return allowCompressionOfIntegerArray; - } - - public void setAllowCompressionOfIntegerArray( - Boolean allowCompressionOfIntegerArray - ) { - this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; - } - - public IndexSettings numericAttributesForFiltering( - List numericAttributesForFiltering - ) { - this.numericAttributesForFiltering = numericAttributesForFiltering; - return this; - } - - public IndexSettings addNumericAttributesForFilteringItem( - String numericAttributesForFilteringItem - ) { - if (this.numericAttributesForFiltering == null) { - this.numericAttributesForFiltering = new ArrayList<>(); - } - this.numericAttributesForFiltering.add(numericAttributesForFilteringItem); - return this; - } - - /** - * List of numeric attributes that can be used as numerical filters. - * - * @return numericAttributesForFiltering - */ - @javax.annotation.Nullable - public List getNumericAttributesForFiltering() { - return numericAttributesForFiltering; - } - - public void setNumericAttributesForFiltering( - List numericAttributesForFiltering - ) { - this.numericAttributesForFiltering = numericAttributesForFiltering; - } - - public IndexSettings userData(Object userData) { - this.userData = userData; - return this; - } - - /** - * Lets you store custom data in your indices. - * - * @return userData - */ - @javax.annotation.Nullable - public Object getUserData() { - return userData; - } - - public void setUserData(Object userData) { - this.userData = userData; - } - - public IndexSettings searchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - return this; - } - - public IndexSettings addSearchableAttributesItem( - String searchableAttributesItem - ) { - if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList<>(); - } - this.searchableAttributes.add(searchableAttributesItem); - return this; - } - - /** - * The complete list of attributes used for searching. - * - * @return searchableAttributes - */ - @javax.annotation.Nullable - public List getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public IndexSettings attributesForFaceting( - List attributesForFaceting - ) { - this.attributesForFaceting = attributesForFaceting; - return this; - } - - public IndexSettings addAttributesForFacetingItem( - String attributesForFacetingItem - ) { - if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList<>(); - } - this.attributesForFaceting.add(attributesForFacetingItem); - return this; - } - - /** - * The complete list of attributes that will be used for faceting. - * - * @return attributesForFaceting - */ - @javax.annotation.Nullable - public List getAttributesForFaceting() { - return attributesForFaceting; - } - - public void setAttributesForFaceting(List attributesForFaceting) { - this.attributesForFaceting = attributesForFaceting; - } - - public IndexSettings unretrievableAttributes( - List unretrievableAttributes - ) { - this.unretrievableAttributes = unretrievableAttributes; - return this; - } - - public IndexSettings addUnretrievableAttributesItem( - String unretrievableAttributesItem - ) { - if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList<>(); - } - this.unretrievableAttributes.add(unretrievableAttributesItem); - return this; - } - - /** - * List of attributes that can't be retrieved at query time. - * - * @return unretrievableAttributes - */ - @javax.annotation.Nullable - public List getUnretrievableAttributes() { - return unretrievableAttributes; - } - - public void setUnretrievableAttributes(List unretrievableAttributes) { - this.unretrievableAttributes = unretrievableAttributes; - } - - public IndexSettings attributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - return this; - } - - public IndexSettings addAttributesToRetrieveItem( - String attributesToRetrieveItem - ) { - if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList<>(); - } - this.attributesToRetrieve.add(attributesToRetrieveItem); - return this; - } - - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - * - * @return attributesToRetrieve - */ - @javax.annotation.Nullable - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public void setAttributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - } - - public IndexSettings restrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - return this; - } - - public IndexSettings addRestrictSearchableAttributesItem( - String restrictSearchableAttributesItem - ) { - if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList<>(); - } - this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); - return this; - } - - /** - * Restricts a given query to look in only a subset of your searchable attributes. - * - * @return restrictSearchableAttributes - */ - @javax.annotation.Nullable - public List getRestrictSearchableAttributes() { - return restrictSearchableAttributes; - } - - public void setRestrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - } - - public IndexSettings ranking(List ranking) { - this.ranking = ranking; - return this; - } - - public IndexSettings addRankingItem(String rankingItem) { - if (this.ranking == null) { - this.ranking = new ArrayList<>(); - } - this.ranking.add(rankingItem); - return this; - } - - /** - * Controls how Algolia should sort your results. - * - * @return ranking - */ - @javax.annotation.Nullable - public List getRanking() { - return ranking; - } - - public void setRanking(List ranking) { - this.ranking = ranking; - } - - public IndexSettings customRanking(List customRanking) { - this.customRanking = customRanking; - return this; - } - - public IndexSettings addCustomRankingItem(String customRankingItem) { - if (this.customRanking == null) { - this.customRanking = new ArrayList<>(); - } - this.customRanking.add(customRankingItem); - return this; - } - - /** - * Specifies the custom ranking criterion. - * - * @return customRanking - */ - @javax.annotation.Nullable - public List getCustomRanking() { - return customRanking; - } - - public void setCustomRanking(List customRanking) { - this.customRanking = customRanking; - } - - public IndexSettings relevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - return this; - } - - /** - * Controls the relevancy threshold below which less relevant results aren't included in the - * results. - * - * @return relevancyStrictness - */ - @javax.annotation.Nullable - public Integer getRelevancyStrictness() { - return relevancyStrictness; - } - - public void setRelevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - } - - public IndexSettings attributesToHighlight( - List attributesToHighlight - ) { - this.attributesToHighlight = attributesToHighlight; - return this; - } - - public IndexSettings addAttributesToHighlightItem( - String attributesToHighlightItem - ) { - if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList<>(); - } - this.attributesToHighlight.add(attributesToHighlightItem); - return this; - } - - /** - * List of attributes to highlight. - * - * @return attributesToHighlight - */ - @javax.annotation.Nullable - public List getAttributesToHighlight() { - return attributesToHighlight; - } - - public void setAttributesToHighlight(List attributesToHighlight) { - this.attributesToHighlight = attributesToHighlight; - } - - public IndexSettings attributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - return this; - } - - public IndexSettings addAttributesToSnippetItem( - String attributesToSnippetItem - ) { - if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList<>(); - } - this.attributesToSnippet.add(attributesToSnippetItem); - return this; - } - - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - * - * @return attributesToSnippet - */ - @javax.annotation.Nullable - public List getAttributesToSnippet() { - return attributesToSnippet; - } - - public void setAttributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - } - - public IndexSettings highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - return this; - } - - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - * - * @return highlightPreTag - */ - @javax.annotation.Nullable - public String getHighlightPreTag() { - return highlightPreTag; - } - - public void setHighlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - } - - public IndexSettings highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - return this; - } - - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - * - * @return highlightPostTag - */ - @javax.annotation.Nullable - public String getHighlightPostTag() { - return highlightPostTag; - } - - public void setHighlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - } - - public IndexSettings snippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - return this; - } - - /** - * String used as an ellipsis indicator when a snippet is truncated. - * - * @return snippetEllipsisText - */ - @javax.annotation.Nullable - public String getSnippetEllipsisText() { - return snippetEllipsisText; - } - - public void setSnippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - } - - public IndexSettings restrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - return this; - } - - /** - * Restrict highlighting and snippeting to items that matched the query. - * - * @return restrictHighlightAndSnippetArrays - */ - @javax.annotation.Nullable - public Boolean getRestrictHighlightAndSnippetArrays() { - return restrictHighlightAndSnippetArrays; - } - - public void setRestrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - } - - public IndexSettings hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public IndexSettings minWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 - * typo. - * - * @return minWordSizefor1Typo - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor1Typo() { - return minWordSizefor1Typo; - } - - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - } - - public IndexSettings minWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 - * typos. - * - * @return minWordSizefor2Typos - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor2Typos() { - return minWordSizefor2Typos; - } - - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - } - - public IndexSettings typoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - return this; - } - - /** - * Controls whether typo tolerance is enabled and how it is applied. - * - * @return typoTolerance - */ - @javax.annotation.Nullable - public TypoToleranceEnum getTypoTolerance() { - return typoTolerance; - } - - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - } - - public IndexSettings allowTyposOnNumericTokens( - Boolean allowTyposOnNumericTokens - ) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - return this; - } - - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - * - * @return allowTyposOnNumericTokens - */ - @javax.annotation.Nullable - public Boolean getAllowTyposOnNumericTokens() { - return allowTyposOnNumericTokens; - } - - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - } - - public IndexSettings disableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - return this; - } - - public IndexSettings addDisableTypoToleranceOnAttributesItem( - String disableTypoToleranceOnAttributesItem - ) { - if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList<>(); - } - this.disableTypoToleranceOnAttributes.add( - disableTypoToleranceOnAttributesItem - ); - return this; - } - - /** - * List of attributes on which you want to disable typo tolerance. - * - * @return disableTypoToleranceOnAttributes - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnAttributes() { - return disableTypoToleranceOnAttributes; - } - - public void setDisableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - } - - public IndexSettings separatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - return this; - } - - /** - * Control which separators are indexed. - * - * @return separatorsToIndex - */ - @javax.annotation.Nullable - public String getSeparatorsToIndex() { - return separatorsToIndex; - } - - public void setSeparatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - } - - public IndexSettings ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - return this; - } - - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - * - * @return ignorePlurals - */ - @javax.annotation.Nullable - public String getIgnorePlurals() { - return ignorePlurals; - } - - public void setIgnorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - } - - public IndexSettings removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - return this; - } - - /** - * Removes stop (common) words from the query before executing it. - * - * @return removeStopWords - */ - @javax.annotation.Nullable - public String getRemoveStopWords() { - return removeStopWords; - } - - public void setRemoveStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - } - - public IndexSettings keepDiacriticsOnCharacters( - String keepDiacriticsOnCharacters - ) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - return this; - } - - /** - * List of characters that the engine shouldn't automatically normalize. - * - * @return keepDiacriticsOnCharacters - */ - @javax.annotation.Nullable - public String getKeepDiacriticsOnCharacters() { - return keepDiacriticsOnCharacters; - } - - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - } - - public IndexSettings queryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - return this; - } - - public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { - if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList<>(); - } - this.queryLanguages.add(queryLanguagesItem); - return this; - } - - /** - * Sets the languages to be used by language-specific settings and functionalities such as - * ignorePlurals, removeStopWords, and CJK word-detection. - * - * @return queryLanguages - */ - @javax.annotation.Nullable - public List getQueryLanguages() { - return queryLanguages; - } - - public void setQueryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - } - - public IndexSettings decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - return this; - } - - /** - * Splits compound words into their composing atoms in the query. - * - * @return decompoundQuery - */ - @javax.annotation.Nullable - public Boolean getDecompoundQuery() { - return decompoundQuery; - } - - public void setDecompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - } - - public IndexSettings enableRules(Boolean enableRules) { - this.enableRules = enableRules; - return this; - } - - /** - * Whether Rules should be globally enabled. - * - * @return enableRules - */ - @javax.annotation.Nullable - public Boolean getEnableRules() { - return enableRules; - } - - public void setEnableRules(Boolean enableRules) { - this.enableRules = enableRules; - } - - public IndexSettings enablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - return this; - } - - /** - * Enable the Personalization feature. - * - * @return enablePersonalization - */ - @javax.annotation.Nullable - public Boolean getEnablePersonalization() { - return enablePersonalization; - } - - public void setEnablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - } - - public IndexSettings queryType(QueryTypeEnum queryType) { - this.queryType = queryType; - return this; - } - - /** - * Controls if and how query words are interpreted as prefixes. - * - * @return queryType - */ - @javax.annotation.Nullable - public QueryTypeEnum getQueryType() { - return queryType; - } - - public void setQueryType(QueryTypeEnum queryType) { - this.queryType = queryType; - } - - public IndexSettings removeWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - return this; - } - - /** - * Selects a strategy to remove words from the query when it doesn't match any hits. - * - * @return removeWordsIfNoResults - */ - @javax.annotation.Nullable - public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { - return removeWordsIfNoResults; - } - - public void setRemoveWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - } - - public IndexSettings advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - return this; - } - - /** - * Enables the advanced query syntax. - * - * @return advancedSyntax - */ - @javax.annotation.Nullable - public Boolean getAdvancedSyntax() { - return advancedSyntax; - } - - public void setAdvancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - } - - public IndexSettings optionalWords(List optionalWords) { - this.optionalWords = optionalWords; - return this; - } - - public IndexSettings addOptionalWordsItem(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * A list of words that should be considered as optional when found in the query. - * - * @return optionalWords - */ - @javax.annotation.Nullable - public List getOptionalWords() { - return optionalWords; - } - - public void setOptionalWords(List optionalWords) { - this.optionalWords = optionalWords; - } - - public IndexSettings disableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - return this; - } - - public IndexSettings addDisableExactOnAttributesItem( - String disableExactOnAttributesItem - ) { - if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList<>(); - } - this.disableExactOnAttributes.add(disableExactOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable the exact ranking criterion. - * - * @return disableExactOnAttributes - */ - @javax.annotation.Nullable - public List getDisableExactOnAttributes() { - return disableExactOnAttributes; - } - - public void setDisableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - } - - public IndexSettings exactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - return this; - } - - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - * - * @return exactOnSingleWordQuery - */ - @javax.annotation.Nullable - public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { - return exactOnSingleWordQuery; - } - - public void setExactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - } - - public IndexSettings alternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - return this; - } - - public IndexSettings addAlternativesAsExactItem( - AlternativesAsExactEnum alternativesAsExactItem - ) { - if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList<>(); - } - this.alternativesAsExact.add(alternativesAsExactItem); - return this; - } - - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - * - * @return alternativesAsExact - */ - @javax.annotation.Nullable - public List getAlternativesAsExact() { - return alternativesAsExact; - } - - public void setAlternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - } - - public IndexSettings advancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - return this; - } - - public IndexSettings addAdvancedSyntaxFeaturesItem( - AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem - ) { - if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList<>(); - } - this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); - return this; - } - - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is - * enabled. - * - * @return advancedSyntaxFeatures - */ - @javax.annotation.Nullable - public List getAdvancedSyntaxFeatures() { - return advancedSyntaxFeatures; - } - - public void setAdvancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - } - - public IndexSettings distinct(Integer distinct) { - this.distinct = distinct; - return this; - } - - /** - * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 - * - * @return distinct - */ - @javax.annotation.Nullable - public Integer getDistinct() { - return distinct; - } - - public void setDistinct(Integer distinct) { - this.distinct = distinct; - } - - public IndexSettings synonyms(Boolean synonyms) { - this.synonyms = synonyms; - return this; - } - - /** - * Whether to take into account an index's synonyms for a particular search. - * - * @return synonyms - */ - @javax.annotation.Nullable - public Boolean getSynonyms() { - return synonyms; - } - - public void setSynonyms(Boolean synonyms) { - this.synonyms = synonyms; - } - - public IndexSettings replaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - return this; - } - - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym - * itself. - * - * @return replaceSynonymsInHighlight - */ - @javax.annotation.Nullable - public Boolean getReplaceSynonymsInHighlight() { - return replaceSynonymsInHighlight; - } - - public void setReplaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - } - - public IndexSettings minProximity(Integer minProximity) { - this.minProximity = minProximity; - return this; - } - - /** - * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 - * - * @return minProximity - */ - @javax.annotation.Nullable - public Integer getMinProximity() { - return minProximity; - } - - public void setMinProximity(Integer minProximity) { - this.minProximity = minProximity; - } - - public IndexSettings responseFields(List responseFields) { - this.responseFields = responseFields; - return this; - } - - public IndexSettings addResponseFieldsItem(String responseFieldsItem) { - if (this.responseFields == null) { - this.responseFields = new ArrayList<>(); - } - this.responseFields.add(responseFieldsItem); - return this; - } - - /** - * Choose which fields to return in the API response. This parameters applies to search and browse - * queries. - * - * @return responseFields - */ - @javax.annotation.Nullable - public List getResponseFields() { - return responseFields; - } - - public void setResponseFields(List responseFields) { - this.responseFields = responseFields; - } - - public IndexSettings maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet hits to return during a search for facet values. For performance - * reasons, the maximum allowed number of returned values is 100. maximum: 100 - * - * @return maxFacetHits - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - - public void setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - } - - public IndexSettings attributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - return this; - } - - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select - * which searchable attribute is matched in the attribute ranking stage. - * - * @return attributeCriteriaComputedByMinProximity - */ - @javax.annotation.Nullable - public Boolean getAttributeCriteriaComputedByMinProximity() { - return attributeCriteriaComputedByMinProximity; - } - - public void setAttributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - } - - public IndexSettings renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a - * default value and can be overridden via rules. - * - * @return renderingContent - */ - @javax.annotation.Nullable - public Object getRenderingContent() { - return renderingContent; - } - - public void setRenderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IndexSettings indexSettings = (IndexSettings) o; - return ( - Objects.equals(this.replicas, indexSettings.replicas) && - Objects.equals( - this.paginationLimitedTo, - indexSettings.paginationLimitedTo - ) && - Objects.equals( - this.disableTypoToleranceOnWords, - indexSettings.disableTypoToleranceOnWords - ) && - Objects.equals( - this.attributesToTransliterate, - indexSettings.attributesToTransliterate - ) && - Objects.equals( - this.camelCaseAttributes, - indexSettings.camelCaseAttributes - ) && - Objects.equals( - this.decompoundedAttributes, - indexSettings.decompoundedAttributes - ) && - Objects.equals(this.indexLanguages, indexSettings.indexLanguages) && - Objects.equals(this.filterPromotes, indexSettings.filterPromotes) && - Objects.equals( - this.disablePrefixOnAttributes, - indexSettings.disablePrefixOnAttributes - ) && - Objects.equals( - this.allowCompressionOfIntegerArray, - indexSettings.allowCompressionOfIntegerArray - ) && - Objects.equals( - this.numericAttributesForFiltering, - indexSettings.numericAttributesForFiltering - ) && - Objects.equals(this.userData, indexSettings.userData) && - Objects.equals( - this.searchableAttributes, - indexSettings.searchableAttributes - ) && - Objects.equals( - this.attributesForFaceting, - indexSettings.attributesForFaceting - ) && - Objects.equals( - this.unretrievableAttributes, - indexSettings.unretrievableAttributes - ) && - Objects.equals( - this.attributesToRetrieve, - indexSettings.attributesToRetrieve - ) && - Objects.equals( - this.restrictSearchableAttributes, - indexSettings.restrictSearchableAttributes - ) && - Objects.equals(this.ranking, indexSettings.ranking) && - Objects.equals(this.customRanking, indexSettings.customRanking) && - Objects.equals( - this.relevancyStrictness, - indexSettings.relevancyStrictness - ) && - Objects.equals( - this.attributesToHighlight, - indexSettings.attributesToHighlight - ) && - Objects.equals( - this.attributesToSnippet, - indexSettings.attributesToSnippet - ) && - Objects.equals(this.highlightPreTag, indexSettings.highlightPreTag) && - Objects.equals(this.highlightPostTag, indexSettings.highlightPostTag) && - Objects.equals( - this.snippetEllipsisText, - indexSettings.snippetEllipsisText - ) && - Objects.equals( - this.restrictHighlightAndSnippetArrays, - indexSettings.restrictHighlightAndSnippetArrays - ) && - Objects.equals(this.hitsPerPage, indexSettings.hitsPerPage) && - Objects.equals( - this.minWordSizefor1Typo, - indexSettings.minWordSizefor1Typo - ) && - Objects.equals( - this.minWordSizefor2Typos, - indexSettings.minWordSizefor2Typos - ) && - Objects.equals(this.typoTolerance, indexSettings.typoTolerance) && - Objects.equals( - this.allowTyposOnNumericTokens, - indexSettings.allowTyposOnNumericTokens - ) && - Objects.equals( - this.disableTypoToleranceOnAttributes, - indexSettings.disableTypoToleranceOnAttributes - ) && - Objects.equals(this.separatorsToIndex, indexSettings.separatorsToIndex) && - Objects.equals(this.ignorePlurals, indexSettings.ignorePlurals) && - Objects.equals(this.removeStopWords, indexSettings.removeStopWords) && - Objects.equals( - this.keepDiacriticsOnCharacters, - indexSettings.keepDiacriticsOnCharacters - ) && - Objects.equals(this.queryLanguages, indexSettings.queryLanguages) && - Objects.equals(this.decompoundQuery, indexSettings.decompoundQuery) && - Objects.equals(this.enableRules, indexSettings.enableRules) && - Objects.equals( - this.enablePersonalization, - indexSettings.enablePersonalization - ) && - Objects.equals(this.queryType, indexSettings.queryType) && - Objects.equals( - this.removeWordsIfNoResults, - indexSettings.removeWordsIfNoResults - ) && - Objects.equals(this.advancedSyntax, indexSettings.advancedSyntax) && - Objects.equals(this.optionalWords, indexSettings.optionalWords) && - Objects.equals( - this.disableExactOnAttributes, - indexSettings.disableExactOnAttributes - ) && - Objects.equals( - this.exactOnSingleWordQuery, - indexSettings.exactOnSingleWordQuery - ) && - Objects.equals( - this.alternativesAsExact, - indexSettings.alternativesAsExact - ) && - Objects.equals( - this.advancedSyntaxFeatures, - indexSettings.advancedSyntaxFeatures - ) && - Objects.equals(this.distinct, indexSettings.distinct) && - Objects.equals(this.synonyms, indexSettings.synonyms) && - Objects.equals( - this.replaceSynonymsInHighlight, - indexSettings.replaceSynonymsInHighlight - ) && - Objects.equals(this.minProximity, indexSettings.minProximity) && - Objects.equals(this.responseFields, indexSettings.responseFields) && - Objects.equals(this.maxFacetHits, indexSettings.maxFacetHits) && - Objects.equals( - this.attributeCriteriaComputedByMinProximity, - indexSettings.attributeCriteriaComputedByMinProximity - ) && - Objects.equals(this.renderingContent, indexSettings.renderingContent) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - replicas, - paginationLimitedTo, - disableTypoToleranceOnWords, - attributesToTransliterate, - camelCaseAttributes, - decompoundedAttributes, - indexLanguages, - filterPromotes, - disablePrefixOnAttributes, - allowCompressionOfIntegerArray, - numericAttributesForFiltering, - userData, - searchableAttributes, - attributesForFaceting, - unretrievableAttributes, - attributesToRetrieve, - restrictSearchableAttributes, - ranking, - customRanking, - relevancyStrictness, - attributesToHighlight, - attributesToSnippet, - highlightPreTag, - highlightPostTag, - snippetEllipsisText, - restrictHighlightAndSnippetArrays, - hitsPerPage, - minWordSizefor1Typo, - minWordSizefor2Typos, - typoTolerance, - allowTyposOnNumericTokens, - disableTypoToleranceOnAttributes, - separatorsToIndex, - ignorePlurals, - removeStopWords, - keepDiacriticsOnCharacters, - queryLanguages, - decompoundQuery, - enableRules, - enablePersonalization, - queryType, - removeWordsIfNoResults, - advancedSyntax, - optionalWords, - disableExactOnAttributes, - exactOnSingleWordQuery, - alternativesAsExact, - advancedSyntaxFeatures, - distinct, - synonyms, - replaceSynonymsInHighlight, - minProximity, - responseFields, - maxFacetHits, - attributeCriteriaComputedByMinProximity, - renderingContent - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IndexSettings {\n"); - sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); - sb - .append(" paginationLimitedTo: ") - .append(toIndentedString(paginationLimitedTo)) - .append("\n"); - sb - .append(" disableTypoToleranceOnWords: ") - .append(toIndentedString(disableTypoToleranceOnWords)) - .append("\n"); - sb - .append(" attributesToTransliterate: ") - .append(toIndentedString(attributesToTransliterate)) - .append("\n"); - sb - .append(" camelCaseAttributes: ") - .append(toIndentedString(camelCaseAttributes)) - .append("\n"); - sb - .append(" decompoundedAttributes: ") - .append(toIndentedString(decompoundedAttributes)) - .append("\n"); - sb - .append(" indexLanguages: ") - .append(toIndentedString(indexLanguages)) - .append("\n"); - sb - .append(" filterPromotes: ") - .append(toIndentedString(filterPromotes)) - .append("\n"); - sb - .append(" disablePrefixOnAttributes: ") - .append(toIndentedString(disablePrefixOnAttributes)) - .append("\n"); - sb - .append(" allowCompressionOfIntegerArray: ") - .append(toIndentedString(allowCompressionOfIntegerArray)) - .append("\n"); - sb - .append(" numericAttributesForFiltering: ") - .append(toIndentedString(numericAttributesForFiltering)) - .append("\n"); - sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb - .append(" searchableAttributes: ") - .append(toIndentedString(searchableAttributes)) - .append("\n"); - sb - .append(" attributesForFaceting: ") - .append(toIndentedString(attributesForFaceting)) - .append("\n"); - sb - .append(" unretrievableAttributes: ") - .append(toIndentedString(unretrievableAttributes)) - .append("\n"); - sb - .append(" attributesToRetrieve: ") - .append(toIndentedString(attributesToRetrieve)) - .append("\n"); - sb - .append(" restrictSearchableAttributes: ") - .append(toIndentedString(restrictSearchableAttributes)) - .append("\n"); - sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb - .append(" customRanking: ") - .append(toIndentedString(customRanking)) - .append("\n"); - sb - .append(" relevancyStrictness: ") - .append(toIndentedString(relevancyStrictness)) - .append("\n"); - sb - .append(" attributesToHighlight: ") - .append(toIndentedString(attributesToHighlight)) - .append("\n"); - sb - .append(" attributesToSnippet: ") - .append(toIndentedString(attributesToSnippet)) - .append("\n"); - sb - .append(" highlightPreTag: ") - .append(toIndentedString(highlightPreTag)) - .append("\n"); - sb - .append(" highlightPostTag: ") - .append(toIndentedString(highlightPostTag)) - .append("\n"); - sb - .append(" snippetEllipsisText: ") - .append(toIndentedString(snippetEllipsisText)) - .append("\n"); - sb - .append(" restrictHighlightAndSnippetArrays: ") - .append(toIndentedString(restrictHighlightAndSnippetArrays)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb - .append(" minWordSizefor1Typo: ") - .append(toIndentedString(minWordSizefor1Typo)) - .append("\n"); - sb - .append(" minWordSizefor2Typos: ") - .append(toIndentedString(minWordSizefor2Typos)) - .append("\n"); - sb - .append(" typoTolerance: ") - .append(toIndentedString(typoTolerance)) - .append("\n"); - sb - .append(" allowTyposOnNumericTokens: ") - .append(toIndentedString(allowTyposOnNumericTokens)) - .append("\n"); - sb - .append(" disableTypoToleranceOnAttributes: ") - .append(toIndentedString(disableTypoToleranceOnAttributes)) - .append("\n"); - sb - .append(" separatorsToIndex: ") - .append(toIndentedString(separatorsToIndex)) - .append("\n"); - sb - .append(" ignorePlurals: ") - .append(toIndentedString(ignorePlurals)) - .append("\n"); - sb - .append(" removeStopWords: ") - .append(toIndentedString(removeStopWords)) - .append("\n"); - sb - .append(" keepDiacriticsOnCharacters: ") - .append(toIndentedString(keepDiacriticsOnCharacters)) - .append("\n"); - sb - .append(" queryLanguages: ") - .append(toIndentedString(queryLanguages)) - .append("\n"); - sb - .append(" decompoundQuery: ") - .append(toIndentedString(decompoundQuery)) - .append("\n"); - sb - .append(" enableRules: ") - .append(toIndentedString(enableRules)) - .append("\n"); - sb - .append(" enablePersonalization: ") - .append(toIndentedString(enablePersonalization)) - .append("\n"); - sb - .append(" queryType: ") - .append(toIndentedString(queryType)) - .append("\n"); - sb - .append(" removeWordsIfNoResults: ") - .append(toIndentedString(removeWordsIfNoResults)) - .append("\n"); - sb - .append(" advancedSyntax: ") - .append(toIndentedString(advancedSyntax)) - .append("\n"); - sb - .append(" optionalWords: ") - .append(toIndentedString(optionalWords)) - .append("\n"); - sb - .append(" disableExactOnAttributes: ") - .append(toIndentedString(disableExactOnAttributes)) - .append("\n"); - sb - .append(" exactOnSingleWordQuery: ") - .append(toIndentedString(exactOnSingleWordQuery)) - .append("\n"); - sb - .append(" alternativesAsExact: ") - .append(toIndentedString(alternativesAsExact)) - .append("\n"); - sb - .append(" advancedSyntaxFeatures: ") - .append(toIndentedString(advancedSyntaxFeatures)) - .append("\n"); - sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb - .append(" replaceSynonymsInHighlight: ") - .append(toIndentedString(replaceSynonymsInHighlight)) - .append("\n"); - sb - .append(" minProximity: ") - .append(toIndentedString(minProximity)) - .append("\n"); - sb - .append(" responseFields: ") - .append(toIndentedString(responseFields)) - .append("\n"); - sb - .append(" maxFacetHits: ") - .append(toIndentedString(maxFacetHits)) - .append("\n"); - sb - .append(" attributeCriteriaComputedByMinProximity: ") - .append(toIndentedString(attributeCriteriaComputedByMinProximity)) - .append("\n"); - sb - .append(" renderingContent: ") - .append(toIndentedString(renderingContent)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java deleted file mode 100644 index b848b133e3..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ /dev/null @@ -1,1960 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** IndexSettingsAsSearchParams */ -public class IndexSettingsAsSearchParams { - - @SerializedName("searchableAttributes") - private List searchableAttributes = null; - - @SerializedName("attributesForFaceting") - private List attributesForFaceting = null; - - @SerializedName("unretrievableAttributes") - private List unretrievableAttributes = null; - - @SerializedName("attributesToRetrieve") - private List attributesToRetrieve = null; - - @SerializedName("restrictSearchableAttributes") - private List restrictSearchableAttributes = null; - - @SerializedName("ranking") - private List ranking = null; - - @SerializedName("customRanking") - private List customRanking = null; - - @SerializedName("relevancyStrictness") - private Integer relevancyStrictness = 100; - - @SerializedName("attributesToHighlight") - private List attributesToHighlight = null; - - @SerializedName("attributesToSnippet") - private List attributesToSnippet = null; - - @SerializedName("highlightPreTag") - private String highlightPreTag = ""; - - @SerializedName("highlightPostTag") - private String highlightPostTag = ""; - - @SerializedName("snippetEllipsisText") - private String snippetEllipsisText = "…"; - - @SerializedName("restrictHighlightAndSnippetArrays") - private Boolean restrictHighlightAndSnippetArrays = false; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("minWordSizefor1Typo") - private Integer minWordSizefor1Typo = 4; - - @SerializedName("minWordSizefor2Typos") - private Integer minWordSizefor2Typos = 8; - - /** Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) - public enum TypoToleranceEnum { - TRUE("true"), - - FALSE("false"), - - MIN("min"), - - STRICT("strict"); - - private String value; - - TypoToleranceEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static TypoToleranceEnum fromValue(String value) { - for (TypoToleranceEnum b : TypoToleranceEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } - } - - @SerializedName("typoTolerance") - private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - - @SerializedName("allowTyposOnNumericTokens") - private Boolean allowTyposOnNumericTokens = true; - - @SerializedName("disableTypoToleranceOnAttributes") - private List disableTypoToleranceOnAttributes = null; - - @SerializedName("separatorsToIndex") - private String separatorsToIndex = ""; - - @SerializedName("ignorePlurals") - private String ignorePlurals = "false"; - - @SerializedName("removeStopWords") - private String removeStopWords = "false"; - - @SerializedName("keepDiacriticsOnCharacters") - private String keepDiacriticsOnCharacters = ""; - - @SerializedName("queryLanguages") - private List queryLanguages = null; - - @SerializedName("decompoundQuery") - private Boolean decompoundQuery = true; - - @SerializedName("enableRules") - private Boolean enableRules = true; - - @SerializedName("enablePersonalization") - private Boolean enablePersonalization = false; - - /** Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) - public enum QueryTypeEnum { - PREFIXLAST("prefixLast"), - - PREFIXALL("prefixAll"), - - PREFIXNONE("prefixNone"); - - private String value; - - QueryTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static QueryTypeEnum fromValue(String value) { - for (QueryTypeEnum b : QueryTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } - } - - @SerializedName("queryType") - private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - - /** Selects a strategy to remove words from the query when it doesn't match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) - public enum RemoveWordsIfNoResultsEnum { - NONE("none"), - - LASTWORDS("lastWords"), - - FIRSTWORDS("firstWords"), - - ALLOPTIONAL("allOptional"); - - private String value; - - RemoveWordsIfNoResultsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RemoveWordsIfNoResultsEnum fromValue(String value) { - for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } - } - - @SerializedName("removeWordsIfNoResults") - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = - RemoveWordsIfNoResultsEnum.NONE; - - @SerializedName("advancedSyntax") - private Boolean advancedSyntax = false; - - @SerializedName("optionalWords") - private List optionalWords = null; - - @SerializedName("disableExactOnAttributes") - private List disableExactOnAttributes = null; - - /** Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) - public enum ExactOnSingleWordQueryEnum { - ATTRIBUTE("attribute"), - - NONE("none"), - - WORD("word"); - - private String value; - - ExactOnSingleWordQueryEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ExactOnSingleWordQueryEnum fromValue(String value) { - for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } - } - - @SerializedName("exactOnSingleWordQuery") - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = - ExactOnSingleWordQueryEnum.ATTRIBUTE; - - /** Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) - public enum AlternativesAsExactEnum { - IGNOREPLURALS("ignorePlurals"), - - SINGLEWORDSYNONYM("singleWordSynonym"), - - MULTIWORDSSYNONYM("multiWordsSynonym"); - - private String value; - - AlternativesAsExactEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AlternativesAsExactEnum fromValue(String value) { - for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } - } - - @SerializedName("alternativesAsExact") - private List alternativesAsExact = null; - - /** Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) - public enum AdvancedSyntaxFeaturesEnum { - EXACTPHRASE("exactPhrase"), - - EXCLUDEWORDS("excludeWords"); - - private String value; - - AdvancedSyntaxFeaturesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AdvancedSyntaxFeaturesEnum fromValue(String value) { - for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } - } - - @SerializedName("advancedSyntaxFeatures") - private List advancedSyntaxFeatures = null; - - @SerializedName("distinct") - private Integer distinct = 0; - - @SerializedName("synonyms") - private Boolean synonyms = true; - - @SerializedName("replaceSynonymsInHighlight") - private Boolean replaceSynonymsInHighlight = false; - - @SerializedName("minProximity") - private Integer minProximity = 1; - - @SerializedName("responseFields") - private List responseFields = null; - - @SerializedName("maxFacetHits") - private Integer maxFacetHits = 10; - - @SerializedName("attributeCriteriaComputedByMinProximity") - private Boolean attributeCriteriaComputedByMinProximity = false; - - @SerializedName("renderingContent") - private Object renderingContent = new Object(); - - public IndexSettingsAsSearchParams searchableAttributes( - List searchableAttributes - ) { - this.searchableAttributes = searchableAttributes; - return this; - } - - public IndexSettingsAsSearchParams addSearchableAttributesItem( - String searchableAttributesItem - ) { - if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList<>(); - } - this.searchableAttributes.add(searchableAttributesItem); - return this; - } - - /** - * The complete list of attributes used for searching. - * - * @return searchableAttributes - */ - @javax.annotation.Nullable - public List getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public IndexSettingsAsSearchParams attributesForFaceting( - List attributesForFaceting - ) { - this.attributesForFaceting = attributesForFaceting; - return this; - } - - public IndexSettingsAsSearchParams addAttributesForFacetingItem( - String attributesForFacetingItem - ) { - if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList<>(); - } - this.attributesForFaceting.add(attributesForFacetingItem); - return this; - } - - /** - * The complete list of attributes that will be used for faceting. - * - * @return attributesForFaceting - */ - @javax.annotation.Nullable - public List getAttributesForFaceting() { - return attributesForFaceting; - } - - public void setAttributesForFaceting(List attributesForFaceting) { - this.attributesForFaceting = attributesForFaceting; - } - - public IndexSettingsAsSearchParams unretrievableAttributes( - List unretrievableAttributes - ) { - this.unretrievableAttributes = unretrievableAttributes; - return this; - } - - public IndexSettingsAsSearchParams addUnretrievableAttributesItem( - String unretrievableAttributesItem - ) { - if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList<>(); - } - this.unretrievableAttributes.add(unretrievableAttributesItem); - return this; - } - - /** - * List of attributes that can't be retrieved at query time. - * - * @return unretrievableAttributes - */ - @javax.annotation.Nullable - public List getUnretrievableAttributes() { - return unretrievableAttributes; - } - - public void setUnretrievableAttributes(List unretrievableAttributes) { - this.unretrievableAttributes = unretrievableAttributes; - } - - public IndexSettingsAsSearchParams attributesToRetrieve( - List attributesToRetrieve - ) { - this.attributesToRetrieve = attributesToRetrieve; - return this; - } - - public IndexSettingsAsSearchParams addAttributesToRetrieveItem( - String attributesToRetrieveItem - ) { - if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList<>(); - } - this.attributesToRetrieve.add(attributesToRetrieveItem); - return this; - } - - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - * - * @return attributesToRetrieve - */ - @javax.annotation.Nullable - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public void setAttributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - } - - public IndexSettingsAsSearchParams restrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - return this; - } - - public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem( - String restrictSearchableAttributesItem - ) { - if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList<>(); - } - this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); - return this; - } - - /** - * Restricts a given query to look in only a subset of your searchable attributes. - * - * @return restrictSearchableAttributes - */ - @javax.annotation.Nullable - public List getRestrictSearchableAttributes() { - return restrictSearchableAttributes; - } - - public void setRestrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - } - - public IndexSettingsAsSearchParams ranking(List ranking) { - this.ranking = ranking; - return this; - } - - public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { - if (this.ranking == null) { - this.ranking = new ArrayList<>(); - } - this.ranking.add(rankingItem); - return this; - } - - /** - * Controls how Algolia should sort your results. - * - * @return ranking - */ - @javax.annotation.Nullable - public List getRanking() { - return ranking; - } - - public void setRanking(List ranking) { - this.ranking = ranking; - } - - public IndexSettingsAsSearchParams customRanking(List customRanking) { - this.customRanking = customRanking; - return this; - } - - public IndexSettingsAsSearchParams addCustomRankingItem( - String customRankingItem - ) { - if (this.customRanking == null) { - this.customRanking = new ArrayList<>(); - } - this.customRanking.add(customRankingItem); - return this; - } - - /** - * Specifies the custom ranking criterion. - * - * @return customRanking - */ - @javax.annotation.Nullable - public List getCustomRanking() { - return customRanking; - } - - public void setCustomRanking(List customRanking) { - this.customRanking = customRanking; - } - - public IndexSettingsAsSearchParams relevancyStrictness( - Integer relevancyStrictness - ) { - this.relevancyStrictness = relevancyStrictness; - return this; - } - - /** - * Controls the relevancy threshold below which less relevant results aren't included in the - * results. - * - * @return relevancyStrictness - */ - @javax.annotation.Nullable - public Integer getRelevancyStrictness() { - return relevancyStrictness; - } - - public void setRelevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - } - - public IndexSettingsAsSearchParams attributesToHighlight( - List attributesToHighlight - ) { - this.attributesToHighlight = attributesToHighlight; - return this; - } - - public IndexSettingsAsSearchParams addAttributesToHighlightItem( - String attributesToHighlightItem - ) { - if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList<>(); - } - this.attributesToHighlight.add(attributesToHighlightItem); - return this; - } - - /** - * List of attributes to highlight. - * - * @return attributesToHighlight - */ - @javax.annotation.Nullable - public List getAttributesToHighlight() { - return attributesToHighlight; - } - - public void setAttributesToHighlight(List attributesToHighlight) { - this.attributesToHighlight = attributesToHighlight; - } - - public IndexSettingsAsSearchParams attributesToSnippet( - List attributesToSnippet - ) { - this.attributesToSnippet = attributesToSnippet; - return this; - } - - public IndexSettingsAsSearchParams addAttributesToSnippetItem( - String attributesToSnippetItem - ) { - if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList<>(); - } - this.attributesToSnippet.add(attributesToSnippetItem); - return this; - } - - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - * - * @return attributesToSnippet - */ - @javax.annotation.Nullable - public List getAttributesToSnippet() { - return attributesToSnippet; - } - - public void setAttributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - } - - public IndexSettingsAsSearchParams highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - return this; - } - - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - * - * @return highlightPreTag - */ - @javax.annotation.Nullable - public String getHighlightPreTag() { - return highlightPreTag; - } - - public void setHighlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - } - - public IndexSettingsAsSearchParams highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - return this; - } - - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - * - * @return highlightPostTag - */ - @javax.annotation.Nullable - public String getHighlightPostTag() { - return highlightPostTag; - } - - public void setHighlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - } - - public IndexSettingsAsSearchParams snippetEllipsisText( - String snippetEllipsisText - ) { - this.snippetEllipsisText = snippetEllipsisText; - return this; - } - - /** - * String used as an ellipsis indicator when a snippet is truncated. - * - * @return snippetEllipsisText - */ - @javax.annotation.Nullable - public String getSnippetEllipsisText() { - return snippetEllipsisText; - } - - public void setSnippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - } - - public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - return this; - } - - /** - * Restrict highlighting and snippeting to items that matched the query. - * - * @return restrictHighlightAndSnippetArrays - */ - @javax.annotation.Nullable - public Boolean getRestrictHighlightAndSnippetArrays() { - return restrictHighlightAndSnippetArrays; - } - - public void setRestrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - } - - public IndexSettingsAsSearchParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public IndexSettingsAsSearchParams minWordSizefor1Typo( - Integer minWordSizefor1Typo - ) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 - * typo. - * - * @return minWordSizefor1Typo - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor1Typo() { - return minWordSizefor1Typo; - } - - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - } - - public IndexSettingsAsSearchParams minWordSizefor2Typos( - Integer minWordSizefor2Typos - ) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 - * typos. - * - * @return minWordSizefor2Typos - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor2Typos() { - return minWordSizefor2Typos; - } - - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - } - - public IndexSettingsAsSearchParams typoTolerance( - TypoToleranceEnum typoTolerance - ) { - this.typoTolerance = typoTolerance; - return this; - } - - /** - * Controls whether typo tolerance is enabled and how it is applied. - * - * @return typoTolerance - */ - @javax.annotation.Nullable - public TypoToleranceEnum getTypoTolerance() { - return typoTolerance; - } - - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - } - - public IndexSettingsAsSearchParams allowTyposOnNumericTokens( - Boolean allowTyposOnNumericTokens - ) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - return this; - } - - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - * - * @return allowTyposOnNumericTokens - */ - @javax.annotation.Nullable - public Boolean getAllowTyposOnNumericTokens() { - return allowTyposOnNumericTokens; - } - - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - } - - public IndexSettingsAsSearchParams disableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - return this; - } - - public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem( - String disableTypoToleranceOnAttributesItem - ) { - if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList<>(); - } - this.disableTypoToleranceOnAttributes.add( - disableTypoToleranceOnAttributesItem - ); - return this; - } - - /** - * List of attributes on which you want to disable typo tolerance. - * - * @return disableTypoToleranceOnAttributes - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnAttributes() { - return disableTypoToleranceOnAttributes; - } - - public void setDisableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - } - - public IndexSettingsAsSearchParams separatorsToIndex( - String separatorsToIndex - ) { - this.separatorsToIndex = separatorsToIndex; - return this; - } - - /** - * Control which separators are indexed. - * - * @return separatorsToIndex - */ - @javax.annotation.Nullable - public String getSeparatorsToIndex() { - return separatorsToIndex; - } - - public void setSeparatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - } - - public IndexSettingsAsSearchParams ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - return this; - } - - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - * - * @return ignorePlurals - */ - @javax.annotation.Nullable - public String getIgnorePlurals() { - return ignorePlurals; - } - - public void setIgnorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - } - - public IndexSettingsAsSearchParams removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - return this; - } - - /** - * Removes stop (common) words from the query before executing it. - * - * @return removeStopWords - */ - @javax.annotation.Nullable - public String getRemoveStopWords() { - return removeStopWords; - } - - public void setRemoveStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - } - - public IndexSettingsAsSearchParams keepDiacriticsOnCharacters( - String keepDiacriticsOnCharacters - ) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - return this; - } - - /** - * List of characters that the engine shouldn't automatically normalize. - * - * @return keepDiacriticsOnCharacters - */ - @javax.annotation.Nullable - public String getKeepDiacriticsOnCharacters() { - return keepDiacriticsOnCharacters; - } - - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - } - - public IndexSettingsAsSearchParams queryLanguages( - List queryLanguages - ) { - this.queryLanguages = queryLanguages; - return this; - } - - public IndexSettingsAsSearchParams addQueryLanguagesItem( - String queryLanguagesItem - ) { - if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList<>(); - } - this.queryLanguages.add(queryLanguagesItem); - return this; - } - - /** - * Sets the languages to be used by language-specific settings and functionalities such as - * ignorePlurals, removeStopWords, and CJK word-detection. - * - * @return queryLanguages - */ - @javax.annotation.Nullable - public List getQueryLanguages() { - return queryLanguages; - } - - public void setQueryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - } - - public IndexSettingsAsSearchParams decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - return this; - } - - /** - * Splits compound words into their composing atoms in the query. - * - * @return decompoundQuery - */ - @javax.annotation.Nullable - public Boolean getDecompoundQuery() { - return decompoundQuery; - } - - public void setDecompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - } - - public IndexSettingsAsSearchParams enableRules(Boolean enableRules) { - this.enableRules = enableRules; - return this; - } - - /** - * Whether Rules should be globally enabled. - * - * @return enableRules - */ - @javax.annotation.Nullable - public Boolean getEnableRules() { - return enableRules; - } - - public void setEnableRules(Boolean enableRules) { - this.enableRules = enableRules; - } - - public IndexSettingsAsSearchParams enablePersonalization( - Boolean enablePersonalization - ) { - this.enablePersonalization = enablePersonalization; - return this; - } - - /** - * Enable the Personalization feature. - * - * @return enablePersonalization - */ - @javax.annotation.Nullable - public Boolean getEnablePersonalization() { - return enablePersonalization; - } - - public void setEnablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - } - - public IndexSettingsAsSearchParams queryType(QueryTypeEnum queryType) { - this.queryType = queryType; - return this; - } - - /** - * Controls if and how query words are interpreted as prefixes. - * - * @return queryType - */ - @javax.annotation.Nullable - public QueryTypeEnum getQueryType() { - return queryType; - } - - public void setQueryType(QueryTypeEnum queryType) { - this.queryType = queryType; - } - - public IndexSettingsAsSearchParams removeWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - return this; - } - - /** - * Selects a strategy to remove words from the query when it doesn't match any hits. - * - * @return removeWordsIfNoResults - */ - @javax.annotation.Nullable - public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { - return removeWordsIfNoResults; - } - - public void setRemoveWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - } - - public IndexSettingsAsSearchParams advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - return this; - } - - /** - * Enables the advanced query syntax. - * - * @return advancedSyntax - */ - @javax.annotation.Nullable - public Boolean getAdvancedSyntax() { - return advancedSyntax; - } - - public void setAdvancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - } - - public IndexSettingsAsSearchParams optionalWords(List optionalWords) { - this.optionalWords = optionalWords; - return this; - } - - public IndexSettingsAsSearchParams addOptionalWordsItem( - String optionalWordsItem - ) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * A list of words that should be considered as optional when found in the query. - * - * @return optionalWords - */ - @javax.annotation.Nullable - public List getOptionalWords() { - return optionalWords; - } - - public void setOptionalWords(List optionalWords) { - this.optionalWords = optionalWords; - } - - public IndexSettingsAsSearchParams disableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - return this; - } - - public IndexSettingsAsSearchParams addDisableExactOnAttributesItem( - String disableExactOnAttributesItem - ) { - if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList<>(); - } - this.disableExactOnAttributes.add(disableExactOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable the exact ranking criterion. - * - * @return disableExactOnAttributes - */ - @javax.annotation.Nullable - public List getDisableExactOnAttributes() { - return disableExactOnAttributes; - } - - public void setDisableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - } - - public IndexSettingsAsSearchParams exactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - return this; - } - - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - * - * @return exactOnSingleWordQuery - */ - @javax.annotation.Nullable - public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { - return exactOnSingleWordQuery; - } - - public void setExactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - } - - public IndexSettingsAsSearchParams alternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - return this; - } - - public IndexSettingsAsSearchParams addAlternativesAsExactItem( - AlternativesAsExactEnum alternativesAsExactItem - ) { - if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList<>(); - } - this.alternativesAsExact.add(alternativesAsExactItem); - return this; - } - - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - * - * @return alternativesAsExact - */ - @javax.annotation.Nullable - public List getAlternativesAsExact() { - return alternativesAsExact; - } - - public void setAlternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - } - - public IndexSettingsAsSearchParams advancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - return this; - } - - public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem( - AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem - ) { - if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList<>(); - } - this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); - return this; - } - - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is - * enabled. - * - * @return advancedSyntaxFeatures - */ - @javax.annotation.Nullable - public List getAdvancedSyntaxFeatures() { - return advancedSyntaxFeatures; - } - - public void setAdvancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - } - - public IndexSettingsAsSearchParams distinct(Integer distinct) { - this.distinct = distinct; - return this; - } - - /** - * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 - * - * @return distinct - */ - @javax.annotation.Nullable - public Integer getDistinct() { - return distinct; - } - - public void setDistinct(Integer distinct) { - this.distinct = distinct; - } - - public IndexSettingsAsSearchParams synonyms(Boolean synonyms) { - this.synonyms = synonyms; - return this; - } - - /** - * Whether to take into account an index's synonyms for a particular search. - * - * @return synonyms - */ - @javax.annotation.Nullable - public Boolean getSynonyms() { - return synonyms; - } - - public void setSynonyms(Boolean synonyms) { - this.synonyms = synonyms; - } - - public IndexSettingsAsSearchParams replaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - return this; - } - - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym - * itself. - * - * @return replaceSynonymsInHighlight - */ - @javax.annotation.Nullable - public Boolean getReplaceSynonymsInHighlight() { - return replaceSynonymsInHighlight; - } - - public void setReplaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - } - - public IndexSettingsAsSearchParams minProximity(Integer minProximity) { - this.minProximity = minProximity; - return this; - } - - /** - * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 - * - * @return minProximity - */ - @javax.annotation.Nullable - public Integer getMinProximity() { - return minProximity; - } - - public void setMinProximity(Integer minProximity) { - this.minProximity = minProximity; - } - - public IndexSettingsAsSearchParams responseFields( - List responseFields - ) { - this.responseFields = responseFields; - return this; - } - - public IndexSettingsAsSearchParams addResponseFieldsItem( - String responseFieldsItem - ) { - if (this.responseFields == null) { - this.responseFields = new ArrayList<>(); - } - this.responseFields.add(responseFieldsItem); - return this; - } - - /** - * Choose which fields to return in the API response. This parameters applies to search and browse - * queries. - * - * @return responseFields - */ - @javax.annotation.Nullable - public List getResponseFields() { - return responseFields; - } - - public void setResponseFields(List responseFields) { - this.responseFields = responseFields; - } - - public IndexSettingsAsSearchParams maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet hits to return during a search for facet values. For performance - * reasons, the maximum allowed number of returned values is 100. maximum: 100 - * - * @return maxFacetHits - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - - public void setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - } - - public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - return this; - } - - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select - * which searchable attribute is matched in the attribute ranking stage. - * - * @return attributeCriteriaComputedByMinProximity - */ - @javax.annotation.Nullable - public Boolean getAttributeCriteriaComputedByMinProximity() { - return attributeCriteriaComputedByMinProximity; - } - - public void setAttributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - } - - public IndexSettingsAsSearchParams renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a - * default value and can be overridden via rules. - * - * @return renderingContent - */ - @javax.annotation.Nullable - public Object getRenderingContent() { - return renderingContent; - } - - public void setRenderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IndexSettingsAsSearchParams indexSettingsAsSearchParams = (IndexSettingsAsSearchParams) o; - return ( - Objects.equals( - this.searchableAttributes, - indexSettingsAsSearchParams.searchableAttributes - ) && - Objects.equals( - this.attributesForFaceting, - indexSettingsAsSearchParams.attributesForFaceting - ) && - Objects.equals( - this.unretrievableAttributes, - indexSettingsAsSearchParams.unretrievableAttributes - ) && - Objects.equals( - this.attributesToRetrieve, - indexSettingsAsSearchParams.attributesToRetrieve - ) && - Objects.equals( - this.restrictSearchableAttributes, - indexSettingsAsSearchParams.restrictSearchableAttributes - ) && - Objects.equals(this.ranking, indexSettingsAsSearchParams.ranking) && - Objects.equals( - this.customRanking, - indexSettingsAsSearchParams.customRanking - ) && - Objects.equals( - this.relevancyStrictness, - indexSettingsAsSearchParams.relevancyStrictness - ) && - Objects.equals( - this.attributesToHighlight, - indexSettingsAsSearchParams.attributesToHighlight - ) && - Objects.equals( - this.attributesToSnippet, - indexSettingsAsSearchParams.attributesToSnippet - ) && - Objects.equals( - this.highlightPreTag, - indexSettingsAsSearchParams.highlightPreTag - ) && - Objects.equals( - this.highlightPostTag, - indexSettingsAsSearchParams.highlightPostTag - ) && - Objects.equals( - this.snippetEllipsisText, - indexSettingsAsSearchParams.snippetEllipsisText - ) && - Objects.equals( - this.restrictHighlightAndSnippetArrays, - indexSettingsAsSearchParams.restrictHighlightAndSnippetArrays - ) && - Objects.equals( - this.hitsPerPage, - indexSettingsAsSearchParams.hitsPerPage - ) && - Objects.equals( - this.minWordSizefor1Typo, - indexSettingsAsSearchParams.minWordSizefor1Typo - ) && - Objects.equals( - this.minWordSizefor2Typos, - indexSettingsAsSearchParams.minWordSizefor2Typos - ) && - Objects.equals( - this.typoTolerance, - indexSettingsAsSearchParams.typoTolerance - ) && - Objects.equals( - this.allowTyposOnNumericTokens, - indexSettingsAsSearchParams.allowTyposOnNumericTokens - ) && - Objects.equals( - this.disableTypoToleranceOnAttributes, - indexSettingsAsSearchParams.disableTypoToleranceOnAttributes - ) && - Objects.equals( - this.separatorsToIndex, - indexSettingsAsSearchParams.separatorsToIndex - ) && - Objects.equals( - this.ignorePlurals, - indexSettingsAsSearchParams.ignorePlurals - ) && - Objects.equals( - this.removeStopWords, - indexSettingsAsSearchParams.removeStopWords - ) && - Objects.equals( - this.keepDiacriticsOnCharacters, - indexSettingsAsSearchParams.keepDiacriticsOnCharacters - ) && - Objects.equals( - this.queryLanguages, - indexSettingsAsSearchParams.queryLanguages - ) && - Objects.equals( - this.decompoundQuery, - indexSettingsAsSearchParams.decompoundQuery - ) && - Objects.equals( - this.enableRules, - indexSettingsAsSearchParams.enableRules - ) && - Objects.equals( - this.enablePersonalization, - indexSettingsAsSearchParams.enablePersonalization - ) && - Objects.equals(this.queryType, indexSettingsAsSearchParams.queryType) && - Objects.equals( - this.removeWordsIfNoResults, - indexSettingsAsSearchParams.removeWordsIfNoResults - ) && - Objects.equals( - this.advancedSyntax, - indexSettingsAsSearchParams.advancedSyntax - ) && - Objects.equals( - this.optionalWords, - indexSettingsAsSearchParams.optionalWords - ) && - Objects.equals( - this.disableExactOnAttributes, - indexSettingsAsSearchParams.disableExactOnAttributes - ) && - Objects.equals( - this.exactOnSingleWordQuery, - indexSettingsAsSearchParams.exactOnSingleWordQuery - ) && - Objects.equals( - this.alternativesAsExact, - indexSettingsAsSearchParams.alternativesAsExact - ) && - Objects.equals( - this.advancedSyntaxFeatures, - indexSettingsAsSearchParams.advancedSyntaxFeatures - ) && - Objects.equals(this.distinct, indexSettingsAsSearchParams.distinct) && - Objects.equals(this.synonyms, indexSettingsAsSearchParams.synonyms) && - Objects.equals( - this.replaceSynonymsInHighlight, - indexSettingsAsSearchParams.replaceSynonymsInHighlight - ) && - Objects.equals( - this.minProximity, - indexSettingsAsSearchParams.minProximity - ) && - Objects.equals( - this.responseFields, - indexSettingsAsSearchParams.responseFields - ) && - Objects.equals( - this.maxFacetHits, - indexSettingsAsSearchParams.maxFacetHits - ) && - Objects.equals( - this.attributeCriteriaComputedByMinProximity, - indexSettingsAsSearchParams.attributeCriteriaComputedByMinProximity - ) && - Objects.equals( - this.renderingContent, - indexSettingsAsSearchParams.renderingContent - ) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - searchableAttributes, - attributesForFaceting, - unretrievableAttributes, - attributesToRetrieve, - restrictSearchableAttributes, - ranking, - customRanking, - relevancyStrictness, - attributesToHighlight, - attributesToSnippet, - highlightPreTag, - highlightPostTag, - snippetEllipsisText, - restrictHighlightAndSnippetArrays, - hitsPerPage, - minWordSizefor1Typo, - minWordSizefor2Typos, - typoTolerance, - allowTyposOnNumericTokens, - disableTypoToleranceOnAttributes, - separatorsToIndex, - ignorePlurals, - removeStopWords, - keepDiacriticsOnCharacters, - queryLanguages, - decompoundQuery, - enableRules, - enablePersonalization, - queryType, - removeWordsIfNoResults, - advancedSyntax, - optionalWords, - disableExactOnAttributes, - exactOnSingleWordQuery, - alternativesAsExact, - advancedSyntaxFeatures, - distinct, - synonyms, - replaceSynonymsInHighlight, - minProximity, - responseFields, - maxFacetHits, - attributeCriteriaComputedByMinProximity, - renderingContent - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IndexSettingsAsSearchParams {\n"); - sb - .append(" searchableAttributes: ") - .append(toIndentedString(searchableAttributes)) - .append("\n"); - sb - .append(" attributesForFaceting: ") - .append(toIndentedString(attributesForFaceting)) - .append("\n"); - sb - .append(" unretrievableAttributes: ") - .append(toIndentedString(unretrievableAttributes)) - .append("\n"); - sb - .append(" attributesToRetrieve: ") - .append(toIndentedString(attributesToRetrieve)) - .append("\n"); - sb - .append(" restrictSearchableAttributes: ") - .append(toIndentedString(restrictSearchableAttributes)) - .append("\n"); - sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb - .append(" customRanking: ") - .append(toIndentedString(customRanking)) - .append("\n"); - sb - .append(" relevancyStrictness: ") - .append(toIndentedString(relevancyStrictness)) - .append("\n"); - sb - .append(" attributesToHighlight: ") - .append(toIndentedString(attributesToHighlight)) - .append("\n"); - sb - .append(" attributesToSnippet: ") - .append(toIndentedString(attributesToSnippet)) - .append("\n"); - sb - .append(" highlightPreTag: ") - .append(toIndentedString(highlightPreTag)) - .append("\n"); - sb - .append(" highlightPostTag: ") - .append(toIndentedString(highlightPostTag)) - .append("\n"); - sb - .append(" snippetEllipsisText: ") - .append(toIndentedString(snippetEllipsisText)) - .append("\n"); - sb - .append(" restrictHighlightAndSnippetArrays: ") - .append(toIndentedString(restrictHighlightAndSnippetArrays)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb - .append(" minWordSizefor1Typo: ") - .append(toIndentedString(minWordSizefor1Typo)) - .append("\n"); - sb - .append(" minWordSizefor2Typos: ") - .append(toIndentedString(minWordSizefor2Typos)) - .append("\n"); - sb - .append(" typoTolerance: ") - .append(toIndentedString(typoTolerance)) - .append("\n"); - sb - .append(" allowTyposOnNumericTokens: ") - .append(toIndentedString(allowTyposOnNumericTokens)) - .append("\n"); - sb - .append(" disableTypoToleranceOnAttributes: ") - .append(toIndentedString(disableTypoToleranceOnAttributes)) - .append("\n"); - sb - .append(" separatorsToIndex: ") - .append(toIndentedString(separatorsToIndex)) - .append("\n"); - sb - .append(" ignorePlurals: ") - .append(toIndentedString(ignorePlurals)) - .append("\n"); - sb - .append(" removeStopWords: ") - .append(toIndentedString(removeStopWords)) - .append("\n"); - sb - .append(" keepDiacriticsOnCharacters: ") - .append(toIndentedString(keepDiacriticsOnCharacters)) - .append("\n"); - sb - .append(" queryLanguages: ") - .append(toIndentedString(queryLanguages)) - .append("\n"); - sb - .append(" decompoundQuery: ") - .append(toIndentedString(decompoundQuery)) - .append("\n"); - sb - .append(" enableRules: ") - .append(toIndentedString(enableRules)) - .append("\n"); - sb - .append(" enablePersonalization: ") - .append(toIndentedString(enablePersonalization)) - .append("\n"); - sb - .append(" queryType: ") - .append(toIndentedString(queryType)) - .append("\n"); - sb - .append(" removeWordsIfNoResults: ") - .append(toIndentedString(removeWordsIfNoResults)) - .append("\n"); - sb - .append(" advancedSyntax: ") - .append(toIndentedString(advancedSyntax)) - .append("\n"); - sb - .append(" optionalWords: ") - .append(toIndentedString(optionalWords)) - .append("\n"); - sb - .append(" disableExactOnAttributes: ") - .append(toIndentedString(disableExactOnAttributes)) - .append("\n"); - sb - .append(" exactOnSingleWordQuery: ") - .append(toIndentedString(exactOnSingleWordQuery)) - .append("\n"); - sb - .append(" alternativesAsExact: ") - .append(toIndentedString(alternativesAsExact)) - .append("\n"); - sb - .append(" advancedSyntaxFeatures: ") - .append(toIndentedString(advancedSyntaxFeatures)) - .append("\n"); - sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb - .append(" replaceSynonymsInHighlight: ") - .append(toIndentedString(replaceSynonymsInHighlight)) - .append("\n"); - sb - .append(" minProximity: ") - .append(toIndentedString(minProximity)) - .append("\n"); - sb - .append(" responseFields: ") - .append(toIndentedString(responseFields)) - .append("\n"); - sb - .append(" maxFacetHits: ") - .append(toIndentedString(maxFacetHits)) - .append("\n"); - sb - .append(" attributeCriteriaComputedByMinProximity: ") - .append(toIndentedString(attributeCriteriaComputedByMinProximity)) - .append("\n"); - sb - .append(" renderingContent: ") - .append(toIndentedString(renderingContent)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Indice.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Indice.java deleted file mode 100644 index ed64c6978e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Indice.java +++ /dev/null @@ -1,347 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Indice */ -public class Indice { - - @SerializedName("name") - private String name; - - @SerializedName("createdAt") - private String createdAt; - - @SerializedName("updatedAt") - private String updatedAt; - - @SerializedName("entries") - private Integer entries; - - @SerializedName("dataSize") - private Integer dataSize; - - @SerializedName("fileSize") - private Integer fileSize; - - @SerializedName("lastBuildTimeS") - private Integer lastBuildTimeS; - - @SerializedName("numberOfPendingTask") - private Integer numberOfPendingTask; - - @SerializedName("pendingTask") - private Boolean pendingTask; - - @SerializedName("primary") - private String primary; - - @SerializedName("replicas") - private List replicas = null; - - public Indice name(String name) { - this.name = name; - return this; - } - - /** - * Index name. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Indice createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Index creation date. An empty string means that the index has no records. - * - * @return createdAt - */ - @javax.annotation.Nonnull - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - public Indice updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - public Indice entries(Integer entries) { - this.entries = entries; - return this; - } - - /** - * Number of records contained in the index. - * - * @return entries - */ - @javax.annotation.Nonnull - public Integer getEntries() { - return entries; - } - - public void setEntries(Integer entries) { - this.entries = entries; - } - - public Indice dataSize(Integer dataSize) { - this.dataSize = dataSize; - return this; - } - - /** - * Number of bytes of the index in minified format. - * - * @return dataSize - */ - @javax.annotation.Nonnull - public Integer getDataSize() { - return dataSize; - } - - public void setDataSize(Integer dataSize) { - this.dataSize = dataSize; - } - - public Indice fileSize(Integer fileSize) { - this.fileSize = fileSize; - return this; - } - - /** - * Number of bytes of the index binary file. - * - * @return fileSize - */ - @javax.annotation.Nonnull - public Integer getFileSize() { - return fileSize; - } - - public void setFileSize(Integer fileSize) { - this.fileSize = fileSize; - } - - public Indice lastBuildTimeS(Integer lastBuildTimeS) { - this.lastBuildTimeS = lastBuildTimeS; - return this; - } - - /** - * Last build time - * - * @return lastBuildTimeS - */ - @javax.annotation.Nonnull - public Integer getLastBuildTimeS() { - return lastBuildTimeS; - } - - public void setLastBuildTimeS(Integer lastBuildTimeS) { - this.lastBuildTimeS = lastBuildTimeS; - } - - public Indice numberOfPendingTask(Integer numberOfPendingTask) { - this.numberOfPendingTask = numberOfPendingTask; - return this; - } - - /** - * Number of pending indexing operations. This value is deprecated and should not be used. - * - * @return numberOfPendingTask - */ - @javax.annotation.Nullable - public Integer getNumberOfPendingTask() { - return numberOfPendingTask; - } - - public void setNumberOfPendingTask(Integer numberOfPendingTask) { - this.numberOfPendingTask = numberOfPendingTask; - } - - public Indice pendingTask(Boolean pendingTask) { - this.pendingTask = pendingTask; - return this; - } - - /** - * A boolean which says whether the index has pending tasks. This value is deprecated and should - * not be used. - * - * @return pendingTask - */ - @javax.annotation.Nonnull - public Boolean getPendingTask() { - return pendingTask; - } - - public void setPendingTask(Boolean pendingTask) { - this.pendingTask = pendingTask; - } - - public Indice primary(String primary) { - this.primary = primary; - return this; - } - - /** - * Only present if the index is a replica. Contains the name of the related primary index. - * - * @return primary - */ - @javax.annotation.Nullable - public String getPrimary() { - return primary; - } - - public void setPrimary(String primary) { - this.primary = primary; - } - - public Indice replicas(List replicas) { - this.replicas = replicas; - return this; - } - - public Indice addReplicasItem(String replicasItem) { - if (this.replicas == null) { - this.replicas = new ArrayList<>(); - } - this.replicas.add(replicasItem); - return this; - } - - /** - * Only present if the index is a primary index with replicas. Contains the names of all linked - * replicas. - * - * @return replicas - */ - @javax.annotation.Nullable - public List getReplicas() { - return replicas; - } - - public void setReplicas(List replicas) { - this.replicas = replicas; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Indice indice = (Indice) o; - return ( - Objects.equals(this.name, indice.name) && - Objects.equals(this.createdAt, indice.createdAt) && - Objects.equals(this.updatedAt, indice.updatedAt) && - Objects.equals(this.entries, indice.entries) && - Objects.equals(this.dataSize, indice.dataSize) && - Objects.equals(this.fileSize, indice.fileSize) && - Objects.equals(this.lastBuildTimeS, indice.lastBuildTimeS) && - Objects.equals(this.numberOfPendingTask, indice.numberOfPendingTask) && - Objects.equals(this.pendingTask, indice.pendingTask) && - Objects.equals(this.primary, indice.primary) && - Objects.equals(this.replicas, indice.replicas) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - createdAt, - updatedAt, - entries, - dataSize, - fileSize, - lastBuildTimeS, - numberOfPendingTask, - pendingTask, - primary, - replicas - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Indice {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb - .append(" createdAt: ") - .append(toIndentedString(createdAt)) - .append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); - sb.append(" dataSize: ").append(toIndentedString(dataSize)).append("\n"); - sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); - sb - .append(" lastBuildTimeS: ") - .append(toIndentedString(lastBuildTimeS)) - .append("\n"); - sb - .append(" numberOfPendingTask: ") - .append(toIndentedString(numberOfPendingTask)) - .append("\n"); - sb - .append(" pendingTask: ") - .append(toIndentedString(pendingTask)) - .append("\n"); - sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); - sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Key.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Key.java deleted file mode 100644 index 5b61171f8c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Key.java +++ /dev/null @@ -1,388 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Key */ -public class Key { - - /** Gets or Sets acl */ - @JsonAdapter(AclEnum.Adapter.class) - public enum AclEnum { - ADDOBJECT("addObject"), - - ANALYTICS("analytics"), - - BROWSE("browse"), - - DELETEOBJECT("deleteObject"), - - DELETEINDEX("deleteIndex"), - - EDITSETTINGS("editSettings"), - - LISTINDEXES("listIndexes"), - - LOGS("logs"), - - PERSONALIZATION("personalization"), - - RECOMMENDATION("recommendation"), - - SEARCH("search"), - - SEEUNRETRIEVABLEATTRIBUTES("seeUnretrievableAttributes"), - - SETTINGS("settings"), - - USAGE("usage"); - - private String value; - - AclEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AclEnum fromValue(String value) { - for (AclEnum b : AclEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write(final JsonWriter jsonWriter, final AclEnum enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AclEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return AclEnum.fromValue(value); - } - } - } - - @SerializedName("acl") - private List acl = new ArrayList<>(); - - @SerializedName("description") - private String description = ""; - - @SerializedName("indexes") - private List indexes = null; - - @SerializedName("maxHitsPerQuery") - private Integer maxHitsPerQuery = 0; - - @SerializedName("maxQueriesPerIPPerHour") - private Integer maxQueriesPerIPPerHour = 0; - - @SerializedName("queryParameters") - private String queryParameters = ""; - - @SerializedName("referers") - private List referers = null; - - @SerializedName("validity") - private Integer validity = 0; - - @SerializedName("createdAt") - private String createdAt; - - public Key acl(List acl) { - this.acl = acl; - return this; - } - - public Key addAclItem(AclEnum aclItem) { - this.acl.add(aclItem); - return this; - } - - /** - * Set of permissions associated with the key. - * - * @return acl - */ - @javax.annotation.Nonnull - public List getAcl() { - return acl; - } - - public void setAcl(List acl) { - this.acl = acl; - } - - public Key description(String description) { - this.description = description; - return this; - } - - /** - * A comment used to identify a key more easily in the dashboard. It is not interpreted by the - * API. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Key indexes(List indexes) { - this.indexes = indexes; - return this; - } - - public Key addIndexesItem(String indexesItem) { - if (this.indexes == null) { - this.indexes = new ArrayList<>(); - } - this.indexes.add(indexesItem); - return this; - } - - /** - * Restrict this new API key to a list of indices or index patterns. If the list is empty, all - * indices are allowed. - * - * @return indexes - */ - @javax.annotation.Nullable - public List getIndexes() { - return indexes; - } - - public void setIndexes(List indexes) { - this.indexes = indexes; - } - - public Key maxHitsPerQuery(Integer maxHitsPerQuery) { - this.maxHitsPerQuery = maxHitsPerQuery; - return this; - } - - /** - * Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. - * - * @return maxHitsPerQuery - */ - @javax.annotation.Nullable - public Integer getMaxHitsPerQuery() { - return maxHitsPerQuery; - } - - public void setMaxHitsPerQuery(Integer maxHitsPerQuery) { - this.maxHitsPerQuery = maxHitsPerQuery; - } - - public Key maxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) { - this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour; - return this; - } - - /** - * Maximum number of API calls per hour allowed from a given IP address or a user token. - * - * @return maxQueriesPerIPPerHour - */ - @javax.annotation.Nullable - public Integer getMaxQueriesPerIPPerHour() { - return maxQueriesPerIPPerHour; - } - - public void setMaxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) { - this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour; - } - - public Key queryParameters(String queryParameters) { - this.queryParameters = queryParameters; - return this; - } - - /** - * URL-encoded query string. Force some query parameters to be applied for each query made with - * this API key. - * - * @return queryParameters - */ - @javax.annotation.Nullable - public String getQueryParameters() { - return queryParameters; - } - - public void setQueryParameters(String queryParameters) { - this.queryParameters = queryParameters; - } - - public Key referers(List referers) { - this.referers = referers; - return this; - } - - public Key addReferersItem(String referersItem) { - if (this.referers == null) { - this.referers = new ArrayList<>(); - } - this.referers.add(referersItem); - return this; - } - - /** - * Restrict this new API key to specific referers. If empty or blank, defaults to all referers. - * - * @return referers - */ - @javax.annotation.Nullable - public List getReferers() { - return referers; - } - - public void setReferers(List referers) { - this.referers = referers; - } - - public Key validity(Integer validity) { - this.validity = validity; - return this; - } - - /** - * Validity limit for this key in seconds. The key will automatically be removed after this period - * of time. - * - * @return validity - */ - @javax.annotation.Nullable - public Integer getValidity() { - return validity; - } - - public void setValidity(Integer validity) { - this.validity = validity; - } - - public Key createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Date of creation (ISO-8601 format). - * - * @return createdAt - */ - @javax.annotation.Nonnull - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Key key = (Key) o; - return ( - Objects.equals(this.acl, key.acl) && - Objects.equals(this.description, key.description) && - Objects.equals(this.indexes, key.indexes) && - Objects.equals(this.maxHitsPerQuery, key.maxHitsPerQuery) && - Objects.equals(this.maxQueriesPerIPPerHour, key.maxQueriesPerIPPerHour) && - Objects.equals(this.queryParameters, key.queryParameters) && - Objects.equals(this.referers, key.referers) && - Objects.equals(this.validity, key.validity) && - Objects.equals(this.createdAt, key.createdAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - acl, - description, - indexes, - maxHitsPerQuery, - maxQueriesPerIPPerHour, - queryParameters, - referers, - validity, - createdAt - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Key {\n"); - sb.append(" acl: ").append(toIndentedString(acl)).append("\n"); - sb - .append(" description: ") - .append(toIndentedString(description)) - .append("\n"); - sb.append(" indexes: ").append(toIndentedString(indexes)).append("\n"); - sb - .append(" maxHitsPerQuery: ") - .append(toIndentedString(maxHitsPerQuery)) - .append("\n"); - sb - .append(" maxQueriesPerIPPerHour: ") - .append(toIndentedString(maxQueriesPerIPPerHour)) - .append("\n"); - sb - .append(" queryParameters: ") - .append(toIndentedString(queryParameters)) - .append("\n"); - sb.append(" referers: ").append(toIndentedString(referers)).append("\n"); - sb.append(" validity: ").append(toIndentedString(validity)).append("\n"); - sb - .append(" createdAt: ") - .append(toIndentedString(createdAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Languages.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Languages.java deleted file mode 100644 index 584101dfbf..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Languages.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** A dictionary language. */ -public class Languages { - - @SerializedName("plurals") - private DictionaryLanguage plurals; - - @SerializedName("stopwords") - private DictionaryLanguage stopwords; - - @SerializedName("compounds") - private DictionaryLanguage compounds; - - public Languages plurals(DictionaryLanguage plurals) { - this.plurals = plurals; - return this; - } - - /** - * Get plurals - * - * @return plurals - */ - @javax.annotation.Nullable - public DictionaryLanguage getPlurals() { - return plurals; - } - - public void setPlurals(DictionaryLanguage plurals) { - this.plurals = plurals; - } - - public Languages stopwords(DictionaryLanguage stopwords) { - this.stopwords = stopwords; - return this; - } - - /** - * Get stopwords - * - * @return stopwords - */ - @javax.annotation.Nullable - public DictionaryLanguage getStopwords() { - return stopwords; - } - - public void setStopwords(DictionaryLanguage stopwords) { - this.stopwords = stopwords; - } - - public Languages compounds(DictionaryLanguage compounds) { - this.compounds = compounds; - return this; - } - - /** - * Get compounds - * - * @return compounds - */ - @javax.annotation.Nullable - public DictionaryLanguage getCompounds() { - return compounds; - } - - public void setCompounds(DictionaryLanguage compounds) { - this.compounds = compounds; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Languages languages = (Languages) o; - return ( - Objects.equals(this.plurals, languages.plurals) && - Objects.equals(this.stopwords, languages.stopwords) && - Objects.equals(this.compounds, languages.compounds) - ); - } - - @Override - public int hashCode() { - return Objects.hash(plurals, stopwords, compounds); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Languages {\n"); - sb.append(" plurals: ").append(toIndentedString(plurals)).append("\n"); - sb - .append(" stopwords: ") - .append(toIndentedString(stopwords)) - .append("\n"); - sb - .append(" compounds: ") - .append(toIndentedString(compounds)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListApiKeysResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListApiKeysResponse.java deleted file mode 100644 index f85539f5e1..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListApiKeysResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ListApiKeysResponse */ -public class ListApiKeysResponse { - - @SerializedName("keys") - private List keys = new ArrayList<>(); - - public ListApiKeysResponse keys(List keys) { - this.keys = keys; - return this; - } - - public ListApiKeysResponse addKeysItem(Key keysItem) { - this.keys.add(keysItem); - return this; - } - - /** - * List of api keys. - * - * @return keys - */ - @javax.annotation.Nonnull - public List getKeys() { - return keys; - } - - public void setKeys(List keys) { - this.keys = keys; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ListApiKeysResponse listApiKeysResponse = (ListApiKeysResponse) o; - return Objects.equals(this.keys, listApiKeysResponse.keys); - } - - @Override - public int hashCode() { - return Objects.hash(keys); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ListApiKeysResponse {\n"); - sb.append(" keys: ").append(toIndentedString(keys)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListClustersResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListClustersResponse.java deleted file mode 100644 index f9a9bdc597..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListClustersResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Array of clusters. */ -public class ListClustersResponse { - - @SerializedName("topUsers") - private List topUsers = new ArrayList<>(); - - public ListClustersResponse topUsers(List topUsers) { - this.topUsers = topUsers; - return this; - } - - public ListClustersResponse addTopUsersItem(String topUsersItem) { - this.topUsers.add(topUsersItem); - return this; - } - - /** - * Mapping of cluster names to top users. - * - * @return topUsers - */ - @javax.annotation.Nonnull - public List getTopUsers() { - return topUsers; - } - - public void setTopUsers(List topUsers) { - this.topUsers = topUsers; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ListClustersResponse listClustersResponse = (ListClustersResponse) o; - return Objects.equals(this.topUsers, listClustersResponse.topUsers); - } - - @Override - public int hashCode() { - return Objects.hash(topUsers); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ListClustersResponse {\n"); - sb.append(" topUsers: ").append(toIndentedString(topUsers)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java deleted file mode 100644 index 0f4edc5901..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ListIndicesResponse */ -public class ListIndicesResponse { - - @SerializedName("items") - private List items = null; - - @SerializedName("nbPages") - private Integer nbPages; - - public ListIndicesResponse items(List items) { - this.items = items; - return this; - } - - public ListIndicesResponse addItemsItem(Indice itemsItem) { - if (this.items == null) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * List of the fetched indices. - * - * @return items - */ - @javax.annotation.Nullable - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public ListIndicesResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** - * Number of pages. - * - * @return nbPages - */ - @javax.annotation.Nullable - public Integer getNbPages() { - return nbPages; - } - - public void setNbPages(Integer nbPages) { - this.nbPages = nbPages; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ListIndicesResponse listIndicesResponse = (ListIndicesResponse) o; - return ( - Objects.equals(this.items, listIndicesResponse.items) && - Objects.equals(this.nbPages, listIndicesResponse.nbPages) - ); - } - - @Override - public int hashCode() { - return Objects.hash(items, nbPages); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ListIndicesResponse {\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListUserIdsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListUserIdsResponse.java deleted file mode 100644 index 8da966a1fe..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListUserIdsResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** UserIDs data. */ -public class ListUserIdsResponse { - - @SerializedName("userIDs") - private List userIDs = new ArrayList<>(); - - public ListUserIdsResponse userIDs(List userIDs) { - this.userIDs = userIDs; - return this; - } - - public ListUserIdsResponse addUserIDsItem(UserId userIDsItem) { - this.userIDs.add(userIDsItem); - return this; - } - - /** - * List of userIDs. - * - * @return userIDs - */ - @javax.annotation.Nonnull - public List getUserIDs() { - return userIDs; - } - - public void setUserIDs(List userIDs) { - this.userIDs = userIDs; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ListUserIdsResponse listUserIdsResponse = (ListUserIdsResponse) o; - return Objects.equals(this.userIDs, listUserIdsResponse.userIDs); - } - - @Override - public int hashCode() { - return Objects.hash(userIDs); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ListUserIdsResponse {\n"); - sb.append(" userIDs: ").append(toIndentedString(userIDs)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleBatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleBatchResponse.java deleted file mode 100644 index ce068efd40..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleBatchResponse.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** MultipleBatchResponse */ -public class MultipleBatchResponse { - - @SerializedName("taskID") - private Object taskID; - - @SerializedName("objectIDs") - private List objectIDs = null; - - public MultipleBatchResponse taskID(Object taskID) { - this.taskID = taskID; - return this; - } - - /** - * List of tasksIDs per index. - * - * @return taskID - */ - @javax.annotation.Nullable - public Object getTaskID() { - return taskID; - } - - public void setTaskID(Object taskID) { - this.taskID = taskID; - } - - public MultipleBatchResponse objectIDs(List objectIDs) { - this.objectIDs = objectIDs; - return this; - } - - public MultipleBatchResponse addObjectIDsItem(String objectIDsItem) { - if (this.objectIDs == null) { - this.objectIDs = new ArrayList<>(); - } - this.objectIDs.add(objectIDsItem); - return this; - } - - /** - * List of objectID. - * - * @return objectIDs - */ - @javax.annotation.Nullable - public List getObjectIDs() { - return objectIDs; - } - - public void setObjectIDs(List objectIDs) { - this.objectIDs = objectIDs; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleBatchResponse multipleBatchResponse = (MultipleBatchResponse) o; - return ( - Objects.equals(this.taskID, multipleBatchResponse.taskID) && - Objects.equals(this.objectIDs, multipleBatchResponse.objectIDs) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, objectIDs); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleBatchResponse {\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb - .append(" objectIDs: ") - .append(toIndentedString(objectIDs)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleGetObjectsParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleGetObjectsParams.java deleted file mode 100644 index 329bb9f116..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleGetObjectsParams.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** getObjects operation on an index. */ -public class MultipleGetObjectsParams { - - @SerializedName("attributesToRetrieve") - private List attributesToRetrieve = null; - - @SerializedName("objectID") - private String objectID; - - @SerializedName("indexName") - private String indexName; - - public MultipleGetObjectsParams attributesToRetrieve( - List attributesToRetrieve - ) { - this.attributesToRetrieve = attributesToRetrieve; - return this; - } - - public MultipleGetObjectsParams addAttributesToRetrieveItem( - String attributesToRetrieveItem - ) { - if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList<>(); - } - this.attributesToRetrieve.add(attributesToRetrieveItem); - return this; - } - - /** - * List of attributes to retrieve. By default, all retrievable attributes are returned. - * - * @return attributesToRetrieve - */ - @javax.annotation.Nullable - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public void setAttributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - } - - public MultipleGetObjectsParams objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * ID of the object within that index. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public MultipleGetObjectsParams indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - * name of the index containing the object. - * - * @return indexName - */ - @javax.annotation.Nonnull - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleGetObjectsParams multipleGetObjectsParams = (MultipleGetObjectsParams) o; - return ( - Objects.equals( - this.attributesToRetrieve, - multipleGetObjectsParams.attributesToRetrieve - ) && - Objects.equals(this.objectID, multipleGetObjectsParams.objectID) && - Objects.equals(this.indexName, multipleGetObjectsParams.indexName) - ); - } - - @Override - public int hashCode() { - return Objects.hash(attributesToRetrieve, objectID, indexName); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleGetObjectsParams {\n"); - sb - .append(" attributesToRetrieve: ") - .append(toIndentedString(attributesToRetrieve)) - .append("\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb - .append(" indexName: ") - .append(toIndentedString(indexName)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java deleted file mode 100644 index a0c2fe6b9c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** MultipleQueries */ -public class MultipleQueries { - - @SerializedName("indexName") - private String indexName; - - @SerializedName("query") - private String query = ""; - - @SerializedName("type") - private MultipleQueriesType type = MultipleQueriesType.DEFAULT; - - @SerializedName("facet") - private String facet; - - @SerializedName("params") - private String params; - - public MultipleQueries indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - * The Algolia index name. - * - * @return indexName - */ - @javax.annotation.Nonnull - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - public MultipleQueries query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nullable - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public MultipleQueries type(MultipleQueriesType type) { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type - */ - @javax.annotation.Nullable - public MultipleQueriesType getType() { - return type; - } - - public void setType(MultipleQueriesType type) { - this.type = type; - } - - public MultipleQueries facet(String facet) { - this.facet = facet; - return this; - } - - /** - * The `facet` name. - * - * @return facet - */ - @javax.annotation.Nullable - public String getFacet() { - return facet; - } - - public void setFacet(String facet) { - this.facet = facet; - } - - public MultipleQueries params(String params) { - this.params = params; - return this; - } - - /** - * A query string of search parameters. - * - * @return params - */ - @javax.annotation.Nullable - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleQueries multipleQueries = (MultipleQueries) o; - return ( - Objects.equals(this.indexName, multipleQueries.indexName) && - Objects.equals(this.query, multipleQueries.query) && - Objects.equals(this.type, multipleQueries.type) && - Objects.equals(this.facet, multipleQueries.facet) && - Objects.equals(this.params, multipleQueries.params) - ); - } - - @Override - public int hashCode() { - return Objects.hash(indexName, query, type, facet, params); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleQueries {\n"); - sb - .append(" indexName: ") - .append(toIndentedString(indexName)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesParams.java deleted file mode 100644 index 952256492d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesParams.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** MultipleQueriesParams */ -public class MultipleQueriesParams { - - @SerializedName("requests") - private List requests = new ArrayList<>(); - - @SerializedName("strategy") - private MultipleQueriesStrategy strategy; - - public MultipleQueriesParams requests(List requests) { - this.requests = requests; - return this; - } - - public MultipleQueriesParams addRequestsItem(MultipleQueries requestsItem) { - this.requests.add(requestsItem); - return this; - } - - /** - * Get requests - * - * @return requests - */ - @javax.annotation.Nonnull - public List getRequests() { - return requests; - } - - public void setRequests(List requests) { - this.requests = requests; - } - - public MultipleQueriesParams strategy(MultipleQueriesStrategy strategy) { - this.strategy = strategy; - return this; - } - - /** - * Get strategy - * - * @return strategy - */ - @javax.annotation.Nullable - public MultipleQueriesStrategy getStrategy() { - return strategy; - } - - public void setStrategy(MultipleQueriesStrategy strategy) { - this.strategy = strategy; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleQueriesParams multipleQueriesParams = (MultipleQueriesParams) o; - return ( - Objects.equals(this.requests, multipleQueriesParams.requests) && - Objects.equals(this.strategy, multipleQueriesParams.strategy) - ); - } - - @Override - public int hashCode() { - return Objects.hash(requests, strategy); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleQueriesParams {\n"); - sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); - sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java deleted file mode 100644 index 7b10d4ac69..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** MultipleQueriesResponse */ -public class MultipleQueriesResponse { - - @SerializedName("results") - private List results = null; - - public MultipleQueriesResponse results(List results) { - this.results = results; - return this; - } - - public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { - if (this.results == null) { - this.results = new ArrayList<>(); - } - this.results.add(resultsItem); - return this; - } - - /** - * Get results - * - * @return results - */ - @javax.annotation.Nullable - public List getResults() { - return results; - } - - public void setResults(List results) { - this.results = results; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleQueriesResponse multipleQueriesResponse = (MultipleQueriesResponse) o; - return Objects.equals(this.results, multipleQueriesResponse.results); - } - - @Override - public int hashCode() { - return Objects.hash(results); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleQueriesResponse {\n"); - sb.append(" results: ").append(toIndentedString(results)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesStrategy.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesStrategy.java deleted file mode 100644 index 0fda9238b4..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesStrategy.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Gets or Sets multipleQueriesStrategy */ -@JsonAdapter(MultipleQueriesStrategy.Adapter.class) -public enum MultipleQueriesStrategy { - NONE("none"), - - STOPIFENOUGHMATCHES("stopIfEnoughMatches"); - - private String value; - - MultipleQueriesStrategy(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MultipleQueriesStrategy fromValue(String value) { - for (MultipleQueriesStrategy b : MultipleQueriesStrategy.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MultipleQueriesStrategy enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MultipleQueriesStrategy read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MultipleQueriesStrategy.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesType.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesType.java deleted file mode 100644 index 266c455b7c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesType.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Perform a search query with `default`, will search for facet values if `facet` is given. */ -@JsonAdapter(MultipleQueriesType.Adapter.class) -public enum MultipleQueriesType { - DEFAULT("default"), - - FACET("facet"); - - private String value; - - MultipleQueriesType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MultipleQueriesType fromValue(String value) { - for (MultipleQueriesType b : MultipleQueriesType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MultipleQueriesType enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MultipleQueriesType read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MultipleQueriesType.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java deleted file mode 100644 index 00156b3140..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java +++ /dev/null @@ -1,3 +0,0 @@ -package com.algolia.model; - -public class OneOfintegerstring {} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java deleted file mode 100644 index 8ac01fc739..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; - -public class OneOfstringbuiltInOperation { - - @SerializedName("_operation") - private String _operation; - - @SerializedName("value") - private String value; - - public void set_operation(String op) { - _operation = op; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java deleted file mode 100644 index 1b7ee98d67..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** Operation */ -public class Operation { - - @SerializedName("action") - private Action action; - - @SerializedName("body") - private Object body; - - @SerializedName("indexName") - private String indexName; - - public Operation action(Action action) { - this.action = action; - return this; - } - - /** - * Get action - * - * @return action - */ - @javax.annotation.Nullable - public Action getAction() { - return action; - } - - public void setAction(Action action) { - this.action = action; - } - - public Operation body(Object body) { - this.body = body; - return this; - } - - /** - * arguments to the operation (depends on the type of the operation). - * - * @return body - */ - @javax.annotation.Nullable - public Object getBody() { - return body; - } - - public void setBody(Object body) { - this.body = body; - } - - public Operation indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - * Index to target for this operation. - * - * @return indexName - */ - @javax.annotation.Nullable - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Operation operation = (Operation) o; - return ( - Objects.equals(this.action, operation.action) && - Objects.equals(this.body, operation.body) && - Objects.equals(this.indexName, operation.indexName) - ); - } - - @Override - public int hashCode() { - return Objects.hash(action, body, indexName); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Operation {\n"); - sb.append(" action: ").append(toIndentedString(action)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb - .append(" indexName: ") - .append(toIndentedString(indexName)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexParams.java deleted file mode 100644 index a048fc5fc3..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexParams.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** OperationIndexParams */ -public class OperationIndexParams { - - @SerializedName("operation") - private OperationType operation; - - @SerializedName("destination") - private String destination; - - @SerializedName("scope") - private List scope = null; - - public OperationIndexParams operation(OperationType operation) { - this.operation = operation; - return this; - } - - /** - * Get operation - * - * @return operation - */ - @javax.annotation.Nonnull - public OperationType getOperation() { - return operation; - } - - public void setOperation(OperationType operation) { - this.operation = operation; - } - - public OperationIndexParams destination(String destination) { - this.destination = destination; - return this; - } - - /** - * The Algolia index name. - * - * @return destination - */ - @javax.annotation.Nonnull - public String getDestination() { - return destination; - } - - public void setDestination(String destination) { - this.destination = destination; - } - - public OperationIndexParams scope(List scope) { - this.scope = scope; - return this; - } - - public OperationIndexParams addScopeItem(ScopeType scopeItem) { - if (this.scope == null) { - this.scope = new ArrayList<>(); - } - this.scope.add(scopeItem); - return this; - } - - /** - * Scope of the data to copy. When absent, a full copy is performed. When present, only the - * selected scopes are copied. - * - * @return scope - */ - @javax.annotation.Nullable - public List getScope() { - return scope; - } - - public void setScope(List scope) { - this.scope = scope; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OperationIndexParams operationIndexParams = (OperationIndexParams) o; - return ( - Objects.equals(this.operation, operationIndexParams.operation) && - Objects.equals(this.destination, operationIndexParams.destination) && - Objects.equals(this.scope, operationIndexParams.scope) - ); - } - - @Override - public int hashCode() { - return Objects.hash(operation, destination, scope); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OperationIndexParams {\n"); - sb - .append(" operation: ") - .append(toIndentedString(operation)) - .append("\n"); - sb - .append(" destination: ") - .append(toIndentedString(destination)) - .append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationType.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationType.java deleted file mode 100644 index 05336d71f5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationType.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Type of operation to perform (move or copy). */ -@JsonAdapter(OperationType.Adapter.class) -public enum OperationType { - MOVE("move"), - - COPY("copy"); - - private String value; - - OperationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static OperationType fromValue(String value) { - for (OperationType b : OperationType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final OperationType enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public OperationType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return OperationType.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Params.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Params.java deleted file mode 100644 index 9ff52121fe..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Params.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Additional search parameters. Any valid search parameter is allowed. */ -public class Params { - - @SerializedName("query") - private String query; - - @SerializedName("automaticFacetFilters") - private List automaticFacetFilters = null; - - @SerializedName("automaticOptionalFacetFilters") - private List automaticOptionalFacetFilters = null; - - public Params query(String query) { - this.query = query; - return this; - } - - /** - * Query string. - * - * @return query - */ - @javax.annotation.Nullable - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public Params automaticFacetFilters( - List automaticFacetFilters - ) { - this.automaticFacetFilters = automaticFacetFilters; - return this; - } - - public Params addAutomaticFacetFiltersItem( - AutomaticFacetFilter automaticFacetFiltersItem - ) { - if (this.automaticFacetFilters == null) { - this.automaticFacetFilters = new ArrayList<>(); - } - this.automaticFacetFilters.add(automaticFacetFiltersItem); - return this; - } - - /** - * Names of facets to which automatic filtering must be applied; they must match the facet name of - * a facet value placeholder in the query pattern. - * - * @return automaticFacetFilters - */ - @javax.annotation.Nullable - public List getAutomaticFacetFilters() { - return automaticFacetFilters; - } - - public void setAutomaticFacetFilters( - List automaticFacetFilters - ) { - this.automaticFacetFilters = automaticFacetFilters; - } - - public Params automaticOptionalFacetFilters( - List automaticOptionalFacetFilters - ) { - this.automaticOptionalFacetFilters = automaticOptionalFacetFilters; - return this; - } - - public Params addAutomaticOptionalFacetFiltersItem( - AutomaticFacetFilter automaticOptionalFacetFiltersItem - ) { - if (this.automaticOptionalFacetFilters == null) { - this.automaticOptionalFacetFilters = new ArrayList<>(); - } - this.automaticOptionalFacetFilters.add(automaticOptionalFacetFiltersItem); - return this; - } - - /** - * Same syntax as automaticFacetFilters, but the engine treats the filters as optional. - * - * @return automaticOptionalFacetFilters - */ - @javax.annotation.Nullable - public List getAutomaticOptionalFacetFilters() { - return automaticOptionalFacetFilters; - } - - public void setAutomaticOptionalFacetFilters( - List automaticOptionalFacetFilters - ) { - this.automaticOptionalFacetFilters = automaticOptionalFacetFilters; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Params params = (Params) o; - return ( - Objects.equals(this.query, params.query) && - Objects.equals( - this.automaticFacetFilters, - params.automaticFacetFilters - ) && - Objects.equals( - this.automaticOptionalFacetFilters, - params.automaticOptionalFacetFilters - ) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - query, - automaticFacetFilters, - automaticOptionalFacetFilters - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Params {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" automaticFacetFilters: ") - .append(toIndentedString(automaticFacetFilters)) - .append("\n"); - sb - .append(" automaticOptionalFacetFilters: ") - .append(toIndentedString(automaticOptionalFacetFilters)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Promote.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Promote.java deleted file mode 100644 index 2ce9a59139..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Promote.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Object to promote as hits. */ -public class Promote { - - @SerializedName("objectID") - private String objectID; - - @SerializedName("objectIDs") - private List objectIDs = null; - - @SerializedName("position") - private Integer position; - - public Promote objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object to promote. - * - * @return objectID - */ - @javax.annotation.Nullable - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public Promote objectIDs(List objectIDs) { - this.objectIDs = objectIDs; - return this; - } - - public Promote addObjectIDsItem(String objectIDsItem) { - if (this.objectIDs == null) { - this.objectIDs = new ArrayList<>(); - } - this.objectIDs.add(objectIDsItem); - return this; - } - - /** - * Array of unique identifiers of the objects to promote. - * - * @return objectIDs - */ - @javax.annotation.Nullable - public List getObjectIDs() { - return objectIDs; - } - - public void setObjectIDs(List objectIDs) { - this.objectIDs = objectIDs; - } - - public Promote position(Integer position) { - this.position = position; - return this; - } - - /** - * The position to promote the objects to (zero-based). If you pass objectIDs, the objects are - * placed at this position as a group. For example, if you pass four objectIDs to position 0, the - * objects take the first four positions. - * - * @return position - */ - @javax.annotation.Nonnull - public Integer getPosition() { - return position; - } - - public void setPosition(Integer position) { - this.position = position; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Promote promote = (Promote) o; - return ( - Objects.equals(this.objectID, promote.objectID) && - Objects.equals(this.objectIDs, promote.objectIDs) && - Objects.equals(this.position, promote.position) - ); - } - - @Override - public int hashCode() { - return Objects.hash(objectID, objectIDs, position); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Promote {\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb - .append(" objectIDs: ") - .append(toIndentedString(objectIDs)) - .append("\n"); - sb.append(" position: ").append(toIndentedString(position)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java deleted file mode 100644 index c6c236cdf3..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ /dev/null @@ -1,360 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** RankingInfo */ -public class RankingInfo { - - @SerializedName("filters") - private Integer filters; - - @SerializedName("firstMatchedWord") - private Integer firstMatchedWord; - - @SerializedName("geoDistance") - private Integer geoDistance; - - @SerializedName("geoPrecision") - private Integer geoPrecision; - - @SerializedName("matchedGeoLocation") - private Map matchedGeoLocation = null; - - @SerializedName("nbExactWords") - private Integer nbExactWords; - - @SerializedName("nbTypos") - private Integer nbTypos; - - @SerializedName("promoted") - private Boolean promoted; - - @SerializedName("proximityDistance") - private Integer proximityDistance; - - @SerializedName("userScore") - private Integer userScore; - - @SerializedName("word") - private Integer word; - - public RankingInfo filters(Integer filters) { - this.filters = filters; - return this; - } - - /** - * This field is reserved for advanced usage. - * - * @return filters - */ - @javax.annotation.Nullable - public Integer getFilters() { - return filters; - } - - public void setFilters(Integer filters) { - this.filters = filters; - } - - public RankingInfo firstMatchedWord(Integer firstMatchedWord) { - this.firstMatchedWord = firstMatchedWord; - return this; - } - - /** - * Position of the most important matched attribute in the attributes to index list. - * - * @return firstMatchedWord - */ - @javax.annotation.Nullable - public Integer getFirstMatchedWord() { - return firstMatchedWord; - } - - public void setFirstMatchedWord(Integer firstMatchedWord) { - this.firstMatchedWord = firstMatchedWord; - } - - public RankingInfo geoDistance(Integer geoDistance) { - this.geoDistance = geoDistance; - return this; - } - - /** - * Distance between the geo location in the search query and the best matching geo location in the - * record, divided by the geo precision (in meters). - * - * @return geoDistance - */ - @javax.annotation.Nullable - public Integer getGeoDistance() { - return geoDistance; - } - - public void setGeoDistance(Integer geoDistance) { - this.geoDistance = geoDistance; - } - - public RankingInfo geoPrecision(Integer geoPrecision) { - this.geoPrecision = geoPrecision; - return this; - } - - /** - * Precision used when computing the geo distance, in meters. - * - * @return geoPrecision - */ - @javax.annotation.Nullable - public Integer getGeoPrecision() { - return geoPrecision; - } - - public void setGeoPrecision(Integer geoPrecision) { - this.geoPrecision = geoPrecision; - } - - public RankingInfo matchedGeoLocation( - Map matchedGeoLocation - ) { - this.matchedGeoLocation = matchedGeoLocation; - return this; - } - - public RankingInfo putMatchedGeoLocationItem( - String key, - RankingInfoMatchedGeoLocation matchedGeoLocationItem - ) { - if (this.matchedGeoLocation == null) { - this.matchedGeoLocation = new HashMap<>(); - } - this.matchedGeoLocation.put(key, matchedGeoLocationItem); - return this; - } - - /** - * Get matchedGeoLocation - * - * @return matchedGeoLocation - */ - @javax.annotation.Nullable - public Map getMatchedGeoLocation() { - return matchedGeoLocation; - } - - public void setMatchedGeoLocation( - Map matchedGeoLocation - ) { - this.matchedGeoLocation = matchedGeoLocation; - } - - public RankingInfo nbExactWords(Integer nbExactWords) { - this.nbExactWords = nbExactWords; - return this; - } - - /** - * Number of exactly matched words. - * - * @return nbExactWords - */ - @javax.annotation.Nullable - public Integer getNbExactWords() { - return nbExactWords; - } - - public void setNbExactWords(Integer nbExactWords) { - this.nbExactWords = nbExactWords; - } - - public RankingInfo nbTypos(Integer nbTypos) { - this.nbTypos = nbTypos; - return this; - } - - /** - * Number of typos encountered when matching the record. - * - * @return nbTypos - */ - @javax.annotation.Nullable - public Integer getNbTypos() { - return nbTypos; - } - - public void setNbTypos(Integer nbTypos) { - this.nbTypos = nbTypos; - } - - public RankingInfo promoted(Boolean promoted) { - this.promoted = promoted; - return this; - } - - /** - * Present and set to true if a Rule promoted the hit. - * - * @return promoted - */ - @javax.annotation.Nullable - public Boolean getPromoted() { - return promoted; - } - - public void setPromoted(Boolean promoted) { - this.promoted = promoted; - } - - public RankingInfo proximityDistance(Integer proximityDistance) { - this.proximityDistance = proximityDistance; - return this; - } - - /** - * When the query contains more than one word, the sum of the distances between matched words (in - * meters). - * - * @return proximityDistance - */ - @javax.annotation.Nullable - public Integer getProximityDistance() { - return proximityDistance; - } - - public void setProximityDistance(Integer proximityDistance) { - this.proximityDistance = proximityDistance; - } - - public RankingInfo userScore(Integer userScore) { - this.userScore = userScore; - return this; - } - - /** - * Custom ranking for the object, expressed as a single integer value. - * - * @return userScore - */ - @javax.annotation.Nullable - public Integer getUserScore() { - return userScore; - } - - public void setUserScore(Integer userScore) { - this.userScore = userScore; - } - - public RankingInfo word(Integer word) { - this.word = word; - return this; - } - - /** - * Number of matched words, including prefixes and typos. - * - * @return word - */ - @javax.annotation.Nullable - public Integer getWord() { - return word; - } - - public void setWord(Integer word) { - this.word = word; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RankingInfo rankingInfo = (RankingInfo) o; - return ( - Objects.equals(this.filters, rankingInfo.filters) && - Objects.equals(this.firstMatchedWord, rankingInfo.firstMatchedWord) && - Objects.equals(this.geoDistance, rankingInfo.geoDistance) && - Objects.equals(this.geoPrecision, rankingInfo.geoPrecision) && - Objects.equals(this.matchedGeoLocation, rankingInfo.matchedGeoLocation) && - Objects.equals(this.nbExactWords, rankingInfo.nbExactWords) && - Objects.equals(this.nbTypos, rankingInfo.nbTypos) && - Objects.equals(this.promoted, rankingInfo.promoted) && - Objects.equals(this.proximityDistance, rankingInfo.proximityDistance) && - Objects.equals(this.userScore, rankingInfo.userScore) && - Objects.equals(this.word, rankingInfo.word) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - filters, - firstMatchedWord, - geoDistance, - geoPrecision, - matchedGeoLocation, - nbExactWords, - nbTypos, - promoted, - proximityDistance, - userScore, - word - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RankingInfo {\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb - .append(" firstMatchedWord: ") - .append(toIndentedString(firstMatchedWord)) - .append("\n"); - sb - .append(" geoDistance: ") - .append(toIndentedString(geoDistance)) - .append("\n"); - sb - .append(" geoPrecision: ") - .append(toIndentedString(geoPrecision)) - .append("\n"); - sb - .append(" matchedGeoLocation: ") - .append(toIndentedString(matchedGeoLocation)) - .append("\n"); - sb - .append(" nbExactWords: ") - .append(toIndentedString(nbExactWords)) - .append("\n"); - sb.append(" nbTypos: ").append(toIndentedString(nbTypos)).append("\n"); - sb.append(" promoted: ").append(toIndentedString(promoted)).append("\n"); - sb - .append(" proximityDistance: ") - .append(toIndentedString(proximityDistance)) - .append("\n"); - sb - .append(" userScore: ") - .append(toIndentedString(userScore)) - .append("\n"); - sb.append(" word: ").append(toIndentedString(word)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java deleted file mode 100644 index 6ea7de27a8..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** RankingInfoMatchedGeoLocation */ -public class RankingInfoMatchedGeoLocation { - - @SerializedName("lat") - private Double lat; - - @SerializedName("lng") - private Double lng; - - @SerializedName("distance") - private Integer distance; - - public RankingInfoMatchedGeoLocation lat(Double lat) { - this.lat = lat; - return this; - } - - /** - * Latitude of the matched location. - * - * @return lat - */ - @javax.annotation.Nullable - public Double getLat() { - return lat; - } - - public void setLat(Double lat) { - this.lat = lat; - } - - public RankingInfoMatchedGeoLocation lng(Double lng) { - this.lng = lng; - return this; - } - - /** - * Longitude of the matched location. - * - * @return lng - */ - @javax.annotation.Nullable - public Double getLng() { - return lng; - } - - public void setLng(Double lng) { - this.lng = lng; - } - - public RankingInfoMatchedGeoLocation distance(Integer distance) { - this.distance = distance; - return this; - } - - /** - * Distance between the matched location and the search location (in meters). - * - * @return distance - */ - @javax.annotation.Nullable - public Integer getDistance() { - return distance; - } - - public void setDistance(Integer distance) { - this.distance = distance; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RankingInfoMatchedGeoLocation rankingInfoMatchedGeoLocation = (RankingInfoMatchedGeoLocation) o; - return ( - Objects.equals(this.lat, rankingInfoMatchedGeoLocation.lat) && - Objects.equals(this.lng, rankingInfoMatchedGeoLocation.lng) && - Objects.equals(this.distance, rankingInfoMatchedGeoLocation.distance) - ); - } - - @Override - public int hashCode() { - return Objects.hash(lat, lng, distance); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RankingInfoMatchedGeoLocation {\n"); - sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); - sb.append(" lng: ").append(toIndentedString(lng)).append("\n"); - sb.append(" distance: ").append(toIndentedString(distance)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RemoveUserIdResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RemoveUserIdResponse.java deleted file mode 100644 index 149e60ba4a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RemoveUserIdResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** RemoveUserIdResponse */ -public class RemoveUserIdResponse { - - @SerializedName("deletedAt") - private String deletedAt; - - public RemoveUserIdResponse deletedAt(String deletedAt) { - this.deletedAt = deletedAt; - return this; - } - - /** - * Date of deletion (ISO-8601 format). - * - * @return deletedAt - */ - @javax.annotation.Nonnull - public String getDeletedAt() { - return deletedAt; - } - - public void setDeletedAt(String deletedAt) { - this.deletedAt = deletedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RemoveUserIdResponse removeUserIdResponse = (RemoveUserIdResponse) o; - return Objects.equals(this.deletedAt, removeUserIdResponse.deletedAt); - } - - @Override - public int hashCode() { - return Objects.hash(deletedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RemoveUserIdResponse {\n"); - sb - .append(" deletedAt: ") - .append(toIndentedString(deletedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java deleted file mode 100644 index 8d119c34ec..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** ReplaceSourceResponse */ -public class ReplaceSourceResponse { - - @SerializedName("updatedAt") - private String updatedAt; - - public ReplaceSourceResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ReplaceSourceResponse replaceSourceResponse = (ReplaceSourceResponse) o; - return Objects.equals(this.updatedAt, replaceSourceResponse.updatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReplaceSourceResponse {\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RequiredSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RequiredSearchParams.java deleted file mode 100644 index dd933cb736..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RequiredSearchParams.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** RequiredSearchParams */ -public class RequiredSearchParams { - - @SerializedName("query") - private String query = ""; - - public RequiredSearchParams query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RequiredSearchParams requiredSearchParams = (RequiredSearchParams) o; - return Objects.equals(this.query, requiredSearchParams.query); - } - - @Override - public int hashCode() { - return Objects.hash(query); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RequiredSearchParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Rule.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Rule.java deleted file mode 100644 index 318057b810..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Rule.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Rule object. */ -public class Rule { - - @SerializedName("objectID") - private String objectID; - - @SerializedName("conditions") - private List conditions = null; - - @SerializedName("consequence") - private Consequence consequence; - - @SerializedName("description") - private String description; - - @SerializedName("enabled") - private Boolean enabled = true; - - @SerializedName("validity") - private List validity = null; - - public Rule objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public Rule conditions(List conditions) { - this.conditions = conditions; - return this; - } - - public Rule addConditionsItem(Condition conditionsItem) { - if (this.conditions == null) { - this.conditions = new ArrayList<>(); - } - this.conditions.add(conditionsItem); - return this; - } - - /** - * A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per - * Rule. - * - * @return conditions - */ - @javax.annotation.Nullable - public List getConditions() { - return conditions; - } - - public void setConditions(List conditions) { - this.conditions = conditions; - } - - public Rule consequence(Consequence consequence) { - this.consequence = consequence; - return this; - } - - /** - * Get consequence - * - * @return consequence - */ - @javax.annotation.Nonnull - public Consequence getConsequence() { - return consequence; - } - - public void setConsequence(Consequence consequence) { - this.consequence = consequence; - } - - public Rule description(String description) { - this.description = description; - return this; - } - - /** - * This field is intended for Rule management purposes, in particular to ease searching for Rules - * and presenting them to human readers. It's not interpreted by the API. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Rule enabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Whether the Rule is enabled. Disabled Rules remain in the index, but aren't applied at query - * time. - * - * @return enabled - */ - @javax.annotation.Nullable - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Rule validity(List validity) { - this.validity = validity; - return this; - } - - public Rule addValidityItem(TimeRange validityItem) { - if (this.validity == null) { - this.validity = new ArrayList<>(); - } - this.validity.add(validityItem); - return this; - } - - /** - * By default, Rules are permanently valid. When validity periods are specified, the Rule applies - * only during those periods; it's ignored the rest of the time. The list must not be empty. - * - * @return validity - */ - @javax.annotation.Nullable - public List getValidity() { - return validity; - } - - public void setValidity(List validity) { - this.validity = validity; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Rule rule = (Rule) o; - return ( - Objects.equals(this.objectID, rule.objectID) && - Objects.equals(this.conditions, rule.conditions) && - Objects.equals(this.consequence, rule.consequence) && - Objects.equals(this.description, rule.description) && - Objects.equals(this.enabled, rule.enabled) && - Objects.equals(this.validity, rule.validity) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - objectID, - conditions, - consequence, - description, - enabled, - validity - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Rule {\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb - .append(" conditions: ") - .append(toIndentedString(conditions)) - .append("\n"); - sb - .append(" consequence: ") - .append(toIndentedString(consequence)) - .append("\n"); - sb - .append(" description: ") - .append(toIndentedString(description)) - .append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" validity: ").append(toIndentedString(validity)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java deleted file mode 100644 index 815d42c278..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SaveObjectResponse */ -public class SaveObjectResponse { - - @SerializedName("createdAt") - private String createdAt; - - @SerializedName("taskID") - private Integer taskID; - - @SerializedName("objectID") - private String objectID; - - public SaveObjectResponse createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Get createdAt - * - * @return createdAt - */ - @javax.annotation.Nullable - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - public SaveObjectResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public SaveObjectResponse objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nullable - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SaveObjectResponse saveObjectResponse = (SaveObjectResponse) o; - return ( - Objects.equals(this.createdAt, saveObjectResponse.createdAt) && - Objects.equals(this.taskID, saveObjectResponse.taskID) && - Objects.equals(this.objectID, saveObjectResponse.objectID) - ); - } - - @Override - public int hashCode() { - return Objects.hash(createdAt, taskID, objectID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SaveObjectResponse {\n"); - sb - .append(" createdAt: ") - .append(toIndentedString(createdAt)) - .append("\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java deleted file mode 100644 index 00dcf13768..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SaveSynonymResponse */ -public class SaveSynonymResponse { - - @SerializedName("taskID") - private Integer taskID; - - @SerializedName("updatedAt") - private String updatedAt; - - @SerializedName("id") - private String id; - - public SaveSynonymResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nonnull - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public SaveSynonymResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - public SaveSynonymResponse id(String id) { - this.id = id; - return this; - } - - /** - * objectID of the inserted object. - * - * @return id - */ - @javax.annotation.Nonnull - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SaveSynonymResponse saveSynonymResponse = (SaveSynonymResponse) o; - return ( - Objects.equals(this.taskID, saveSynonymResponse.taskID) && - Objects.equals(this.updatedAt, saveSynonymResponse.updatedAt) && - Objects.equals(this.id, saveSynonymResponse.id) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, updatedAt, id); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SaveSynonymResponse {\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ScopeType.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ScopeType.java deleted file mode 100644 index cd9de1f61c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ScopeType.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Gets or Sets scopeType */ -@JsonAdapter(ScopeType.Adapter.class) -public enum ScopeType { - SETTINGS("settings"), - - SYNONYMS("synonyms"), - - RULES("rules"); - - private String value; - - ScopeType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ScopeType fromValue(String value) { - for (ScopeType b : ScopeType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write(final JsonWriter jsonWriter, final ScopeType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ScopeType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ScopeType.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchDictionaryEntriesParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchDictionaryEntriesParams.java deleted file mode 100644 index 29fc496bf7..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchDictionaryEntriesParams.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** The `searchDictionaryEntries` parameters. */ -public class SearchDictionaryEntriesParams { - - @SerializedName("query") - private String query = ""; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("language") - private String language; - - public SearchDictionaryEntriesParams query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public SearchDictionaryEntriesParams page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchDictionaryEntriesParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public SearchDictionaryEntriesParams language(String language) { - this.language = language; - return this; - } - - /** - * Language ISO code supported by the dictionary (e.g., \"en\" for English). - * - * @return language - */ - @javax.annotation.Nullable - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchDictionaryEntriesParams searchDictionaryEntriesParams = (SearchDictionaryEntriesParams) o; - return ( - Objects.equals(this.query, searchDictionaryEntriesParams.query) && - Objects.equals(this.page, searchDictionaryEntriesParams.page) && - Objects.equals( - this.hitsPerPage, - searchDictionaryEntriesParams.hitsPerPage - ) && - Objects.equals(this.language, searchDictionaryEntriesParams.language) - ); - } - - @Override - public int hashCode() { - return Objects.hash(query, page, hitsPerPage, language); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchDictionaryEntriesParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb.append(" language: ").append(toIndentedString(language)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesRequest.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesRequest.java deleted file mode 100644 index 61a4b4bc11..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesRequest.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SearchForFacetValuesRequest */ -public class SearchForFacetValuesRequest { - - @SerializedName("params") - private String params = ""; - - @SerializedName("facetQuery") - private String facetQuery = ""; - - @SerializedName("maxFacetHits") - private Integer maxFacetHits = 10; - - public SearchForFacetValuesRequest params(String params) { - this.params = params; - return this; - } - - /** - * Search parameters as URL-encoded query string. - * - * @return params - */ - @javax.annotation.Nullable - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public SearchForFacetValuesRequest facetQuery(String facetQuery) { - this.facetQuery = facetQuery; - return this; - } - - /** - * Text to search inside the facet's values. - * - * @return facetQuery - */ - @javax.annotation.Nullable - public String getFacetQuery() { - return facetQuery; - } - - public void setFacetQuery(String facetQuery) { - this.facetQuery = facetQuery; - } - - public SearchForFacetValuesRequest maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet hits to return during a search for facet values. For performance - * reasons, the maximum allowed number of returned values is 100. maximum: 100 - * - * @return maxFacetHits - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - - public void setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchForFacetValuesRequest searchForFacetValuesRequest = (SearchForFacetValuesRequest) o; - return ( - Objects.equals(this.params, searchForFacetValuesRequest.params) && - Objects.equals(this.facetQuery, searchForFacetValuesRequest.facetQuery) && - Objects.equals( - this.maxFacetHits, - searchForFacetValuesRequest.maxFacetHits - ) - ); - } - - @Override - public int hashCode() { - return Objects.hash(params, facetQuery, maxFacetHits); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchForFacetValuesRequest {\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb - .append(" facetQuery: ") - .append(toIndentedString(facetQuery)) - .append("\n"); - sb - .append(" maxFacetHits: ") - .append(toIndentedString(maxFacetHits)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponse.java deleted file mode 100644 index fb9e84ce60..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponse.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** SearchForFacetValuesResponse */ -public class SearchForFacetValuesResponse { - - @SerializedName("facetHits") - private List facetHits = new ArrayList<>(); - - public SearchForFacetValuesResponse facetHits( - List facetHits - ) { - this.facetHits = facetHits; - return this; - } - - public SearchForFacetValuesResponse addFacetHitsItem( - SearchForFacetValuesResponseFacetHits facetHitsItem - ) { - this.facetHits.add(facetHitsItem); - return this; - } - - /** - * Get facetHits - * - * @return facetHits - */ - @javax.annotation.Nonnull - public List getFacetHits() { - return facetHits; - } - - public void setFacetHits( - List facetHits - ) { - this.facetHits = facetHits; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchForFacetValuesResponse searchForFacetValuesResponse = (SearchForFacetValuesResponse) o; - return Objects.equals( - this.facetHits, - searchForFacetValuesResponse.facetHits - ); - } - - @Override - public int hashCode() { - return Objects.hash(facetHits); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchForFacetValuesResponse {\n"); - sb - .append(" facetHits: ") - .append(toIndentedString(facetHits)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponseFacetHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponseFacetHits.java deleted file mode 100644 index 10b39b4fbc..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchForFacetValuesResponseFacetHits.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SearchForFacetValuesResponseFacetHits */ -public class SearchForFacetValuesResponseFacetHits { - - @SerializedName("value") - private String value; - - @SerializedName("highlighted") - private String highlighted; - - @SerializedName("count") - private Integer count; - - public SearchForFacetValuesResponseFacetHits value(String value) { - this.value = value; - return this; - } - - /** - * Raw value of the facet. - * - * @return value - */ - @javax.annotation.Nonnull - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public SearchForFacetValuesResponseFacetHits highlighted(String highlighted) { - this.highlighted = highlighted; - return this; - } - - /** - * Markup text with occurrences highlighted. - * - * @return highlighted - */ - @javax.annotation.Nonnull - public String getHighlighted() { - return highlighted; - } - - public void setHighlighted(String highlighted) { - this.highlighted = highlighted; - } - - public SearchForFacetValuesResponseFacetHits count(Integer count) { - this.count = count; - return this; - } - - /** - * How many objects contain this facet value. This takes into account the extra search parameters - * specified in the query. Like for a regular search query, the counts may not be exhaustive. - * - * @return count - */ - @javax.annotation.Nonnull - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchForFacetValuesResponseFacetHits searchForFacetValuesResponseFacetHits = (SearchForFacetValuesResponseFacetHits) o; - return ( - Objects.equals(this.value, searchForFacetValuesResponseFacetHits.value) && - Objects.equals( - this.highlighted, - searchForFacetValuesResponseFacetHits.highlighted - ) && - Objects.equals(this.count, searchForFacetValuesResponseFacetHits.count) - ); - } - - @Override - public int hashCode() { - return Objects.hash(value, highlighted, count); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchForFacetValuesResponseFacetHits {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb - .append(" highlighted: ") - .append(toIndentedString(highlighted)) - .append("\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java deleted file mode 100644 index 54993308f9..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** SearchHits */ -public class SearchHits { - - @SerializedName("hits") - private List hits = null; - - public SearchHits hits(List hits) { - this.hits = hits; - return this; - } - - public SearchHits addHitsItem(Hit hitsItem) { - if (this.hits == null) { - this.hits = new ArrayList<>(); - } - this.hits.add(hitsItem); - return this; - } - - /** - * Get hits - * - * @return hits - */ - @javax.annotation.Nullable - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchHits searchHits = (SearchHits) o; - return Objects.equals(this.hits, searchHits.hits); - } - - @Override - public int hashCode() { - return Objects.hash(hits); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchHits {\n"); - sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java deleted file mode 100644 index 8e6606dd8a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ /dev/null @@ -1,2913 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** SearchParams */ -public class SearchParams { - - @SerializedName("params") - private String params = ""; - - @SerializedName("similarQuery") - private String similarQuery = ""; - - @SerializedName("filters") - private String filters = ""; - - @SerializedName("facetFilters") - private List facetFilters = null; - - @SerializedName("optionalFilters") - private List optionalFilters = null; - - @SerializedName("numericFilters") - private List numericFilters = null; - - @SerializedName("tagFilters") - private List tagFilters = null; - - @SerializedName("sumOrFiltersScores") - private Boolean sumOrFiltersScores = false; - - @SerializedName("facets") - private List facets = null; - - @SerializedName("maxValuesPerFacet") - private Integer maxValuesPerFacet = 100; - - @SerializedName("facetingAfterDistinct") - private Boolean facetingAfterDistinct = false; - - @SerializedName("sortFacetValuesBy") - private String sortFacetValuesBy = "count"; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("offset") - private Integer offset; - - @SerializedName("length") - private Integer length; - - @SerializedName("aroundLatLng") - private String aroundLatLng = ""; - - @SerializedName("aroundLatLngViaIP") - private Boolean aroundLatLngViaIP = false; - - @SerializedName("aroundRadius") - private OneOfintegerstring aroundRadius; - - @SerializedName("aroundPrecision") - private Integer aroundPrecision = 10; - - @SerializedName("minimumAroundRadius") - private Integer minimumAroundRadius; - - @SerializedName("insideBoundingBox") - private List insideBoundingBox = null; - - @SerializedName("insidePolygon") - private List insidePolygon = null; - - @SerializedName("naturalLanguages") - private List naturalLanguages = null; - - @SerializedName("ruleContexts") - private List ruleContexts = null; - - @SerializedName("personalizationImpact") - private Integer personalizationImpact = 100; - - @SerializedName("userToken") - private String userToken; - - @SerializedName("getRankingInfo") - private Boolean getRankingInfo = false; - - @SerializedName("clickAnalytics") - private Boolean clickAnalytics = false; - - @SerializedName("analytics") - private Boolean analytics = true; - - @SerializedName("analyticsTags") - private List analyticsTags = null; - - @SerializedName("percentileComputation") - private Boolean percentileComputation = true; - - @SerializedName("enableABTest") - private Boolean enableABTest = true; - - @SerializedName("enableReRanking") - private Boolean enableReRanking = true; - - @SerializedName("query") - private String query = ""; - - @SerializedName("searchableAttributes") - private List searchableAttributes = null; - - @SerializedName("attributesForFaceting") - private List attributesForFaceting = null; - - @SerializedName("unretrievableAttributes") - private List unretrievableAttributes = null; - - @SerializedName("attributesToRetrieve") - private List attributesToRetrieve = null; - - @SerializedName("restrictSearchableAttributes") - private List restrictSearchableAttributes = null; - - @SerializedName("ranking") - private List ranking = null; - - @SerializedName("customRanking") - private List customRanking = null; - - @SerializedName("relevancyStrictness") - private Integer relevancyStrictness = 100; - - @SerializedName("attributesToHighlight") - private List attributesToHighlight = null; - - @SerializedName("attributesToSnippet") - private List attributesToSnippet = null; - - @SerializedName("highlightPreTag") - private String highlightPreTag = ""; - - @SerializedName("highlightPostTag") - private String highlightPostTag = ""; - - @SerializedName("snippetEllipsisText") - private String snippetEllipsisText = "…"; - - @SerializedName("restrictHighlightAndSnippetArrays") - private Boolean restrictHighlightAndSnippetArrays = false; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("minWordSizefor1Typo") - private Integer minWordSizefor1Typo = 4; - - @SerializedName("minWordSizefor2Typos") - private Integer minWordSizefor2Typos = 8; - - /** Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) - public enum TypoToleranceEnum { - TRUE("true"), - - FALSE("false"), - - MIN("min"), - - STRICT("strict"); - - private String value; - - TypoToleranceEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static TypoToleranceEnum fromValue(String value) { - for (TypoToleranceEnum b : TypoToleranceEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } - } - - @SerializedName("typoTolerance") - private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - - @SerializedName("allowTyposOnNumericTokens") - private Boolean allowTyposOnNumericTokens = true; - - @SerializedName("disableTypoToleranceOnAttributes") - private List disableTypoToleranceOnAttributes = null; - - @SerializedName("separatorsToIndex") - private String separatorsToIndex = ""; - - @SerializedName("ignorePlurals") - private String ignorePlurals = "false"; - - @SerializedName("removeStopWords") - private String removeStopWords = "false"; - - @SerializedName("keepDiacriticsOnCharacters") - private String keepDiacriticsOnCharacters = ""; - - @SerializedName("queryLanguages") - private List queryLanguages = null; - - @SerializedName("decompoundQuery") - private Boolean decompoundQuery = true; - - @SerializedName("enableRules") - private Boolean enableRules = true; - - @SerializedName("enablePersonalization") - private Boolean enablePersonalization = false; - - /** Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) - public enum QueryTypeEnum { - PREFIXLAST("prefixLast"), - - PREFIXALL("prefixAll"), - - PREFIXNONE("prefixNone"); - - private String value; - - QueryTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static QueryTypeEnum fromValue(String value) { - for (QueryTypeEnum b : QueryTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } - } - - @SerializedName("queryType") - private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - - /** Selects a strategy to remove words from the query when it doesn't match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) - public enum RemoveWordsIfNoResultsEnum { - NONE("none"), - - LASTWORDS("lastWords"), - - FIRSTWORDS("firstWords"), - - ALLOPTIONAL("allOptional"); - - private String value; - - RemoveWordsIfNoResultsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RemoveWordsIfNoResultsEnum fromValue(String value) { - for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } - } - - @SerializedName("removeWordsIfNoResults") - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = - RemoveWordsIfNoResultsEnum.NONE; - - @SerializedName("advancedSyntax") - private Boolean advancedSyntax = false; - - @SerializedName("optionalWords") - private List optionalWords = null; - - @SerializedName("disableExactOnAttributes") - private List disableExactOnAttributes = null; - - /** Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) - public enum ExactOnSingleWordQueryEnum { - ATTRIBUTE("attribute"), - - NONE("none"), - - WORD("word"); - - private String value; - - ExactOnSingleWordQueryEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ExactOnSingleWordQueryEnum fromValue(String value) { - for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } - } - - @SerializedName("exactOnSingleWordQuery") - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = - ExactOnSingleWordQueryEnum.ATTRIBUTE; - - /** Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) - public enum AlternativesAsExactEnum { - IGNOREPLURALS("ignorePlurals"), - - SINGLEWORDSYNONYM("singleWordSynonym"), - - MULTIWORDSSYNONYM("multiWordsSynonym"); - - private String value; - - AlternativesAsExactEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AlternativesAsExactEnum fromValue(String value) { - for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } - } - - @SerializedName("alternativesAsExact") - private List alternativesAsExact = null; - - /** Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) - public enum AdvancedSyntaxFeaturesEnum { - EXACTPHRASE("exactPhrase"), - - EXCLUDEWORDS("excludeWords"); - - private String value; - - AdvancedSyntaxFeaturesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AdvancedSyntaxFeaturesEnum fromValue(String value) { - for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } - } - - @SerializedName("advancedSyntaxFeatures") - private List advancedSyntaxFeatures = null; - - @SerializedName("distinct") - private Integer distinct = 0; - - @SerializedName("synonyms") - private Boolean synonyms = true; - - @SerializedName("replaceSynonymsInHighlight") - private Boolean replaceSynonymsInHighlight = false; - - @SerializedName("minProximity") - private Integer minProximity = 1; - - @SerializedName("responseFields") - private List responseFields = null; - - @SerializedName("maxFacetHits") - private Integer maxFacetHits = 10; - - @SerializedName("attributeCriteriaComputedByMinProximity") - private Boolean attributeCriteriaComputedByMinProximity = false; - - @SerializedName("renderingContent") - private Object renderingContent = new Object(); - - public SearchParams params(String params) { - this.params = params; - return this; - } - - /** - * Search parameters as URL-encoded query string. - * - * @return params - */ - @javax.annotation.Nullable - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public SearchParams similarQuery(String similarQuery) { - this.similarQuery = similarQuery; - return this; - } - - /** - * Overrides the query parameter and performs a more generic search that can be used to find - * \"similar\" results. - * - * @return similarQuery - */ - @javax.annotation.Nullable - public String getSimilarQuery() { - return similarQuery; - } - - public void setSimilarQuery(String similarQuery) { - this.similarQuery = similarQuery; - } - - public SearchParams filters(String filters) { - this.filters = filters; - return this; - } - - /** - * Filter the query with numeric, facet and/or tag filters. - * - * @return filters - */ - @javax.annotation.Nullable - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } - - public SearchParams facetFilters(List facetFilters) { - this.facetFilters = facetFilters; - return this; - } - - public SearchParams addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - - /** - * Filter hits by facet value. - * - * @return facetFilters - */ - @javax.annotation.Nullable - public List getFacetFilters() { - return facetFilters; - } - - public void setFacetFilters(List facetFilters) { - this.facetFilters = facetFilters; - } - - public SearchParams optionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - return this; - } - - public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { - if (this.optionalFilters == null) { - this.optionalFilters = new ArrayList<>(); - } - this.optionalFilters.add(optionalFiltersItem); - return this; - } - - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or - * lower in the case of a negative optional filter. - * - * @return optionalFilters - */ - @javax.annotation.Nullable - public List getOptionalFilters() { - return optionalFilters; - } - - public void setOptionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - } - - public SearchParams numericFilters(List numericFilters) { - this.numericFilters = numericFilters; - return this; - } - - public SearchParams addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - - /** - * Filter on numeric attributes. - * - * @return numericFilters - */ - @javax.annotation.Nullable - public List getNumericFilters() { - return numericFilters; - } - - public void setNumericFilters(List numericFilters) { - this.numericFilters = numericFilters; - } - - public SearchParams tagFilters(List tagFilters) { - this.tagFilters = tagFilters; - return this; - } - - public SearchParams addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - - /** - * Filter hits by tags. - * - * @return tagFilters - */ - @javax.annotation.Nullable - public List getTagFilters() { - return tagFilters; - } - - public void setTagFilters(List tagFilters) { - this.tagFilters = tagFilters; - } - - public SearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - return this; - } - - /** - * Determines how to calculate the total score for filtering. - * - * @return sumOrFiltersScores - */ - @javax.annotation.Nullable - public Boolean getSumOrFiltersScores() { - return sumOrFiltersScores; - } - - public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - } - - public SearchParams facets(List facets) { - this.facets = facets; - return this; - } - - public SearchParams addFacetsItem(String facetsItem) { - if (this.facets == null) { - this.facets = new ArrayList<>(); - } - this.facets.add(facetsItem); - return this; - } - - /** - * Retrieve facets and their facet values. - * - * @return facets - */ - @javax.annotation.Nullable - public List getFacets() { - return facets; - } - - public void setFacets(List facets) { - this.facets = facets; - } - - public SearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - return this; - } - - /** - * Maximum number of facet values to return for each facet during a regular search. - * - * @return maxValuesPerFacet - */ - @javax.annotation.Nullable - public Integer getMaxValuesPerFacet() { - return maxValuesPerFacet; - } - - public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - } - - public SearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; - return this; - } - - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - * - * @return facetingAfterDistinct - */ - @javax.annotation.Nullable - public Boolean getFacetingAfterDistinct() { - return facetingAfterDistinct; - } - - public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; - } - - public SearchParams sortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - return this; - } - - /** - * Controls how facet values are fetched. - * - * @return sortFacetValuesBy - */ - @javax.annotation.Nullable - public String getSortFacetValuesBy() { - return sortFacetValuesBy; - } - - public void setSortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - } - - public SearchParams page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchParams offset(Integer offset) { - this.offset = offset; - return this; - } - - /** - * Specify the offset of the first hit to return. - * - * @return offset - */ - @javax.annotation.Nullable - public Integer getOffset() { - return offset; - } - - public void setOffset(Integer offset) { - this.offset = offset; - } - - public SearchParams length(Integer length) { - this.length = length; - return this; - } - - /** - * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 - * - * @return length - */ - @javax.annotation.Nullable - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public SearchParams aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public SearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - return this; - } - - /** - * Search for entries around a given location automatically computed from the requester's IP - * address. - * - * @return aroundLatLngViaIP - */ - @javax.annotation.Nullable - public Boolean getAroundLatLngViaIP() { - return aroundLatLngViaIP; - } - - public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - } - - public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - return this; - } - - /** - * Define the maximum radius for a geo search (in meters). - * - * @return aroundRadius - */ - @javax.annotation.Nullable - public OneOfintegerstring getAroundRadius() { - return aroundRadius; - } - - public void setAroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - } - - public SearchParams aroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - return this; - } - - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - * - * @return aroundPrecision - */ - @javax.annotation.Nullable - public Integer getAroundPrecision() { - return aroundPrecision; - } - - public void setAroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - } - - public SearchParams minimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - return this; - } - - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 - * - * @return minimumAroundRadius - */ - @javax.annotation.Nullable - public Integer getMinimumAroundRadius() { - return minimumAroundRadius; - } - - public void setMinimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - } - - public SearchParams insideBoundingBox(List insideBoundingBox) { - this.insideBoundingBox = insideBoundingBox; - return this; - } - - public SearchParams addInsideBoundingBoxItem( - BigDecimal insideBoundingBoxItem - ) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Search inside a rectangular area (in geo coordinates). - * - * @return insideBoundingBox - */ - @javax.annotation.Nullable - public List getInsideBoundingBox() { - return insideBoundingBox; - } - - public void setInsideBoundingBox(List insideBoundingBox) { - this.insideBoundingBox = insideBoundingBox; - } - - public SearchParams insidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - return this; - } - - public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { - if (this.insidePolygon == null) { - this.insidePolygon = new ArrayList<>(); - } - this.insidePolygon.add(insidePolygonItem); - return this; - } - - /** - * Search inside a polygon (in geo coordinates). - * - * @return insidePolygon - */ - @javax.annotation.Nullable - public List getInsidePolygon() { - return insidePolygon; - } - - public void setInsidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - } - - public SearchParams naturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - return this; - } - - public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { - if (this.naturalLanguages == null) { - this.naturalLanguages = new ArrayList<>(); - } - this.naturalLanguages.add(naturalLanguagesItem); - return this; - } - - /** - * This parameter changes the default values of certain parameters and settings that work best for - * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, - * analyticsTags and ruleContexts. These parameters and settings work well together when the query - * is formatted in natural language instead of keywords, for example when your user performs a - * voice search. - * - * @return naturalLanguages - */ - @javax.annotation.Nullable - public List getNaturalLanguages() { - return naturalLanguages; - } - - public void setNaturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - } - - public SearchParams ruleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - return this; - } - - public SearchParams addRuleContextsItem(String ruleContextsItem) { - if (this.ruleContexts == null) { - this.ruleContexts = new ArrayList<>(); - } - this.ruleContexts.add(ruleContextsItem); - return this; - } - - /** - * Enables contextual rules. - * - * @return ruleContexts - */ - @javax.annotation.Nullable - public List getRuleContexts() { - return ruleContexts; - } - - public void setRuleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - } - - public SearchParams personalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; - return this; - } - - /** - * Define the impact of the Personalization feature. - * - * @return personalizationImpact - */ - @javax.annotation.Nullable - public Integer getPersonalizationImpact() { - return personalizationImpact; - } - - public void setPersonalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; - } - - public SearchParams userToken(String userToken) { - this.userToken = userToken; - return this; - } - - /** - * Associates a certain user token with the current search. - * - * @return userToken - */ - @javax.annotation.Nullable - public String getUserToken() { - return userToken; - } - - public void setUserToken(String userToken) { - this.userToken = userToken; - } - - public SearchParams getRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - return this; - } - - /** - * Retrieve detailed ranking information. - * - * @return getRankingInfo - */ - @javax.annotation.Nullable - public Boolean getGetRankingInfo() { - return getRankingInfo; - } - - public void setGetRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - } - - public SearchParams clickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - return this; - } - - /** - * Enable the Click Analytics feature. - * - * @return clickAnalytics - */ - @javax.annotation.Nullable - public Boolean getClickAnalytics() { - return clickAnalytics; - } - - public void setClickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - } - - public SearchParams analytics(Boolean analytics) { - this.analytics = analytics; - return this; - } - - /** - * Whether the current query will be taken into account in the Analytics. - * - * @return analytics - */ - @javax.annotation.Nullable - public Boolean getAnalytics() { - return analytics; - } - - public void setAnalytics(Boolean analytics) { - this.analytics = analytics; - } - - public SearchParams analyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - return this; - } - - public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { - if (this.analyticsTags == null) { - this.analyticsTags = new ArrayList<>(); - } - this.analyticsTags.add(analyticsTagsItem); - return this; - } - - /** - * List of tags to apply to the query for analytics purposes. - * - * @return analyticsTags - */ - @javax.annotation.Nullable - public List getAnalyticsTags() { - return analyticsTags; - } - - public void setAnalyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - } - - public SearchParams percentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; - return this; - } - - /** - * Whether to include or exclude a query from the processing-time percentile computation. - * - * @return percentileComputation - */ - @javax.annotation.Nullable - public Boolean getPercentileComputation() { - return percentileComputation; - } - - public void setPercentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; - } - - public SearchParams enableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - return this; - } - - /** - * Whether this search should participate in running AB tests. - * - * @return enableABTest - */ - @javax.annotation.Nullable - public Boolean getEnableABTest() { - return enableABTest; - } - - public void setEnableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - } - - public SearchParams enableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - return this; - } - - /** - * Whether this search should use AI Re-Ranking. - * - * @return enableReRanking - */ - @javax.annotation.Nullable - public Boolean getEnableReRanking() { - return enableReRanking; - } - - public void setEnableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - } - - public SearchParams query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public SearchParams searchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - return this; - } - - public SearchParams addSearchableAttributesItem( - String searchableAttributesItem - ) { - if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList<>(); - } - this.searchableAttributes.add(searchableAttributesItem); - return this; - } - - /** - * The complete list of attributes used for searching. - * - * @return searchableAttributes - */ - @javax.annotation.Nullable - public List getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public SearchParams attributesForFaceting( - List attributesForFaceting - ) { - this.attributesForFaceting = attributesForFaceting; - return this; - } - - public SearchParams addAttributesForFacetingItem( - String attributesForFacetingItem - ) { - if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList<>(); - } - this.attributesForFaceting.add(attributesForFacetingItem); - return this; - } - - /** - * The complete list of attributes that will be used for faceting. - * - * @return attributesForFaceting - */ - @javax.annotation.Nullable - public List getAttributesForFaceting() { - return attributesForFaceting; - } - - public void setAttributesForFaceting(List attributesForFaceting) { - this.attributesForFaceting = attributesForFaceting; - } - - public SearchParams unretrievableAttributes( - List unretrievableAttributes - ) { - this.unretrievableAttributes = unretrievableAttributes; - return this; - } - - public SearchParams addUnretrievableAttributesItem( - String unretrievableAttributesItem - ) { - if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList<>(); - } - this.unretrievableAttributes.add(unretrievableAttributesItem); - return this; - } - - /** - * List of attributes that can't be retrieved at query time. - * - * @return unretrievableAttributes - */ - @javax.annotation.Nullable - public List getUnretrievableAttributes() { - return unretrievableAttributes; - } - - public void setUnretrievableAttributes(List unretrievableAttributes) { - this.unretrievableAttributes = unretrievableAttributes; - } - - public SearchParams attributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - return this; - } - - public SearchParams addAttributesToRetrieveItem( - String attributesToRetrieveItem - ) { - if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList<>(); - } - this.attributesToRetrieve.add(attributesToRetrieveItem); - return this; - } - - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - * - * @return attributesToRetrieve - */ - @javax.annotation.Nullable - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public void setAttributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - } - - public SearchParams restrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - return this; - } - - public SearchParams addRestrictSearchableAttributesItem( - String restrictSearchableAttributesItem - ) { - if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList<>(); - } - this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); - return this; - } - - /** - * Restricts a given query to look in only a subset of your searchable attributes. - * - * @return restrictSearchableAttributes - */ - @javax.annotation.Nullable - public List getRestrictSearchableAttributes() { - return restrictSearchableAttributes; - } - - public void setRestrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - } - - public SearchParams ranking(List ranking) { - this.ranking = ranking; - return this; - } - - public SearchParams addRankingItem(String rankingItem) { - if (this.ranking == null) { - this.ranking = new ArrayList<>(); - } - this.ranking.add(rankingItem); - return this; - } - - /** - * Controls how Algolia should sort your results. - * - * @return ranking - */ - @javax.annotation.Nullable - public List getRanking() { - return ranking; - } - - public void setRanking(List ranking) { - this.ranking = ranking; - } - - public SearchParams customRanking(List customRanking) { - this.customRanking = customRanking; - return this; - } - - public SearchParams addCustomRankingItem(String customRankingItem) { - if (this.customRanking == null) { - this.customRanking = new ArrayList<>(); - } - this.customRanking.add(customRankingItem); - return this; - } - - /** - * Specifies the custom ranking criterion. - * - * @return customRanking - */ - @javax.annotation.Nullable - public List getCustomRanking() { - return customRanking; - } - - public void setCustomRanking(List customRanking) { - this.customRanking = customRanking; - } - - public SearchParams relevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - return this; - } - - /** - * Controls the relevancy threshold below which less relevant results aren't included in the - * results. - * - * @return relevancyStrictness - */ - @javax.annotation.Nullable - public Integer getRelevancyStrictness() { - return relevancyStrictness; - } - - public void setRelevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - } - - public SearchParams attributesToHighlight( - List attributesToHighlight - ) { - this.attributesToHighlight = attributesToHighlight; - return this; - } - - public SearchParams addAttributesToHighlightItem( - String attributesToHighlightItem - ) { - if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList<>(); - } - this.attributesToHighlight.add(attributesToHighlightItem); - return this; - } - - /** - * List of attributes to highlight. - * - * @return attributesToHighlight - */ - @javax.annotation.Nullable - public List getAttributesToHighlight() { - return attributesToHighlight; - } - - public void setAttributesToHighlight(List attributesToHighlight) { - this.attributesToHighlight = attributesToHighlight; - } - - public SearchParams attributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - return this; - } - - public SearchParams addAttributesToSnippetItem( - String attributesToSnippetItem - ) { - if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList<>(); - } - this.attributesToSnippet.add(attributesToSnippetItem); - return this; - } - - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - * - * @return attributesToSnippet - */ - @javax.annotation.Nullable - public List getAttributesToSnippet() { - return attributesToSnippet; - } - - public void setAttributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - } - - public SearchParams highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - return this; - } - - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - * - * @return highlightPreTag - */ - @javax.annotation.Nullable - public String getHighlightPreTag() { - return highlightPreTag; - } - - public void setHighlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - } - - public SearchParams highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - return this; - } - - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - * - * @return highlightPostTag - */ - @javax.annotation.Nullable - public String getHighlightPostTag() { - return highlightPostTag; - } - - public void setHighlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - } - - public SearchParams snippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - return this; - } - - /** - * String used as an ellipsis indicator when a snippet is truncated. - * - * @return snippetEllipsisText - */ - @javax.annotation.Nullable - public String getSnippetEllipsisText() { - return snippetEllipsisText; - } - - public void setSnippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - } - - public SearchParams restrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - return this; - } - - /** - * Restrict highlighting and snippeting to items that matched the query. - * - * @return restrictHighlightAndSnippetArrays - */ - @javax.annotation.Nullable - public Boolean getRestrictHighlightAndSnippetArrays() { - return restrictHighlightAndSnippetArrays; - } - - public void setRestrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - } - - public SearchParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public SearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 - * typo. - * - * @return minWordSizefor1Typo - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor1Typo() { - return minWordSizefor1Typo; - } - - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - } - - public SearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 - * typos. - * - * @return minWordSizefor2Typos - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor2Typos() { - return minWordSizefor2Typos; - } - - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - } - - public SearchParams typoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - return this; - } - - /** - * Controls whether typo tolerance is enabled and how it is applied. - * - * @return typoTolerance - */ - @javax.annotation.Nullable - public TypoToleranceEnum getTypoTolerance() { - return typoTolerance; - } - - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - } - - public SearchParams allowTyposOnNumericTokens( - Boolean allowTyposOnNumericTokens - ) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - return this; - } - - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - * - * @return allowTyposOnNumericTokens - */ - @javax.annotation.Nullable - public Boolean getAllowTyposOnNumericTokens() { - return allowTyposOnNumericTokens; - } - - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - } - - public SearchParams disableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - return this; - } - - public SearchParams addDisableTypoToleranceOnAttributesItem( - String disableTypoToleranceOnAttributesItem - ) { - if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList<>(); - } - this.disableTypoToleranceOnAttributes.add( - disableTypoToleranceOnAttributesItem - ); - return this; - } - - /** - * List of attributes on which you want to disable typo tolerance. - * - * @return disableTypoToleranceOnAttributes - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnAttributes() { - return disableTypoToleranceOnAttributes; - } - - public void setDisableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - } - - public SearchParams separatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - return this; - } - - /** - * Control which separators are indexed. - * - * @return separatorsToIndex - */ - @javax.annotation.Nullable - public String getSeparatorsToIndex() { - return separatorsToIndex; - } - - public void setSeparatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - } - - public SearchParams ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - return this; - } - - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - * - * @return ignorePlurals - */ - @javax.annotation.Nullable - public String getIgnorePlurals() { - return ignorePlurals; - } - - public void setIgnorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - } - - public SearchParams removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - return this; - } - - /** - * Removes stop (common) words from the query before executing it. - * - * @return removeStopWords - */ - @javax.annotation.Nullable - public String getRemoveStopWords() { - return removeStopWords; - } - - public void setRemoveStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - } - - public SearchParams keepDiacriticsOnCharacters( - String keepDiacriticsOnCharacters - ) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - return this; - } - - /** - * List of characters that the engine shouldn't automatically normalize. - * - * @return keepDiacriticsOnCharacters - */ - @javax.annotation.Nullable - public String getKeepDiacriticsOnCharacters() { - return keepDiacriticsOnCharacters; - } - - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - } - - public SearchParams queryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - return this; - } - - public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { - if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList<>(); - } - this.queryLanguages.add(queryLanguagesItem); - return this; - } - - /** - * Sets the languages to be used by language-specific settings and functionalities such as - * ignorePlurals, removeStopWords, and CJK word-detection. - * - * @return queryLanguages - */ - @javax.annotation.Nullable - public List getQueryLanguages() { - return queryLanguages; - } - - public void setQueryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - } - - public SearchParams decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - return this; - } - - /** - * Splits compound words into their composing atoms in the query. - * - * @return decompoundQuery - */ - @javax.annotation.Nullable - public Boolean getDecompoundQuery() { - return decompoundQuery; - } - - public void setDecompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - } - - public SearchParams enableRules(Boolean enableRules) { - this.enableRules = enableRules; - return this; - } - - /** - * Whether Rules should be globally enabled. - * - * @return enableRules - */ - @javax.annotation.Nullable - public Boolean getEnableRules() { - return enableRules; - } - - public void setEnableRules(Boolean enableRules) { - this.enableRules = enableRules; - } - - public SearchParams enablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - return this; - } - - /** - * Enable the Personalization feature. - * - * @return enablePersonalization - */ - @javax.annotation.Nullable - public Boolean getEnablePersonalization() { - return enablePersonalization; - } - - public void setEnablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - } - - public SearchParams queryType(QueryTypeEnum queryType) { - this.queryType = queryType; - return this; - } - - /** - * Controls if and how query words are interpreted as prefixes. - * - * @return queryType - */ - @javax.annotation.Nullable - public QueryTypeEnum getQueryType() { - return queryType; - } - - public void setQueryType(QueryTypeEnum queryType) { - this.queryType = queryType; - } - - public SearchParams removeWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - return this; - } - - /** - * Selects a strategy to remove words from the query when it doesn't match any hits. - * - * @return removeWordsIfNoResults - */ - @javax.annotation.Nullable - public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { - return removeWordsIfNoResults; - } - - public void setRemoveWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - } - - public SearchParams advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - return this; - } - - /** - * Enables the advanced query syntax. - * - * @return advancedSyntax - */ - @javax.annotation.Nullable - public Boolean getAdvancedSyntax() { - return advancedSyntax; - } - - public void setAdvancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - } - - public SearchParams optionalWords(List optionalWords) { - this.optionalWords = optionalWords; - return this; - } - - public SearchParams addOptionalWordsItem(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * A list of words that should be considered as optional when found in the query. - * - * @return optionalWords - */ - @javax.annotation.Nullable - public List getOptionalWords() { - return optionalWords; - } - - public void setOptionalWords(List optionalWords) { - this.optionalWords = optionalWords; - } - - public SearchParams disableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - return this; - } - - public SearchParams addDisableExactOnAttributesItem( - String disableExactOnAttributesItem - ) { - if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList<>(); - } - this.disableExactOnAttributes.add(disableExactOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable the exact ranking criterion. - * - * @return disableExactOnAttributes - */ - @javax.annotation.Nullable - public List getDisableExactOnAttributes() { - return disableExactOnAttributes; - } - - public void setDisableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - } - - public SearchParams exactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - return this; - } - - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - * - * @return exactOnSingleWordQuery - */ - @javax.annotation.Nullable - public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { - return exactOnSingleWordQuery; - } - - public void setExactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - } - - public SearchParams alternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - return this; - } - - public SearchParams addAlternativesAsExactItem( - AlternativesAsExactEnum alternativesAsExactItem - ) { - if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList<>(); - } - this.alternativesAsExact.add(alternativesAsExactItem); - return this; - } - - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - * - * @return alternativesAsExact - */ - @javax.annotation.Nullable - public List getAlternativesAsExact() { - return alternativesAsExact; - } - - public void setAlternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - } - - public SearchParams advancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - return this; - } - - public SearchParams addAdvancedSyntaxFeaturesItem( - AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem - ) { - if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList<>(); - } - this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); - return this; - } - - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is - * enabled. - * - * @return advancedSyntaxFeatures - */ - @javax.annotation.Nullable - public List getAdvancedSyntaxFeatures() { - return advancedSyntaxFeatures; - } - - public void setAdvancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - } - - public SearchParams distinct(Integer distinct) { - this.distinct = distinct; - return this; - } - - /** - * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 - * - * @return distinct - */ - @javax.annotation.Nullable - public Integer getDistinct() { - return distinct; - } - - public void setDistinct(Integer distinct) { - this.distinct = distinct; - } - - public SearchParams synonyms(Boolean synonyms) { - this.synonyms = synonyms; - return this; - } - - /** - * Whether to take into account an index's synonyms for a particular search. - * - * @return synonyms - */ - @javax.annotation.Nullable - public Boolean getSynonyms() { - return synonyms; - } - - public void setSynonyms(Boolean synonyms) { - this.synonyms = synonyms; - } - - public SearchParams replaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - return this; - } - - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym - * itself. - * - * @return replaceSynonymsInHighlight - */ - @javax.annotation.Nullable - public Boolean getReplaceSynonymsInHighlight() { - return replaceSynonymsInHighlight; - } - - public void setReplaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - } - - public SearchParams minProximity(Integer minProximity) { - this.minProximity = minProximity; - return this; - } - - /** - * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 - * - * @return minProximity - */ - @javax.annotation.Nullable - public Integer getMinProximity() { - return minProximity; - } - - public void setMinProximity(Integer minProximity) { - this.minProximity = minProximity; - } - - public SearchParams responseFields(List responseFields) { - this.responseFields = responseFields; - return this; - } - - public SearchParams addResponseFieldsItem(String responseFieldsItem) { - if (this.responseFields == null) { - this.responseFields = new ArrayList<>(); - } - this.responseFields.add(responseFieldsItem); - return this; - } - - /** - * Choose which fields to return in the API response. This parameters applies to search and browse - * queries. - * - * @return responseFields - */ - @javax.annotation.Nullable - public List getResponseFields() { - return responseFields; - } - - public void setResponseFields(List responseFields) { - this.responseFields = responseFields; - } - - public SearchParams maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet hits to return during a search for facet values. For performance - * reasons, the maximum allowed number of returned values is 100. maximum: 100 - * - * @return maxFacetHits - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - - public void setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - } - - public SearchParams attributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - return this; - } - - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select - * which searchable attribute is matched in the attribute ranking stage. - * - * @return attributeCriteriaComputedByMinProximity - */ - @javax.annotation.Nullable - public Boolean getAttributeCriteriaComputedByMinProximity() { - return attributeCriteriaComputedByMinProximity; - } - - public void setAttributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - } - - public SearchParams renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a - * default value and can be overridden via rules. - * - * @return renderingContent - */ - @javax.annotation.Nullable - public Object getRenderingContent() { - return renderingContent; - } - - public void setRenderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchParams searchParams = (SearchParams) o; - return ( - Objects.equals(this.params, searchParams.params) && - Objects.equals(this.similarQuery, searchParams.similarQuery) && - Objects.equals(this.filters, searchParams.filters) && - Objects.equals(this.facetFilters, searchParams.facetFilters) && - Objects.equals(this.optionalFilters, searchParams.optionalFilters) && - Objects.equals(this.numericFilters, searchParams.numericFilters) && - Objects.equals(this.tagFilters, searchParams.tagFilters) && - Objects.equals( - this.sumOrFiltersScores, - searchParams.sumOrFiltersScores - ) && - Objects.equals(this.facets, searchParams.facets) && - Objects.equals(this.maxValuesPerFacet, searchParams.maxValuesPerFacet) && - Objects.equals( - this.facetingAfterDistinct, - searchParams.facetingAfterDistinct - ) && - Objects.equals(this.sortFacetValuesBy, searchParams.sortFacetValuesBy) && - Objects.equals(this.page, searchParams.page) && - Objects.equals(this.offset, searchParams.offset) && - Objects.equals(this.length, searchParams.length) && - Objects.equals(this.aroundLatLng, searchParams.aroundLatLng) && - Objects.equals(this.aroundLatLngViaIP, searchParams.aroundLatLngViaIP) && - Objects.equals(this.aroundRadius, searchParams.aroundRadius) && - Objects.equals(this.aroundPrecision, searchParams.aroundPrecision) && - Objects.equals( - this.minimumAroundRadius, - searchParams.minimumAroundRadius - ) && - Objects.equals(this.insideBoundingBox, searchParams.insideBoundingBox) && - Objects.equals(this.insidePolygon, searchParams.insidePolygon) && - Objects.equals(this.naturalLanguages, searchParams.naturalLanguages) && - Objects.equals(this.ruleContexts, searchParams.ruleContexts) && - Objects.equals( - this.personalizationImpact, - searchParams.personalizationImpact - ) && - Objects.equals(this.userToken, searchParams.userToken) && - Objects.equals(this.getRankingInfo, searchParams.getRankingInfo) && - Objects.equals(this.clickAnalytics, searchParams.clickAnalytics) && - Objects.equals(this.analytics, searchParams.analytics) && - Objects.equals(this.analyticsTags, searchParams.analyticsTags) && - Objects.equals( - this.percentileComputation, - searchParams.percentileComputation - ) && - Objects.equals(this.enableABTest, searchParams.enableABTest) && - Objects.equals(this.enableReRanking, searchParams.enableReRanking) && - Objects.equals(this.query, searchParams.query) && - Objects.equals( - this.searchableAttributes, - searchParams.searchableAttributes - ) && - Objects.equals( - this.attributesForFaceting, - searchParams.attributesForFaceting - ) && - Objects.equals( - this.unretrievableAttributes, - searchParams.unretrievableAttributes - ) && - Objects.equals( - this.attributesToRetrieve, - searchParams.attributesToRetrieve - ) && - Objects.equals( - this.restrictSearchableAttributes, - searchParams.restrictSearchableAttributes - ) && - Objects.equals(this.ranking, searchParams.ranking) && - Objects.equals(this.customRanking, searchParams.customRanking) && - Objects.equals( - this.relevancyStrictness, - searchParams.relevancyStrictness - ) && - Objects.equals( - this.attributesToHighlight, - searchParams.attributesToHighlight - ) && - Objects.equals( - this.attributesToSnippet, - searchParams.attributesToSnippet - ) && - Objects.equals(this.highlightPreTag, searchParams.highlightPreTag) && - Objects.equals(this.highlightPostTag, searchParams.highlightPostTag) && - Objects.equals( - this.snippetEllipsisText, - searchParams.snippetEllipsisText - ) && - Objects.equals( - this.restrictHighlightAndSnippetArrays, - searchParams.restrictHighlightAndSnippetArrays - ) && - Objects.equals(this.hitsPerPage, searchParams.hitsPerPage) && - Objects.equals( - this.minWordSizefor1Typo, - searchParams.minWordSizefor1Typo - ) && - Objects.equals( - this.minWordSizefor2Typos, - searchParams.minWordSizefor2Typos - ) && - Objects.equals(this.typoTolerance, searchParams.typoTolerance) && - Objects.equals( - this.allowTyposOnNumericTokens, - searchParams.allowTyposOnNumericTokens - ) && - Objects.equals( - this.disableTypoToleranceOnAttributes, - searchParams.disableTypoToleranceOnAttributes - ) && - Objects.equals(this.separatorsToIndex, searchParams.separatorsToIndex) && - Objects.equals(this.ignorePlurals, searchParams.ignorePlurals) && - Objects.equals(this.removeStopWords, searchParams.removeStopWords) && - Objects.equals( - this.keepDiacriticsOnCharacters, - searchParams.keepDiacriticsOnCharacters - ) && - Objects.equals(this.queryLanguages, searchParams.queryLanguages) && - Objects.equals(this.decompoundQuery, searchParams.decompoundQuery) && - Objects.equals(this.enableRules, searchParams.enableRules) && - Objects.equals( - this.enablePersonalization, - searchParams.enablePersonalization - ) && - Objects.equals(this.queryType, searchParams.queryType) && - Objects.equals( - this.removeWordsIfNoResults, - searchParams.removeWordsIfNoResults - ) && - Objects.equals(this.advancedSyntax, searchParams.advancedSyntax) && - Objects.equals(this.optionalWords, searchParams.optionalWords) && - Objects.equals( - this.disableExactOnAttributes, - searchParams.disableExactOnAttributes - ) && - Objects.equals( - this.exactOnSingleWordQuery, - searchParams.exactOnSingleWordQuery - ) && - Objects.equals( - this.alternativesAsExact, - searchParams.alternativesAsExact - ) && - Objects.equals( - this.advancedSyntaxFeatures, - searchParams.advancedSyntaxFeatures - ) && - Objects.equals(this.distinct, searchParams.distinct) && - Objects.equals(this.synonyms, searchParams.synonyms) && - Objects.equals( - this.replaceSynonymsInHighlight, - searchParams.replaceSynonymsInHighlight - ) && - Objects.equals(this.minProximity, searchParams.minProximity) && - Objects.equals(this.responseFields, searchParams.responseFields) && - Objects.equals(this.maxFacetHits, searchParams.maxFacetHits) && - Objects.equals( - this.attributeCriteriaComputedByMinProximity, - searchParams.attributeCriteriaComputedByMinProximity - ) && - Objects.equals(this.renderingContent, searchParams.renderingContent) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - params, - similarQuery, - filters, - facetFilters, - optionalFilters, - numericFilters, - tagFilters, - sumOrFiltersScores, - facets, - maxValuesPerFacet, - facetingAfterDistinct, - sortFacetValuesBy, - page, - offset, - length, - aroundLatLng, - aroundLatLngViaIP, - aroundRadius, - aroundPrecision, - minimumAroundRadius, - insideBoundingBox, - insidePolygon, - naturalLanguages, - ruleContexts, - personalizationImpact, - userToken, - getRankingInfo, - clickAnalytics, - analytics, - analyticsTags, - percentileComputation, - enableABTest, - enableReRanking, - query, - searchableAttributes, - attributesForFaceting, - unretrievableAttributes, - attributesToRetrieve, - restrictSearchableAttributes, - ranking, - customRanking, - relevancyStrictness, - attributesToHighlight, - attributesToSnippet, - highlightPreTag, - highlightPostTag, - snippetEllipsisText, - restrictHighlightAndSnippetArrays, - hitsPerPage, - minWordSizefor1Typo, - minWordSizefor2Typos, - typoTolerance, - allowTyposOnNumericTokens, - disableTypoToleranceOnAttributes, - separatorsToIndex, - ignorePlurals, - removeStopWords, - keepDiacriticsOnCharacters, - queryLanguages, - decompoundQuery, - enableRules, - enablePersonalization, - queryType, - removeWordsIfNoResults, - advancedSyntax, - optionalWords, - disableExactOnAttributes, - exactOnSingleWordQuery, - alternativesAsExact, - advancedSyntaxFeatures, - distinct, - synonyms, - replaceSynonymsInHighlight, - minProximity, - responseFields, - maxFacetHits, - attributeCriteriaComputedByMinProximity, - renderingContent - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchParams {\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb - .append(" similarQuery: ") - .append(toIndentedString(similarQuery)) - .append("\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb - .append(" facetFilters: ") - .append(toIndentedString(facetFilters)) - .append("\n"); - sb - .append(" optionalFilters: ") - .append(toIndentedString(optionalFilters)) - .append("\n"); - sb - .append(" numericFilters: ") - .append(toIndentedString(numericFilters)) - .append("\n"); - sb - .append(" tagFilters: ") - .append(toIndentedString(tagFilters)) - .append("\n"); - sb - .append(" sumOrFiltersScores: ") - .append(toIndentedString(sumOrFiltersScores)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" maxValuesPerFacet: ") - .append(toIndentedString(maxValuesPerFacet)) - .append("\n"); - sb - .append(" facetingAfterDistinct: ") - .append(toIndentedString(facetingAfterDistinct)) - .append("\n"); - sb - .append(" sortFacetValuesBy: ") - .append(toIndentedString(sortFacetValuesBy)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" aroundLatLngViaIP: ") - .append(toIndentedString(aroundLatLngViaIP)) - .append("\n"); - sb - .append(" aroundRadius: ") - .append(toIndentedString(aroundRadius)) - .append("\n"); - sb - .append(" aroundPrecision: ") - .append(toIndentedString(aroundPrecision)) - .append("\n"); - sb - .append(" minimumAroundRadius: ") - .append(toIndentedString(minimumAroundRadius)) - .append("\n"); - sb - .append(" insideBoundingBox: ") - .append(toIndentedString(insideBoundingBox)) - .append("\n"); - sb - .append(" insidePolygon: ") - .append(toIndentedString(insidePolygon)) - .append("\n"); - sb - .append(" naturalLanguages: ") - .append(toIndentedString(naturalLanguages)) - .append("\n"); - sb - .append(" ruleContexts: ") - .append(toIndentedString(ruleContexts)) - .append("\n"); - sb - .append(" personalizationImpact: ") - .append(toIndentedString(personalizationImpact)) - .append("\n"); - sb - .append(" userToken: ") - .append(toIndentedString(userToken)) - .append("\n"); - sb - .append(" getRankingInfo: ") - .append(toIndentedString(getRankingInfo)) - .append("\n"); - sb - .append(" clickAnalytics: ") - .append(toIndentedString(clickAnalytics)) - .append("\n"); - sb - .append(" analytics: ") - .append(toIndentedString(analytics)) - .append("\n"); - sb - .append(" analyticsTags: ") - .append(toIndentedString(analyticsTags)) - .append("\n"); - sb - .append(" percentileComputation: ") - .append(toIndentedString(percentileComputation)) - .append("\n"); - sb - .append(" enableABTest: ") - .append(toIndentedString(enableABTest)) - .append("\n"); - sb - .append(" enableReRanking: ") - .append(toIndentedString(enableReRanking)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" searchableAttributes: ") - .append(toIndentedString(searchableAttributes)) - .append("\n"); - sb - .append(" attributesForFaceting: ") - .append(toIndentedString(attributesForFaceting)) - .append("\n"); - sb - .append(" unretrievableAttributes: ") - .append(toIndentedString(unretrievableAttributes)) - .append("\n"); - sb - .append(" attributesToRetrieve: ") - .append(toIndentedString(attributesToRetrieve)) - .append("\n"); - sb - .append(" restrictSearchableAttributes: ") - .append(toIndentedString(restrictSearchableAttributes)) - .append("\n"); - sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb - .append(" customRanking: ") - .append(toIndentedString(customRanking)) - .append("\n"); - sb - .append(" relevancyStrictness: ") - .append(toIndentedString(relevancyStrictness)) - .append("\n"); - sb - .append(" attributesToHighlight: ") - .append(toIndentedString(attributesToHighlight)) - .append("\n"); - sb - .append(" attributesToSnippet: ") - .append(toIndentedString(attributesToSnippet)) - .append("\n"); - sb - .append(" highlightPreTag: ") - .append(toIndentedString(highlightPreTag)) - .append("\n"); - sb - .append(" highlightPostTag: ") - .append(toIndentedString(highlightPostTag)) - .append("\n"); - sb - .append(" snippetEllipsisText: ") - .append(toIndentedString(snippetEllipsisText)) - .append("\n"); - sb - .append(" restrictHighlightAndSnippetArrays: ") - .append(toIndentedString(restrictHighlightAndSnippetArrays)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb - .append(" minWordSizefor1Typo: ") - .append(toIndentedString(minWordSizefor1Typo)) - .append("\n"); - sb - .append(" minWordSizefor2Typos: ") - .append(toIndentedString(minWordSizefor2Typos)) - .append("\n"); - sb - .append(" typoTolerance: ") - .append(toIndentedString(typoTolerance)) - .append("\n"); - sb - .append(" allowTyposOnNumericTokens: ") - .append(toIndentedString(allowTyposOnNumericTokens)) - .append("\n"); - sb - .append(" disableTypoToleranceOnAttributes: ") - .append(toIndentedString(disableTypoToleranceOnAttributes)) - .append("\n"); - sb - .append(" separatorsToIndex: ") - .append(toIndentedString(separatorsToIndex)) - .append("\n"); - sb - .append(" ignorePlurals: ") - .append(toIndentedString(ignorePlurals)) - .append("\n"); - sb - .append(" removeStopWords: ") - .append(toIndentedString(removeStopWords)) - .append("\n"); - sb - .append(" keepDiacriticsOnCharacters: ") - .append(toIndentedString(keepDiacriticsOnCharacters)) - .append("\n"); - sb - .append(" queryLanguages: ") - .append(toIndentedString(queryLanguages)) - .append("\n"); - sb - .append(" decompoundQuery: ") - .append(toIndentedString(decompoundQuery)) - .append("\n"); - sb - .append(" enableRules: ") - .append(toIndentedString(enableRules)) - .append("\n"); - sb - .append(" enablePersonalization: ") - .append(toIndentedString(enablePersonalization)) - .append("\n"); - sb - .append(" queryType: ") - .append(toIndentedString(queryType)) - .append("\n"); - sb - .append(" removeWordsIfNoResults: ") - .append(toIndentedString(removeWordsIfNoResults)) - .append("\n"); - sb - .append(" advancedSyntax: ") - .append(toIndentedString(advancedSyntax)) - .append("\n"); - sb - .append(" optionalWords: ") - .append(toIndentedString(optionalWords)) - .append("\n"); - sb - .append(" disableExactOnAttributes: ") - .append(toIndentedString(disableExactOnAttributes)) - .append("\n"); - sb - .append(" exactOnSingleWordQuery: ") - .append(toIndentedString(exactOnSingleWordQuery)) - .append("\n"); - sb - .append(" alternativesAsExact: ") - .append(toIndentedString(alternativesAsExact)) - .append("\n"); - sb - .append(" advancedSyntaxFeatures: ") - .append(toIndentedString(advancedSyntaxFeatures)) - .append("\n"); - sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb - .append(" replaceSynonymsInHighlight: ") - .append(toIndentedString(replaceSynonymsInHighlight)) - .append("\n"); - sb - .append(" minProximity: ") - .append(toIndentedString(minProximity)) - .append("\n"); - sb - .append(" responseFields: ") - .append(toIndentedString(responseFields)) - .append("\n"); - sb - .append(" maxFacetHits: ") - .append(toIndentedString(maxFacetHits)) - .append("\n"); - sb - .append(" attributeCriteriaComputedByMinProximity: ") - .append(toIndentedString(attributeCriteriaComputedByMinProximity)) - .append("\n"); - sb - .append(" renderingContent: ") - .append(toIndentedString(renderingContent)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java deleted file mode 100644 index cd5ed538b5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java +++ /dev/null @@ -1,2945 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** SearchParamsObject */ -public class SearchParamsObject { - - @SerializedName("similarQuery") - private String similarQuery = ""; - - @SerializedName("filters") - private String filters = ""; - - @SerializedName("facetFilters") - private List facetFilters = null; - - @SerializedName("optionalFilters") - private List optionalFilters = null; - - @SerializedName("numericFilters") - private List numericFilters = null; - - @SerializedName("tagFilters") - private List tagFilters = null; - - @SerializedName("sumOrFiltersScores") - private Boolean sumOrFiltersScores = false; - - @SerializedName("facets") - private List facets = null; - - @SerializedName("maxValuesPerFacet") - private Integer maxValuesPerFacet = 100; - - @SerializedName("facetingAfterDistinct") - private Boolean facetingAfterDistinct = false; - - @SerializedName("sortFacetValuesBy") - private String sortFacetValuesBy = "count"; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("offset") - private Integer offset; - - @SerializedName("length") - private Integer length; - - @SerializedName("aroundLatLng") - private String aroundLatLng = ""; - - @SerializedName("aroundLatLngViaIP") - private Boolean aroundLatLngViaIP = false; - - @SerializedName("aroundRadius") - private OneOfintegerstring aroundRadius; - - @SerializedName("aroundPrecision") - private Integer aroundPrecision = 10; - - @SerializedName("minimumAroundRadius") - private Integer minimumAroundRadius; - - @SerializedName("insideBoundingBox") - private List insideBoundingBox = null; - - @SerializedName("insidePolygon") - private List insidePolygon = null; - - @SerializedName("naturalLanguages") - private List naturalLanguages = null; - - @SerializedName("ruleContexts") - private List ruleContexts = null; - - @SerializedName("personalizationImpact") - private Integer personalizationImpact = 100; - - @SerializedName("userToken") - private String userToken; - - @SerializedName("getRankingInfo") - private Boolean getRankingInfo = false; - - @SerializedName("clickAnalytics") - private Boolean clickAnalytics = false; - - @SerializedName("analytics") - private Boolean analytics = true; - - @SerializedName("analyticsTags") - private List analyticsTags = null; - - @SerializedName("percentileComputation") - private Boolean percentileComputation = true; - - @SerializedName("enableABTest") - private Boolean enableABTest = true; - - @SerializedName("enableReRanking") - private Boolean enableReRanking = true; - - @SerializedName("query") - private String query = ""; - - @SerializedName("searchableAttributes") - private List searchableAttributes = null; - - @SerializedName("attributesForFaceting") - private List attributesForFaceting = null; - - @SerializedName("unretrievableAttributes") - private List unretrievableAttributes = null; - - @SerializedName("attributesToRetrieve") - private List attributesToRetrieve = null; - - @SerializedName("restrictSearchableAttributes") - private List restrictSearchableAttributes = null; - - @SerializedName("ranking") - private List ranking = null; - - @SerializedName("customRanking") - private List customRanking = null; - - @SerializedName("relevancyStrictness") - private Integer relevancyStrictness = 100; - - @SerializedName("attributesToHighlight") - private List attributesToHighlight = null; - - @SerializedName("attributesToSnippet") - private List attributesToSnippet = null; - - @SerializedName("highlightPreTag") - private String highlightPreTag = ""; - - @SerializedName("highlightPostTag") - private String highlightPostTag = ""; - - @SerializedName("snippetEllipsisText") - private String snippetEllipsisText = "…"; - - @SerializedName("restrictHighlightAndSnippetArrays") - private Boolean restrictHighlightAndSnippetArrays = false; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("minWordSizefor1Typo") - private Integer minWordSizefor1Typo = 4; - - @SerializedName("minWordSizefor2Typos") - private Integer minWordSizefor2Typos = 8; - - /** Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) - public enum TypoToleranceEnum { - TRUE("true"), - - FALSE("false"), - - MIN("min"), - - STRICT("strict"); - - private String value; - - TypoToleranceEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static TypoToleranceEnum fromValue(String value) { - for (TypoToleranceEnum b : TypoToleranceEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } - } - - @SerializedName("typoTolerance") - private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - - @SerializedName("allowTyposOnNumericTokens") - private Boolean allowTyposOnNumericTokens = true; - - @SerializedName("disableTypoToleranceOnAttributes") - private List disableTypoToleranceOnAttributes = null; - - @SerializedName("separatorsToIndex") - private String separatorsToIndex = ""; - - @SerializedName("ignorePlurals") - private String ignorePlurals = "false"; - - @SerializedName("removeStopWords") - private String removeStopWords = "false"; - - @SerializedName("keepDiacriticsOnCharacters") - private String keepDiacriticsOnCharacters = ""; - - @SerializedName("queryLanguages") - private List queryLanguages = null; - - @SerializedName("decompoundQuery") - private Boolean decompoundQuery = true; - - @SerializedName("enableRules") - private Boolean enableRules = true; - - @SerializedName("enablePersonalization") - private Boolean enablePersonalization = false; - - /** Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) - public enum QueryTypeEnum { - PREFIXLAST("prefixLast"), - - PREFIXALL("prefixAll"), - - PREFIXNONE("prefixNone"); - - private String value; - - QueryTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static QueryTypeEnum fromValue(String value) { - for (QueryTypeEnum b : QueryTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } - } - - @SerializedName("queryType") - private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - - /** Selects a strategy to remove words from the query when it doesn't match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) - public enum RemoveWordsIfNoResultsEnum { - NONE("none"), - - LASTWORDS("lastWords"), - - FIRSTWORDS("firstWords"), - - ALLOPTIONAL("allOptional"); - - private String value; - - RemoveWordsIfNoResultsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RemoveWordsIfNoResultsEnum fromValue(String value) { - for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } - } - - @SerializedName("removeWordsIfNoResults") - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = - RemoveWordsIfNoResultsEnum.NONE; - - @SerializedName("advancedSyntax") - private Boolean advancedSyntax = false; - - @SerializedName("optionalWords") - private List optionalWords = null; - - @SerializedName("disableExactOnAttributes") - private List disableExactOnAttributes = null; - - /** Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) - public enum ExactOnSingleWordQueryEnum { - ATTRIBUTE("attribute"), - - NONE("none"), - - WORD("word"); - - private String value; - - ExactOnSingleWordQueryEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ExactOnSingleWordQueryEnum fromValue(String value) { - for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } - } - - @SerializedName("exactOnSingleWordQuery") - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = - ExactOnSingleWordQueryEnum.ATTRIBUTE; - - /** Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) - public enum AlternativesAsExactEnum { - IGNOREPLURALS("ignorePlurals"), - - SINGLEWORDSYNONYM("singleWordSynonym"), - - MULTIWORDSSYNONYM("multiWordsSynonym"); - - private String value; - - AlternativesAsExactEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AlternativesAsExactEnum fromValue(String value) { - for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } - } - - @SerializedName("alternativesAsExact") - private List alternativesAsExact = null; - - /** Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) - public enum AdvancedSyntaxFeaturesEnum { - EXACTPHRASE("exactPhrase"), - - EXCLUDEWORDS("excludeWords"); - - private String value; - - AdvancedSyntaxFeaturesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AdvancedSyntaxFeaturesEnum fromValue(String value) { - for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } - } - - @SerializedName("advancedSyntaxFeatures") - private List advancedSyntaxFeatures = null; - - @SerializedName("distinct") - private Integer distinct = 0; - - @SerializedName("synonyms") - private Boolean synonyms = true; - - @SerializedName("replaceSynonymsInHighlight") - private Boolean replaceSynonymsInHighlight = false; - - @SerializedName("minProximity") - private Integer minProximity = 1; - - @SerializedName("responseFields") - private List responseFields = null; - - @SerializedName("maxFacetHits") - private Integer maxFacetHits = 10; - - @SerializedName("attributeCriteriaComputedByMinProximity") - private Boolean attributeCriteriaComputedByMinProximity = false; - - @SerializedName("renderingContent") - private Object renderingContent = new Object(); - - public SearchParamsObject similarQuery(String similarQuery) { - this.similarQuery = similarQuery; - return this; - } - - /** - * Overrides the query parameter and performs a more generic search that can be used to find - * \"similar\" results. - * - * @return similarQuery - */ - @javax.annotation.Nullable - public String getSimilarQuery() { - return similarQuery; - } - - public void setSimilarQuery(String similarQuery) { - this.similarQuery = similarQuery; - } - - public SearchParamsObject filters(String filters) { - this.filters = filters; - return this; - } - - /** - * Filter the query with numeric, facet and/or tag filters. - * - * @return filters - */ - @javax.annotation.Nullable - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } - - public SearchParamsObject facetFilters(List facetFilters) { - this.facetFilters = facetFilters; - return this; - } - - public SearchParamsObject addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - - /** - * Filter hits by facet value. - * - * @return facetFilters - */ - @javax.annotation.Nullable - public List getFacetFilters() { - return facetFilters; - } - - public void setFacetFilters(List facetFilters) { - this.facetFilters = facetFilters; - } - - public SearchParamsObject optionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - return this; - } - - public SearchParamsObject addOptionalFiltersItem(String optionalFiltersItem) { - if (this.optionalFilters == null) { - this.optionalFilters = new ArrayList<>(); - } - this.optionalFilters.add(optionalFiltersItem); - return this; - } - - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or - * lower in the case of a negative optional filter. - * - * @return optionalFilters - */ - @javax.annotation.Nullable - public List getOptionalFilters() { - return optionalFilters; - } - - public void setOptionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; - } - - public SearchParamsObject numericFilters(List numericFilters) { - this.numericFilters = numericFilters; - return this; - } - - public SearchParamsObject addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - - /** - * Filter on numeric attributes. - * - * @return numericFilters - */ - @javax.annotation.Nullable - public List getNumericFilters() { - return numericFilters; - } - - public void setNumericFilters(List numericFilters) { - this.numericFilters = numericFilters; - } - - public SearchParamsObject tagFilters(List tagFilters) { - this.tagFilters = tagFilters; - return this; - } - - public SearchParamsObject addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - - /** - * Filter hits by tags. - * - * @return tagFilters - */ - @javax.annotation.Nullable - public List getTagFilters() { - return tagFilters; - } - - public void setTagFilters(List tagFilters) { - this.tagFilters = tagFilters; - } - - public SearchParamsObject sumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - return this; - } - - /** - * Determines how to calculate the total score for filtering. - * - * @return sumOrFiltersScores - */ - @javax.annotation.Nullable - public Boolean getSumOrFiltersScores() { - return sumOrFiltersScores; - } - - public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; - } - - public SearchParamsObject facets(List facets) { - this.facets = facets; - return this; - } - - public SearchParamsObject addFacetsItem(String facetsItem) { - if (this.facets == null) { - this.facets = new ArrayList<>(); - } - this.facets.add(facetsItem); - return this; - } - - /** - * Retrieve facets and their facet values. - * - * @return facets - */ - @javax.annotation.Nullable - public List getFacets() { - return facets; - } - - public void setFacets(List facets) { - this.facets = facets; - } - - public SearchParamsObject maxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - return this; - } - - /** - * Maximum number of facet values to return for each facet during a regular search. - * - * @return maxValuesPerFacet - */ - @javax.annotation.Nullable - public Integer getMaxValuesPerFacet() { - return maxValuesPerFacet; - } - - public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; - } - - public SearchParamsObject facetingAfterDistinct( - Boolean facetingAfterDistinct - ) { - this.facetingAfterDistinct = facetingAfterDistinct; - return this; - } - - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - * - * @return facetingAfterDistinct - */ - @javax.annotation.Nullable - public Boolean getFacetingAfterDistinct() { - return facetingAfterDistinct; - } - - public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; - } - - public SearchParamsObject sortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - return this; - } - - /** - * Controls how facet values are fetched. - * - * @return sortFacetValuesBy - */ - @javax.annotation.Nullable - public String getSortFacetValuesBy() { - return sortFacetValuesBy; - } - - public void setSortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; - } - - public SearchParamsObject page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchParamsObject offset(Integer offset) { - this.offset = offset; - return this; - } - - /** - * Specify the offset of the first hit to return. - * - * @return offset - */ - @javax.annotation.Nullable - public Integer getOffset() { - return offset; - } - - public void setOffset(Integer offset) { - this.offset = offset; - } - - public SearchParamsObject length(Integer length) { - this.length = length; - return this; - } - - /** - * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 - * - * @return length - */ - @javax.annotation.Nullable - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public SearchParamsObject aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public SearchParamsObject aroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - return this; - } - - /** - * Search for entries around a given location automatically computed from the requester's IP - * address. - * - * @return aroundLatLngViaIP - */ - @javax.annotation.Nullable - public Boolean getAroundLatLngViaIP() { - return aroundLatLngViaIP; - } - - public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; - } - - public SearchParamsObject aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - return this; - } - - /** - * Define the maximum radius for a geo search (in meters). - * - * @return aroundRadius - */ - @javax.annotation.Nullable - public OneOfintegerstring getAroundRadius() { - return aroundRadius; - } - - public void setAroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; - } - - public SearchParamsObject aroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - return this; - } - - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - * - * @return aroundPrecision - */ - @javax.annotation.Nullable - public Integer getAroundPrecision() { - return aroundPrecision; - } - - public void setAroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; - } - - public SearchParamsObject minimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - return this; - } - - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 - * - * @return minimumAroundRadius - */ - @javax.annotation.Nullable - public Integer getMinimumAroundRadius() { - return minimumAroundRadius; - } - - public void setMinimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; - } - - public SearchParamsObject insideBoundingBox( - List insideBoundingBox - ) { - this.insideBoundingBox = insideBoundingBox; - return this; - } - - public SearchParamsObject addInsideBoundingBoxItem( - BigDecimal insideBoundingBoxItem - ) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Search inside a rectangular area (in geo coordinates). - * - * @return insideBoundingBox - */ - @javax.annotation.Nullable - public List getInsideBoundingBox() { - return insideBoundingBox; - } - - public void setInsideBoundingBox(List insideBoundingBox) { - this.insideBoundingBox = insideBoundingBox; - } - - public SearchParamsObject insidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - return this; - } - - public SearchParamsObject addInsidePolygonItem(BigDecimal insidePolygonItem) { - if (this.insidePolygon == null) { - this.insidePolygon = new ArrayList<>(); - } - this.insidePolygon.add(insidePolygonItem); - return this; - } - - /** - * Search inside a polygon (in geo coordinates). - * - * @return insidePolygon - */ - @javax.annotation.Nullable - public List getInsidePolygon() { - return insidePolygon; - } - - public void setInsidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; - } - - public SearchParamsObject naturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - return this; - } - - public SearchParamsObject addNaturalLanguagesItem( - String naturalLanguagesItem - ) { - if (this.naturalLanguages == null) { - this.naturalLanguages = new ArrayList<>(); - } - this.naturalLanguages.add(naturalLanguagesItem); - return this; - } - - /** - * This parameter changes the default values of certain parameters and settings that work best for - * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, - * analyticsTags and ruleContexts. These parameters and settings work well together when the query - * is formatted in natural language instead of keywords, for example when your user performs a - * voice search. - * - * @return naturalLanguages - */ - @javax.annotation.Nullable - public List getNaturalLanguages() { - return naturalLanguages; - } - - public void setNaturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; - } - - public SearchParamsObject ruleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - return this; - } - - public SearchParamsObject addRuleContextsItem(String ruleContextsItem) { - if (this.ruleContexts == null) { - this.ruleContexts = new ArrayList<>(); - } - this.ruleContexts.add(ruleContextsItem); - return this; - } - - /** - * Enables contextual rules. - * - * @return ruleContexts - */ - @javax.annotation.Nullable - public List getRuleContexts() { - return ruleContexts; - } - - public void setRuleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; - } - - public SearchParamsObject personalizationImpact( - Integer personalizationImpact - ) { - this.personalizationImpact = personalizationImpact; - return this; - } - - /** - * Define the impact of the Personalization feature. - * - * @return personalizationImpact - */ - @javax.annotation.Nullable - public Integer getPersonalizationImpact() { - return personalizationImpact; - } - - public void setPersonalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; - } - - public SearchParamsObject userToken(String userToken) { - this.userToken = userToken; - return this; - } - - /** - * Associates a certain user token with the current search. - * - * @return userToken - */ - @javax.annotation.Nullable - public String getUserToken() { - return userToken; - } - - public void setUserToken(String userToken) { - this.userToken = userToken; - } - - public SearchParamsObject getRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - return this; - } - - /** - * Retrieve detailed ranking information. - * - * @return getRankingInfo - */ - @javax.annotation.Nullable - public Boolean getGetRankingInfo() { - return getRankingInfo; - } - - public void setGetRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; - } - - public SearchParamsObject clickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - return this; - } - - /** - * Enable the Click Analytics feature. - * - * @return clickAnalytics - */ - @javax.annotation.Nullable - public Boolean getClickAnalytics() { - return clickAnalytics; - } - - public void setClickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; - } - - public SearchParamsObject analytics(Boolean analytics) { - this.analytics = analytics; - return this; - } - - /** - * Whether the current query will be taken into account in the Analytics. - * - * @return analytics - */ - @javax.annotation.Nullable - public Boolean getAnalytics() { - return analytics; - } - - public void setAnalytics(Boolean analytics) { - this.analytics = analytics; - } - - public SearchParamsObject analyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - return this; - } - - public SearchParamsObject addAnalyticsTagsItem(String analyticsTagsItem) { - if (this.analyticsTags == null) { - this.analyticsTags = new ArrayList<>(); - } - this.analyticsTags.add(analyticsTagsItem); - return this; - } - - /** - * List of tags to apply to the query for analytics purposes. - * - * @return analyticsTags - */ - @javax.annotation.Nullable - public List getAnalyticsTags() { - return analyticsTags; - } - - public void setAnalyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; - } - - public SearchParamsObject percentileComputation( - Boolean percentileComputation - ) { - this.percentileComputation = percentileComputation; - return this; - } - - /** - * Whether to include or exclude a query from the processing-time percentile computation. - * - * @return percentileComputation - */ - @javax.annotation.Nullable - public Boolean getPercentileComputation() { - return percentileComputation; - } - - public void setPercentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; - } - - public SearchParamsObject enableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - return this; - } - - /** - * Whether this search should participate in running AB tests. - * - * @return enableABTest - */ - @javax.annotation.Nullable - public Boolean getEnableABTest() { - return enableABTest; - } - - public void setEnableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; - } - - public SearchParamsObject enableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - return this; - } - - /** - * Whether this search should use AI Re-Ranking. - * - * @return enableReRanking - */ - @javax.annotation.Nullable - public Boolean getEnableReRanking() { - return enableReRanking; - } - - public void setEnableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; - } - - public SearchParamsObject query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public SearchParamsObject searchableAttributes( - List searchableAttributes - ) { - this.searchableAttributes = searchableAttributes; - return this; - } - - public SearchParamsObject addSearchableAttributesItem( - String searchableAttributesItem - ) { - if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList<>(); - } - this.searchableAttributes.add(searchableAttributesItem); - return this; - } - - /** - * The complete list of attributes used for searching. - * - * @return searchableAttributes - */ - @javax.annotation.Nullable - public List getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public SearchParamsObject attributesForFaceting( - List attributesForFaceting - ) { - this.attributesForFaceting = attributesForFaceting; - return this; - } - - public SearchParamsObject addAttributesForFacetingItem( - String attributesForFacetingItem - ) { - if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList<>(); - } - this.attributesForFaceting.add(attributesForFacetingItem); - return this; - } - - /** - * The complete list of attributes that will be used for faceting. - * - * @return attributesForFaceting - */ - @javax.annotation.Nullable - public List getAttributesForFaceting() { - return attributesForFaceting; - } - - public void setAttributesForFaceting(List attributesForFaceting) { - this.attributesForFaceting = attributesForFaceting; - } - - public SearchParamsObject unretrievableAttributes( - List unretrievableAttributes - ) { - this.unretrievableAttributes = unretrievableAttributes; - return this; - } - - public SearchParamsObject addUnretrievableAttributesItem( - String unretrievableAttributesItem - ) { - if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList<>(); - } - this.unretrievableAttributes.add(unretrievableAttributesItem); - return this; - } - - /** - * List of attributes that can't be retrieved at query time. - * - * @return unretrievableAttributes - */ - @javax.annotation.Nullable - public List getUnretrievableAttributes() { - return unretrievableAttributes; - } - - public void setUnretrievableAttributes(List unretrievableAttributes) { - this.unretrievableAttributes = unretrievableAttributes; - } - - public SearchParamsObject attributesToRetrieve( - List attributesToRetrieve - ) { - this.attributesToRetrieve = attributesToRetrieve; - return this; - } - - public SearchParamsObject addAttributesToRetrieveItem( - String attributesToRetrieveItem - ) { - if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList<>(); - } - this.attributesToRetrieve.add(attributesToRetrieveItem); - return this; - } - - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - * - * @return attributesToRetrieve - */ - @javax.annotation.Nullable - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public void setAttributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; - } - - public SearchParamsObject restrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - return this; - } - - public SearchParamsObject addRestrictSearchableAttributesItem( - String restrictSearchableAttributesItem - ) { - if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList<>(); - } - this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); - return this; - } - - /** - * Restricts a given query to look in only a subset of your searchable attributes. - * - * @return restrictSearchableAttributes - */ - @javax.annotation.Nullable - public List getRestrictSearchableAttributes() { - return restrictSearchableAttributes; - } - - public void setRestrictSearchableAttributes( - List restrictSearchableAttributes - ) { - this.restrictSearchableAttributes = restrictSearchableAttributes; - } - - public SearchParamsObject ranking(List ranking) { - this.ranking = ranking; - return this; - } - - public SearchParamsObject addRankingItem(String rankingItem) { - if (this.ranking == null) { - this.ranking = new ArrayList<>(); - } - this.ranking.add(rankingItem); - return this; - } - - /** - * Controls how Algolia should sort your results. - * - * @return ranking - */ - @javax.annotation.Nullable - public List getRanking() { - return ranking; - } - - public void setRanking(List ranking) { - this.ranking = ranking; - } - - public SearchParamsObject customRanking(List customRanking) { - this.customRanking = customRanking; - return this; - } - - public SearchParamsObject addCustomRankingItem(String customRankingItem) { - if (this.customRanking == null) { - this.customRanking = new ArrayList<>(); - } - this.customRanking.add(customRankingItem); - return this; - } - - /** - * Specifies the custom ranking criterion. - * - * @return customRanking - */ - @javax.annotation.Nullable - public List getCustomRanking() { - return customRanking; - } - - public void setCustomRanking(List customRanking) { - this.customRanking = customRanking; - } - - public SearchParamsObject relevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - return this; - } - - /** - * Controls the relevancy threshold below which less relevant results aren't included in the - * results. - * - * @return relevancyStrictness - */ - @javax.annotation.Nullable - public Integer getRelevancyStrictness() { - return relevancyStrictness; - } - - public void setRelevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; - } - - public SearchParamsObject attributesToHighlight( - List attributesToHighlight - ) { - this.attributesToHighlight = attributesToHighlight; - return this; - } - - public SearchParamsObject addAttributesToHighlightItem( - String attributesToHighlightItem - ) { - if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList<>(); - } - this.attributesToHighlight.add(attributesToHighlightItem); - return this; - } - - /** - * List of attributes to highlight. - * - * @return attributesToHighlight - */ - @javax.annotation.Nullable - public List getAttributesToHighlight() { - return attributesToHighlight; - } - - public void setAttributesToHighlight(List attributesToHighlight) { - this.attributesToHighlight = attributesToHighlight; - } - - public SearchParamsObject attributesToSnippet( - List attributesToSnippet - ) { - this.attributesToSnippet = attributesToSnippet; - return this; - } - - public SearchParamsObject addAttributesToSnippetItem( - String attributesToSnippetItem - ) { - if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList<>(); - } - this.attributesToSnippet.add(attributesToSnippetItem); - return this; - } - - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - * - * @return attributesToSnippet - */ - @javax.annotation.Nullable - public List getAttributesToSnippet() { - return attributesToSnippet; - } - - public void setAttributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; - } - - public SearchParamsObject highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - return this; - } - - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - * - * @return highlightPreTag - */ - @javax.annotation.Nullable - public String getHighlightPreTag() { - return highlightPreTag; - } - - public void setHighlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; - } - - public SearchParamsObject highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - return this; - } - - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - * - * @return highlightPostTag - */ - @javax.annotation.Nullable - public String getHighlightPostTag() { - return highlightPostTag; - } - - public void setHighlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; - } - - public SearchParamsObject snippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - return this; - } - - /** - * String used as an ellipsis indicator when a snippet is truncated. - * - * @return snippetEllipsisText - */ - @javax.annotation.Nullable - public String getSnippetEllipsisText() { - return snippetEllipsisText; - } - - public void setSnippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; - } - - public SearchParamsObject restrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - return this; - } - - /** - * Restrict highlighting and snippeting to items that matched the query. - * - * @return restrictHighlightAndSnippetArrays - */ - @javax.annotation.Nullable - public Boolean getRestrictHighlightAndSnippetArrays() { - return restrictHighlightAndSnippetArrays; - } - - public void setRestrictHighlightAndSnippetArrays( - Boolean restrictHighlightAndSnippetArrays - ) { - this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; - } - - public SearchParamsObject hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public SearchParamsObject minWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 - * typo. - * - * @return minWordSizefor1Typo - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor1Typo() { - return minWordSizefor1Typo; - } - - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; - } - - public SearchParamsObject minWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - return this; - } - - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 - * typos. - * - * @return minWordSizefor2Typos - */ - @javax.annotation.Nullable - public Integer getMinWordSizefor2Typos() { - return minWordSizefor2Typos; - } - - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; - } - - public SearchParamsObject typoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - return this; - } - - /** - * Controls whether typo tolerance is enabled and how it is applied. - * - * @return typoTolerance - */ - @javax.annotation.Nullable - public TypoToleranceEnum getTypoTolerance() { - return typoTolerance; - } - - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; - } - - public SearchParamsObject allowTyposOnNumericTokens( - Boolean allowTyposOnNumericTokens - ) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - return this; - } - - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - * - * @return allowTyposOnNumericTokens - */ - @javax.annotation.Nullable - public Boolean getAllowTyposOnNumericTokens() { - return allowTyposOnNumericTokens; - } - - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; - } - - public SearchParamsObject disableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - return this; - } - - public SearchParamsObject addDisableTypoToleranceOnAttributesItem( - String disableTypoToleranceOnAttributesItem - ) { - if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList<>(); - } - this.disableTypoToleranceOnAttributes.add( - disableTypoToleranceOnAttributesItem - ); - return this; - } - - /** - * List of attributes on which you want to disable typo tolerance. - * - * @return disableTypoToleranceOnAttributes - */ - @javax.annotation.Nullable - public List getDisableTypoToleranceOnAttributes() { - return disableTypoToleranceOnAttributes; - } - - public void setDisableTypoToleranceOnAttributes( - List disableTypoToleranceOnAttributes - ) { - this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; - } - - public SearchParamsObject separatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - return this; - } - - /** - * Control which separators are indexed. - * - * @return separatorsToIndex - */ - @javax.annotation.Nullable - public String getSeparatorsToIndex() { - return separatorsToIndex; - } - - public void setSeparatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; - } - - public SearchParamsObject ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - return this; - } - - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - * - * @return ignorePlurals - */ - @javax.annotation.Nullable - public String getIgnorePlurals() { - return ignorePlurals; - } - - public void setIgnorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; - } - - public SearchParamsObject removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - return this; - } - - /** - * Removes stop (common) words from the query before executing it. - * - * @return removeStopWords - */ - @javax.annotation.Nullable - public String getRemoveStopWords() { - return removeStopWords; - } - - public void setRemoveStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; - } - - public SearchParamsObject keepDiacriticsOnCharacters( - String keepDiacriticsOnCharacters - ) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - return this; - } - - /** - * List of characters that the engine shouldn't automatically normalize. - * - * @return keepDiacriticsOnCharacters - */ - @javax.annotation.Nullable - public String getKeepDiacriticsOnCharacters() { - return keepDiacriticsOnCharacters; - } - - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; - } - - public SearchParamsObject queryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - return this; - } - - public SearchParamsObject addQueryLanguagesItem(String queryLanguagesItem) { - if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList<>(); - } - this.queryLanguages.add(queryLanguagesItem); - return this; - } - - /** - * Sets the languages to be used by language-specific settings and functionalities such as - * ignorePlurals, removeStopWords, and CJK word-detection. - * - * @return queryLanguages - */ - @javax.annotation.Nullable - public List getQueryLanguages() { - return queryLanguages; - } - - public void setQueryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; - } - - public SearchParamsObject decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - return this; - } - - /** - * Splits compound words into their composing atoms in the query. - * - * @return decompoundQuery - */ - @javax.annotation.Nullable - public Boolean getDecompoundQuery() { - return decompoundQuery; - } - - public void setDecompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; - } - - public SearchParamsObject enableRules(Boolean enableRules) { - this.enableRules = enableRules; - return this; - } - - /** - * Whether Rules should be globally enabled. - * - * @return enableRules - */ - @javax.annotation.Nullable - public Boolean getEnableRules() { - return enableRules; - } - - public void setEnableRules(Boolean enableRules) { - this.enableRules = enableRules; - } - - public SearchParamsObject enablePersonalization( - Boolean enablePersonalization - ) { - this.enablePersonalization = enablePersonalization; - return this; - } - - /** - * Enable the Personalization feature. - * - * @return enablePersonalization - */ - @javax.annotation.Nullable - public Boolean getEnablePersonalization() { - return enablePersonalization; - } - - public void setEnablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; - } - - public SearchParamsObject queryType(QueryTypeEnum queryType) { - this.queryType = queryType; - return this; - } - - /** - * Controls if and how query words are interpreted as prefixes. - * - * @return queryType - */ - @javax.annotation.Nullable - public QueryTypeEnum getQueryType() { - return queryType; - } - - public void setQueryType(QueryTypeEnum queryType) { - this.queryType = queryType; - } - - public SearchParamsObject removeWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - return this; - } - - /** - * Selects a strategy to remove words from the query when it doesn't match any hits. - * - * @return removeWordsIfNoResults - */ - @javax.annotation.Nullable - public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { - return removeWordsIfNoResults; - } - - public void setRemoveWordsIfNoResults( - RemoveWordsIfNoResultsEnum removeWordsIfNoResults - ) { - this.removeWordsIfNoResults = removeWordsIfNoResults; - } - - public SearchParamsObject advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - return this; - } - - /** - * Enables the advanced query syntax. - * - * @return advancedSyntax - */ - @javax.annotation.Nullable - public Boolean getAdvancedSyntax() { - return advancedSyntax; - } - - public void setAdvancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; - } - - public SearchParamsObject optionalWords(List optionalWords) { - this.optionalWords = optionalWords; - return this; - } - - public SearchParamsObject addOptionalWordsItem(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * A list of words that should be considered as optional when found in the query. - * - * @return optionalWords - */ - @javax.annotation.Nullable - public List getOptionalWords() { - return optionalWords; - } - - public void setOptionalWords(List optionalWords) { - this.optionalWords = optionalWords; - } - - public SearchParamsObject disableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - return this; - } - - public SearchParamsObject addDisableExactOnAttributesItem( - String disableExactOnAttributesItem - ) { - if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList<>(); - } - this.disableExactOnAttributes.add(disableExactOnAttributesItem); - return this; - } - - /** - * List of attributes on which you want to disable the exact ranking criterion. - * - * @return disableExactOnAttributes - */ - @javax.annotation.Nullable - public List getDisableExactOnAttributes() { - return disableExactOnAttributes; - } - - public void setDisableExactOnAttributes( - List disableExactOnAttributes - ) { - this.disableExactOnAttributes = disableExactOnAttributes; - } - - public SearchParamsObject exactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - return this; - } - - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - * - * @return exactOnSingleWordQuery - */ - @javax.annotation.Nullable - public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { - return exactOnSingleWordQuery; - } - - public void setExactOnSingleWordQuery( - ExactOnSingleWordQueryEnum exactOnSingleWordQuery - ) { - this.exactOnSingleWordQuery = exactOnSingleWordQuery; - } - - public SearchParamsObject alternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - return this; - } - - public SearchParamsObject addAlternativesAsExactItem( - AlternativesAsExactEnum alternativesAsExactItem - ) { - if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList<>(); - } - this.alternativesAsExact.add(alternativesAsExactItem); - return this; - } - - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - * - * @return alternativesAsExact - */ - @javax.annotation.Nullable - public List getAlternativesAsExact() { - return alternativesAsExact; - } - - public void setAlternativesAsExact( - List alternativesAsExact - ) { - this.alternativesAsExact = alternativesAsExact; - } - - public SearchParamsObject advancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - return this; - } - - public SearchParamsObject addAdvancedSyntaxFeaturesItem( - AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem - ) { - if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList<>(); - } - this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); - return this; - } - - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is - * enabled. - * - * @return advancedSyntaxFeatures - */ - @javax.annotation.Nullable - public List getAdvancedSyntaxFeatures() { - return advancedSyntaxFeatures; - } - - public void setAdvancedSyntaxFeatures( - List advancedSyntaxFeatures - ) { - this.advancedSyntaxFeatures = advancedSyntaxFeatures; - } - - public SearchParamsObject distinct(Integer distinct) { - this.distinct = distinct; - return this; - } - - /** - * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 - * - * @return distinct - */ - @javax.annotation.Nullable - public Integer getDistinct() { - return distinct; - } - - public void setDistinct(Integer distinct) { - this.distinct = distinct; - } - - public SearchParamsObject synonyms(Boolean synonyms) { - this.synonyms = synonyms; - return this; - } - - /** - * Whether to take into account an index's synonyms for a particular search. - * - * @return synonyms - */ - @javax.annotation.Nullable - public Boolean getSynonyms() { - return synonyms; - } - - public void setSynonyms(Boolean synonyms) { - this.synonyms = synonyms; - } - - public SearchParamsObject replaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - return this; - } - - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym - * itself. - * - * @return replaceSynonymsInHighlight - */ - @javax.annotation.Nullable - public Boolean getReplaceSynonymsInHighlight() { - return replaceSynonymsInHighlight; - } - - public void setReplaceSynonymsInHighlight( - Boolean replaceSynonymsInHighlight - ) { - this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; - } - - public SearchParamsObject minProximity(Integer minProximity) { - this.minProximity = minProximity; - return this; - } - - /** - * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 - * - * @return minProximity - */ - @javax.annotation.Nullable - public Integer getMinProximity() { - return minProximity; - } - - public void setMinProximity(Integer minProximity) { - this.minProximity = minProximity; - } - - public SearchParamsObject responseFields(List responseFields) { - this.responseFields = responseFields; - return this; - } - - public SearchParamsObject addResponseFieldsItem(String responseFieldsItem) { - if (this.responseFields == null) { - this.responseFields = new ArrayList<>(); - } - this.responseFields.add(responseFieldsItem); - return this; - } - - /** - * Choose which fields to return in the API response. This parameters applies to search and browse - * queries. - * - * @return responseFields - */ - @javax.annotation.Nullable - public List getResponseFields() { - return responseFields; - } - - public void setResponseFields(List responseFields) { - this.responseFields = responseFields; - } - - public SearchParamsObject maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet hits to return during a search for facet values. For performance - * reasons, the maximum allowed number of returned values is 100. maximum: 100 - * - * @return maxFacetHits - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - - public void setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - } - - public SearchParamsObject attributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - return this; - } - - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select - * which searchable attribute is matched in the attribute ranking stage. - * - * @return attributeCriteriaComputedByMinProximity - */ - @javax.annotation.Nullable - public Boolean getAttributeCriteriaComputedByMinProximity() { - return attributeCriteriaComputedByMinProximity; - } - - public void setAttributeCriteriaComputedByMinProximity( - Boolean attributeCriteriaComputedByMinProximity - ) { - this.attributeCriteriaComputedByMinProximity = - attributeCriteriaComputedByMinProximity; - } - - public SearchParamsObject renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - return this; - } - - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a - * default value and can be overridden via rules. - * - * @return renderingContent - */ - @javax.annotation.Nullable - public Object getRenderingContent() { - return renderingContent; - } - - public void setRenderingContent(Object renderingContent) { - this.renderingContent = renderingContent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchParamsObject searchParamsObject = (SearchParamsObject) o; - return ( - Objects.equals(this.similarQuery, searchParamsObject.similarQuery) && - Objects.equals(this.filters, searchParamsObject.filters) && - Objects.equals(this.facetFilters, searchParamsObject.facetFilters) && - Objects.equals( - this.optionalFilters, - searchParamsObject.optionalFilters - ) && - Objects.equals(this.numericFilters, searchParamsObject.numericFilters) && - Objects.equals(this.tagFilters, searchParamsObject.tagFilters) && - Objects.equals( - this.sumOrFiltersScores, - searchParamsObject.sumOrFiltersScores - ) && - Objects.equals(this.facets, searchParamsObject.facets) && - Objects.equals( - this.maxValuesPerFacet, - searchParamsObject.maxValuesPerFacet - ) && - Objects.equals( - this.facetingAfterDistinct, - searchParamsObject.facetingAfterDistinct - ) && - Objects.equals( - this.sortFacetValuesBy, - searchParamsObject.sortFacetValuesBy - ) && - Objects.equals(this.page, searchParamsObject.page) && - Objects.equals(this.offset, searchParamsObject.offset) && - Objects.equals(this.length, searchParamsObject.length) && - Objects.equals(this.aroundLatLng, searchParamsObject.aroundLatLng) && - Objects.equals( - this.aroundLatLngViaIP, - searchParamsObject.aroundLatLngViaIP - ) && - Objects.equals(this.aroundRadius, searchParamsObject.aroundRadius) && - Objects.equals( - this.aroundPrecision, - searchParamsObject.aroundPrecision - ) && - Objects.equals( - this.minimumAroundRadius, - searchParamsObject.minimumAroundRadius - ) && - Objects.equals( - this.insideBoundingBox, - searchParamsObject.insideBoundingBox - ) && - Objects.equals(this.insidePolygon, searchParamsObject.insidePolygon) && - Objects.equals( - this.naturalLanguages, - searchParamsObject.naturalLanguages - ) && - Objects.equals(this.ruleContexts, searchParamsObject.ruleContexts) && - Objects.equals( - this.personalizationImpact, - searchParamsObject.personalizationImpact - ) && - Objects.equals(this.userToken, searchParamsObject.userToken) && - Objects.equals(this.getRankingInfo, searchParamsObject.getRankingInfo) && - Objects.equals(this.clickAnalytics, searchParamsObject.clickAnalytics) && - Objects.equals(this.analytics, searchParamsObject.analytics) && - Objects.equals(this.analyticsTags, searchParamsObject.analyticsTags) && - Objects.equals( - this.percentileComputation, - searchParamsObject.percentileComputation - ) && - Objects.equals(this.enableABTest, searchParamsObject.enableABTest) && - Objects.equals( - this.enableReRanking, - searchParamsObject.enableReRanking - ) && - Objects.equals(this.query, searchParamsObject.query) && - Objects.equals( - this.searchableAttributes, - searchParamsObject.searchableAttributes - ) && - Objects.equals( - this.attributesForFaceting, - searchParamsObject.attributesForFaceting - ) && - Objects.equals( - this.unretrievableAttributes, - searchParamsObject.unretrievableAttributes - ) && - Objects.equals( - this.attributesToRetrieve, - searchParamsObject.attributesToRetrieve - ) && - Objects.equals( - this.restrictSearchableAttributes, - searchParamsObject.restrictSearchableAttributes - ) && - Objects.equals(this.ranking, searchParamsObject.ranking) && - Objects.equals(this.customRanking, searchParamsObject.customRanking) && - Objects.equals( - this.relevancyStrictness, - searchParamsObject.relevancyStrictness - ) && - Objects.equals( - this.attributesToHighlight, - searchParamsObject.attributesToHighlight - ) && - Objects.equals( - this.attributesToSnippet, - searchParamsObject.attributesToSnippet - ) && - Objects.equals( - this.highlightPreTag, - searchParamsObject.highlightPreTag - ) && - Objects.equals( - this.highlightPostTag, - searchParamsObject.highlightPostTag - ) && - Objects.equals( - this.snippetEllipsisText, - searchParamsObject.snippetEllipsisText - ) && - Objects.equals( - this.restrictHighlightAndSnippetArrays, - searchParamsObject.restrictHighlightAndSnippetArrays - ) && - Objects.equals(this.hitsPerPage, searchParamsObject.hitsPerPage) && - Objects.equals( - this.minWordSizefor1Typo, - searchParamsObject.minWordSizefor1Typo - ) && - Objects.equals( - this.minWordSizefor2Typos, - searchParamsObject.minWordSizefor2Typos - ) && - Objects.equals(this.typoTolerance, searchParamsObject.typoTolerance) && - Objects.equals( - this.allowTyposOnNumericTokens, - searchParamsObject.allowTyposOnNumericTokens - ) && - Objects.equals( - this.disableTypoToleranceOnAttributes, - searchParamsObject.disableTypoToleranceOnAttributes - ) && - Objects.equals( - this.separatorsToIndex, - searchParamsObject.separatorsToIndex - ) && - Objects.equals(this.ignorePlurals, searchParamsObject.ignorePlurals) && - Objects.equals( - this.removeStopWords, - searchParamsObject.removeStopWords - ) && - Objects.equals( - this.keepDiacriticsOnCharacters, - searchParamsObject.keepDiacriticsOnCharacters - ) && - Objects.equals(this.queryLanguages, searchParamsObject.queryLanguages) && - Objects.equals( - this.decompoundQuery, - searchParamsObject.decompoundQuery - ) && - Objects.equals(this.enableRules, searchParamsObject.enableRules) && - Objects.equals( - this.enablePersonalization, - searchParamsObject.enablePersonalization - ) && - Objects.equals(this.queryType, searchParamsObject.queryType) && - Objects.equals( - this.removeWordsIfNoResults, - searchParamsObject.removeWordsIfNoResults - ) && - Objects.equals(this.advancedSyntax, searchParamsObject.advancedSyntax) && - Objects.equals(this.optionalWords, searchParamsObject.optionalWords) && - Objects.equals( - this.disableExactOnAttributes, - searchParamsObject.disableExactOnAttributes - ) && - Objects.equals( - this.exactOnSingleWordQuery, - searchParamsObject.exactOnSingleWordQuery - ) && - Objects.equals( - this.alternativesAsExact, - searchParamsObject.alternativesAsExact - ) && - Objects.equals( - this.advancedSyntaxFeatures, - searchParamsObject.advancedSyntaxFeatures - ) && - Objects.equals(this.distinct, searchParamsObject.distinct) && - Objects.equals(this.synonyms, searchParamsObject.synonyms) && - Objects.equals( - this.replaceSynonymsInHighlight, - searchParamsObject.replaceSynonymsInHighlight - ) && - Objects.equals(this.minProximity, searchParamsObject.minProximity) && - Objects.equals(this.responseFields, searchParamsObject.responseFields) && - Objects.equals(this.maxFacetHits, searchParamsObject.maxFacetHits) && - Objects.equals( - this.attributeCriteriaComputedByMinProximity, - searchParamsObject.attributeCriteriaComputedByMinProximity - ) && - Objects.equals(this.renderingContent, searchParamsObject.renderingContent) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - similarQuery, - filters, - facetFilters, - optionalFilters, - numericFilters, - tagFilters, - sumOrFiltersScores, - facets, - maxValuesPerFacet, - facetingAfterDistinct, - sortFacetValuesBy, - page, - offset, - length, - aroundLatLng, - aroundLatLngViaIP, - aroundRadius, - aroundPrecision, - minimumAroundRadius, - insideBoundingBox, - insidePolygon, - naturalLanguages, - ruleContexts, - personalizationImpact, - userToken, - getRankingInfo, - clickAnalytics, - analytics, - analyticsTags, - percentileComputation, - enableABTest, - enableReRanking, - query, - searchableAttributes, - attributesForFaceting, - unretrievableAttributes, - attributesToRetrieve, - restrictSearchableAttributes, - ranking, - customRanking, - relevancyStrictness, - attributesToHighlight, - attributesToSnippet, - highlightPreTag, - highlightPostTag, - snippetEllipsisText, - restrictHighlightAndSnippetArrays, - hitsPerPage, - minWordSizefor1Typo, - minWordSizefor2Typos, - typoTolerance, - allowTyposOnNumericTokens, - disableTypoToleranceOnAttributes, - separatorsToIndex, - ignorePlurals, - removeStopWords, - keepDiacriticsOnCharacters, - queryLanguages, - decompoundQuery, - enableRules, - enablePersonalization, - queryType, - removeWordsIfNoResults, - advancedSyntax, - optionalWords, - disableExactOnAttributes, - exactOnSingleWordQuery, - alternativesAsExact, - advancedSyntaxFeatures, - distinct, - synonyms, - replaceSynonymsInHighlight, - minProximity, - responseFields, - maxFacetHits, - attributeCriteriaComputedByMinProximity, - renderingContent - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchParamsObject {\n"); - sb - .append(" similarQuery: ") - .append(toIndentedString(similarQuery)) - .append("\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb - .append(" facetFilters: ") - .append(toIndentedString(facetFilters)) - .append("\n"); - sb - .append(" optionalFilters: ") - .append(toIndentedString(optionalFilters)) - .append("\n"); - sb - .append(" numericFilters: ") - .append(toIndentedString(numericFilters)) - .append("\n"); - sb - .append(" tagFilters: ") - .append(toIndentedString(tagFilters)) - .append("\n"); - sb - .append(" sumOrFiltersScores: ") - .append(toIndentedString(sumOrFiltersScores)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" maxValuesPerFacet: ") - .append(toIndentedString(maxValuesPerFacet)) - .append("\n"); - sb - .append(" facetingAfterDistinct: ") - .append(toIndentedString(facetingAfterDistinct)) - .append("\n"); - sb - .append(" sortFacetValuesBy: ") - .append(toIndentedString(sortFacetValuesBy)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" aroundLatLngViaIP: ") - .append(toIndentedString(aroundLatLngViaIP)) - .append("\n"); - sb - .append(" aroundRadius: ") - .append(toIndentedString(aroundRadius)) - .append("\n"); - sb - .append(" aroundPrecision: ") - .append(toIndentedString(aroundPrecision)) - .append("\n"); - sb - .append(" minimumAroundRadius: ") - .append(toIndentedString(minimumAroundRadius)) - .append("\n"); - sb - .append(" insideBoundingBox: ") - .append(toIndentedString(insideBoundingBox)) - .append("\n"); - sb - .append(" insidePolygon: ") - .append(toIndentedString(insidePolygon)) - .append("\n"); - sb - .append(" naturalLanguages: ") - .append(toIndentedString(naturalLanguages)) - .append("\n"); - sb - .append(" ruleContexts: ") - .append(toIndentedString(ruleContexts)) - .append("\n"); - sb - .append(" personalizationImpact: ") - .append(toIndentedString(personalizationImpact)) - .append("\n"); - sb - .append(" userToken: ") - .append(toIndentedString(userToken)) - .append("\n"); - sb - .append(" getRankingInfo: ") - .append(toIndentedString(getRankingInfo)) - .append("\n"); - sb - .append(" clickAnalytics: ") - .append(toIndentedString(clickAnalytics)) - .append("\n"); - sb - .append(" analytics: ") - .append(toIndentedString(analytics)) - .append("\n"); - sb - .append(" analyticsTags: ") - .append(toIndentedString(analyticsTags)) - .append("\n"); - sb - .append(" percentileComputation: ") - .append(toIndentedString(percentileComputation)) - .append("\n"); - sb - .append(" enableABTest: ") - .append(toIndentedString(enableABTest)) - .append("\n"); - sb - .append(" enableReRanking: ") - .append(toIndentedString(enableReRanking)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" searchableAttributes: ") - .append(toIndentedString(searchableAttributes)) - .append("\n"); - sb - .append(" attributesForFaceting: ") - .append(toIndentedString(attributesForFaceting)) - .append("\n"); - sb - .append(" unretrievableAttributes: ") - .append(toIndentedString(unretrievableAttributes)) - .append("\n"); - sb - .append(" attributesToRetrieve: ") - .append(toIndentedString(attributesToRetrieve)) - .append("\n"); - sb - .append(" restrictSearchableAttributes: ") - .append(toIndentedString(restrictSearchableAttributes)) - .append("\n"); - sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb - .append(" customRanking: ") - .append(toIndentedString(customRanking)) - .append("\n"); - sb - .append(" relevancyStrictness: ") - .append(toIndentedString(relevancyStrictness)) - .append("\n"); - sb - .append(" attributesToHighlight: ") - .append(toIndentedString(attributesToHighlight)) - .append("\n"); - sb - .append(" attributesToSnippet: ") - .append(toIndentedString(attributesToSnippet)) - .append("\n"); - sb - .append(" highlightPreTag: ") - .append(toIndentedString(highlightPreTag)) - .append("\n"); - sb - .append(" highlightPostTag: ") - .append(toIndentedString(highlightPostTag)) - .append("\n"); - sb - .append(" snippetEllipsisText: ") - .append(toIndentedString(snippetEllipsisText)) - .append("\n"); - sb - .append(" restrictHighlightAndSnippetArrays: ") - .append(toIndentedString(restrictHighlightAndSnippetArrays)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb - .append(" minWordSizefor1Typo: ") - .append(toIndentedString(minWordSizefor1Typo)) - .append("\n"); - sb - .append(" minWordSizefor2Typos: ") - .append(toIndentedString(minWordSizefor2Typos)) - .append("\n"); - sb - .append(" typoTolerance: ") - .append(toIndentedString(typoTolerance)) - .append("\n"); - sb - .append(" allowTyposOnNumericTokens: ") - .append(toIndentedString(allowTyposOnNumericTokens)) - .append("\n"); - sb - .append(" disableTypoToleranceOnAttributes: ") - .append(toIndentedString(disableTypoToleranceOnAttributes)) - .append("\n"); - sb - .append(" separatorsToIndex: ") - .append(toIndentedString(separatorsToIndex)) - .append("\n"); - sb - .append(" ignorePlurals: ") - .append(toIndentedString(ignorePlurals)) - .append("\n"); - sb - .append(" removeStopWords: ") - .append(toIndentedString(removeStopWords)) - .append("\n"); - sb - .append(" keepDiacriticsOnCharacters: ") - .append(toIndentedString(keepDiacriticsOnCharacters)) - .append("\n"); - sb - .append(" queryLanguages: ") - .append(toIndentedString(queryLanguages)) - .append("\n"); - sb - .append(" decompoundQuery: ") - .append(toIndentedString(decompoundQuery)) - .append("\n"); - sb - .append(" enableRules: ") - .append(toIndentedString(enableRules)) - .append("\n"); - sb - .append(" enablePersonalization: ") - .append(toIndentedString(enablePersonalization)) - .append("\n"); - sb - .append(" queryType: ") - .append(toIndentedString(queryType)) - .append("\n"); - sb - .append(" removeWordsIfNoResults: ") - .append(toIndentedString(removeWordsIfNoResults)) - .append("\n"); - sb - .append(" advancedSyntax: ") - .append(toIndentedString(advancedSyntax)) - .append("\n"); - sb - .append(" optionalWords: ") - .append(toIndentedString(optionalWords)) - .append("\n"); - sb - .append(" disableExactOnAttributes: ") - .append(toIndentedString(disableExactOnAttributes)) - .append("\n"); - sb - .append(" exactOnSingleWordQuery: ") - .append(toIndentedString(exactOnSingleWordQuery)) - .append("\n"); - sb - .append(" alternativesAsExact: ") - .append(toIndentedString(alternativesAsExact)) - .append("\n"); - sb - .append(" advancedSyntaxFeatures: ") - .append(toIndentedString(advancedSyntaxFeatures)) - .append("\n"); - sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb - .append(" replaceSynonymsInHighlight: ") - .append(toIndentedString(replaceSynonymsInHighlight)) - .append("\n"); - sb - .append(" minProximity: ") - .append(toIndentedString(minProximity)) - .append("\n"); - sb - .append(" responseFields: ") - .append(toIndentedString(responseFields)) - .append("\n"); - sb - .append(" maxFacetHits: ") - .append(toIndentedString(maxFacetHits)) - .append("\n"); - sb - .append(" attributeCriteriaComputedByMinProximity: ") - .append(toIndentedString(attributeCriteriaComputedByMinProximity)) - .append("\n"); - sb - .append(" renderingContent: ") - .append(toIndentedString(renderingContent)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java deleted file mode 100644 index 4f34f775f7..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SearchParamsString */ -public class SearchParamsString { - - @SerializedName("params") - private String params = ""; - - public SearchParamsString params(String params) { - this.params = params; - return this; - } - - /** - * Search parameters as URL-encoded query string. - * - * @return params - */ - @javax.annotation.Nullable - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchParamsString searchParamsString = (SearchParamsString) o; - return Objects.equals(this.params, searchParamsString.params); - } - - @Override - public int hashCode() { - return Objects.hash(params); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchParamsString {\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java deleted file mode 100644 index d4df3467a4..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ /dev/null @@ -1,759 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** SearchResponse */ -public class SearchResponse { - - @SerializedName("abTestID") - private Integer abTestID; - - @SerializedName("abTestVariantID") - private Integer abTestVariantID; - - @SerializedName("aroundLatLng") - private String aroundLatLng; - - @SerializedName("automaticRadius") - private String automaticRadius; - - @SerializedName("exhaustiveFacetsCount") - private Boolean exhaustiveFacetsCount; - - @SerializedName("exhaustiveNbHits") - private Boolean exhaustiveNbHits; - - @SerializedName("exhaustiveTypo") - private Boolean exhaustiveTypo; - - @SerializedName("facets") - private Map> facets = null; - - @SerializedName("facets_stats") - private Map facetsStats = null; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("index") - private String index; - - @SerializedName("indexUsed") - private String indexUsed; - - @SerializedName("message") - private String message; - - @SerializedName("nbHits") - private Integer nbHits; - - @SerializedName("nbPages") - private Integer nbPages; - - @SerializedName("nbSortedHits") - private Integer nbSortedHits; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("params") - private String params; - - @SerializedName("parsedQuery") - private String parsedQuery; - - @SerializedName("processingTimeMS") - private Integer processingTimeMS; - - @SerializedName("query") - private String query = ""; - - @SerializedName("queryAfterRemoval") - private String queryAfterRemoval; - - @SerializedName("serverUsed") - private String serverUsed; - - @SerializedName("userData") - private Object userData = new Object(); - - @SerializedName("hits") - private List hits = new ArrayList<>(); - - public SearchResponse abTestID(Integer abTestID) { - this.abTestID = abTestID; - return this; - } - - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test - * ID. - * - * @return abTestID - */ - @javax.annotation.Nullable - public Integer getAbTestID() { - return abTestID; - } - - public void setAbTestID(Integer abTestID) { - this.abTestID = abTestID; - } - - public SearchResponse abTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; - return this; - } - - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant - * ID of the index used. - * - * @return abTestVariantID - */ - @javax.annotation.Nullable - public Integer getAbTestVariantID() { - return abTestVariantID; - } - - public void setAbTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; - } - - public SearchResponse aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - return this; - } - - /** - * The computed geo location. - * - * @return aroundLatLng - */ - @javax.annotation.Nullable - public String getAroundLatLng() { - return aroundLatLng; - } - - public void setAroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; - } - - public SearchResponse automaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; - return this; - } - - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an - * integer. - * - * @return automaticRadius - */ - @javax.annotation.Nullable - public String getAutomaticRadius() { - return automaticRadius; - } - - public void setAutomaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; - } - - public SearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; - return this; - } - - /** - * Whether the facet count is exhaustive or approximate. - * - * @return exhaustiveFacetsCount - */ - @javax.annotation.Nullable - public Boolean getExhaustiveFacetsCount() { - return exhaustiveFacetsCount; - } - - public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; - } - - public SearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; - return this; - } - - /** - * Indicate if the nbHits count was exhaustive or approximate - * - * @return exhaustiveNbHits - */ - @javax.annotation.Nonnull - public Boolean getExhaustiveNbHits() { - return exhaustiveNbHits; - } - - public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; - } - - public SearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; - return this; - } - - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when - * typo-tolerance is enabled) - * - * @return exhaustiveTypo - */ - @javax.annotation.Nonnull - public Boolean getExhaustiveTypo() { - return exhaustiveTypo; - } - - public void setExhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; - } - - public SearchResponse facets(Map> facets) { - this.facets = facets; - return this; - } - - public SearchResponse putFacetsItem( - String key, - Map facetsItem - ) { - if (this.facets == null) { - this.facets = new HashMap<>(); - } - this.facets.put(key, facetsItem); - return this; - } - - /** - * A mapping of each facet name to the corresponding facet counts. - * - * @return facets - */ - @javax.annotation.Nullable - public Map> getFacets() { - return facets; - } - - public void setFacets(Map> facets) { - this.facets = facets; - } - - public SearchResponse facetsStats( - Map facetsStats - ) { - this.facetsStats = facetsStats; - return this; - } - - public SearchResponse putFacetsStatsItem( - String key, - BaseSearchResponseFacetsStats facetsStatsItem - ) { - if (this.facetsStats == null) { - this.facetsStats = new HashMap<>(); - } - this.facetsStats.put(key, facetsStatsItem); - return this; - } - - /** - * Statistics for numerical facets. - * - * @return facetsStats - */ - @javax.annotation.Nullable - public Map getFacetsStats() { - return facetsStats; - } - - public void setFacetsStats( - Map facetsStats - ) { - this.facetsStats = facetsStats; - } - - public SearchResponse hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public SearchResponse index(String index) { - this.index = index; - return this; - } - - /** - * Index name used for the query. - * - * @return index - */ - @javax.annotation.Nullable - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - - public SearchResponse indexUsed(String indexUsed) { - this.indexUsed = indexUsed; - return this; - } - - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn't always the - * index used by the query. - * - * @return indexUsed - */ - @javax.annotation.Nullable - public String getIndexUsed() { - return indexUsed; - } - - public void setIndexUsed(String indexUsed) { - this.indexUsed = indexUsed; - } - - public SearchResponse message(String message) { - this.message = message; - return this; - } - - /** - * Used to return warnings about the query. - * - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public SearchResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** - * Number of hits that the search query matched. - * - * @return nbHits - */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public void setNbHits(Integer nbHits) { - this.nbHits = nbHits; - } - - public SearchResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** - * Number of pages available for the current query - * - * @return nbPages - */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - - public void setNbPages(Integer nbPages) { - this.nbPages = nbPages; - } - - public SearchResponse nbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; - return this; - } - - /** - * The number of hits selected and sorted by the relevant sort algorithm - * - * @return nbSortedHits - */ - @javax.annotation.Nullable - public Integer getNbSortedHits() { - return nbSortedHits; - } - - public void setNbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; - } - - public SearchResponse page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchResponse params(String params) { - this.params = params; - return this; - } - - /** - * A url-encoded string of all search parameters. - * - * @return params - */ - @javax.annotation.Nonnull - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - public SearchResponse parsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; - return this; - } - - /** - * The query string that will be searched, after normalization. - * - * @return parsedQuery - */ - @javax.annotation.Nullable - public String getParsedQuery() { - return parsedQuery; - } - - public void setParsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; - } - - public SearchResponse processingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; - return this; - } - - /** - * Time the server took to process the request, in milliseconds. - * - * @return processingTimeMS - */ - @javax.annotation.Nonnull - public Integer getProcessingTimeMS() { - return processingTimeMS; - } - - public void setProcessingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; - } - - public SearchResponse query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public SearchResponse queryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; - return this; - } - - /** - * A markup text indicating which parts of the original query have been removed in order to - * retrieve a non-empty result set. - * - * @return queryAfterRemoval - */ - @javax.annotation.Nullable - public String getQueryAfterRemoval() { - return queryAfterRemoval; - } - - public void setQueryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; - } - - public SearchResponse serverUsed(String serverUsed) { - this.serverUsed = serverUsed; - return this; - } - - /** - * Actual host name of the server that processed the request. - * - * @return serverUsed - */ - @javax.annotation.Nullable - public String getServerUsed() { - return serverUsed; - } - - public void setServerUsed(String serverUsed) { - this.serverUsed = serverUsed; - } - - public SearchResponse userData(Object userData) { - this.userData = userData; - return this; - } - - /** - * Lets you store custom data in your indices. - * - * @return userData - */ - @javax.annotation.Nullable - public Object getUserData() { - return userData; - } - - public void setUserData(Object userData) { - this.userData = userData; - } - - public SearchResponse hits(List hits) { - this.hits = hits; - return this; - } - - public SearchResponse addHitsItem(Hit hitsItem) { - this.hits.add(hitsItem); - return this; - } - - /** - * Get hits - * - * @return hits - */ - @javax.annotation.Nonnull - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchResponse searchResponse = (SearchResponse) o; - return ( - Objects.equals(this.abTestID, searchResponse.abTestID) && - Objects.equals(this.abTestVariantID, searchResponse.abTestVariantID) && - Objects.equals(this.aroundLatLng, searchResponse.aroundLatLng) && - Objects.equals(this.automaticRadius, searchResponse.automaticRadius) && - Objects.equals( - this.exhaustiveFacetsCount, - searchResponse.exhaustiveFacetsCount - ) && - Objects.equals(this.exhaustiveNbHits, searchResponse.exhaustiveNbHits) && - Objects.equals(this.exhaustiveTypo, searchResponse.exhaustiveTypo) && - Objects.equals(this.facets, searchResponse.facets) && - Objects.equals(this.facetsStats, searchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, searchResponse.hitsPerPage) && - Objects.equals(this.index, searchResponse.index) && - Objects.equals(this.indexUsed, searchResponse.indexUsed) && - Objects.equals(this.message, searchResponse.message) && - Objects.equals(this.nbHits, searchResponse.nbHits) && - Objects.equals(this.nbPages, searchResponse.nbPages) && - Objects.equals(this.nbSortedHits, searchResponse.nbSortedHits) && - Objects.equals(this.page, searchResponse.page) && - Objects.equals(this.params, searchResponse.params) && - Objects.equals(this.parsedQuery, searchResponse.parsedQuery) && - Objects.equals(this.processingTimeMS, searchResponse.processingTimeMS) && - Objects.equals(this.query, searchResponse.query) && - Objects.equals( - this.queryAfterRemoval, - searchResponse.queryAfterRemoval - ) && - Objects.equals(this.serverUsed, searchResponse.serverUsed) && - Objects.equals(this.userData, searchResponse.userData) && - Objects.equals(this.hits, searchResponse.hits) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - abTestID, - abTestVariantID, - aroundLatLng, - automaticRadius, - exhaustiveFacetsCount, - exhaustiveNbHits, - exhaustiveTypo, - facets, - facetsStats, - hitsPerPage, - index, - indexUsed, - message, - nbHits, - nbPages, - nbSortedHits, - page, - params, - parsedQuery, - processingTimeMS, - query, - queryAfterRemoval, - serverUsed, - userData, - hits - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchResponse {\n"); - sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); - sb - .append(" abTestVariantID: ") - .append(toIndentedString(abTestVariantID)) - .append("\n"); - sb - .append(" aroundLatLng: ") - .append(toIndentedString(aroundLatLng)) - .append("\n"); - sb - .append(" automaticRadius: ") - .append(toIndentedString(automaticRadius)) - .append("\n"); - sb - .append(" exhaustiveFacetsCount: ") - .append(toIndentedString(exhaustiveFacetsCount)) - .append("\n"); - sb - .append(" exhaustiveNbHits: ") - .append(toIndentedString(exhaustiveNbHits)) - .append("\n"); - sb - .append(" exhaustiveTypo: ") - .append(toIndentedString(exhaustiveTypo)) - .append("\n"); - sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb - .append(" facetsStats: ") - .append(toIndentedString(facetsStats)) - .append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb.append(" index: ").append(toIndentedString(index)).append("\n"); - sb - .append(" indexUsed: ") - .append(toIndentedString(indexUsed)) - .append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb - .append(" nbSortedHits: ") - .append(toIndentedString(nbSortedHits)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb - .append(" parsedQuery: ") - .append(toIndentedString(parsedQuery)) - .append("\n"); - sb - .append(" processingTimeMS: ") - .append(toIndentedString(processingTimeMS)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" queryAfterRemoval: ") - .append(toIndentedString(queryAfterRemoval)) - .append("\n"); - sb - .append(" serverUsed: ") - .append(toIndentedString(serverUsed)) - .append("\n"); - sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesParams.java deleted file mode 100644 index 0d30a3cea0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesParams.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Parameters for the search. */ -public class SearchRulesParams { - - @SerializedName("query") - private String query = ""; - - @SerializedName("anchoring") - private Anchoring anchoring; - - @SerializedName("context") - private String context; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("enabled") - private Boolean enabled; - - @SerializedName("requestOptions") - private List requestOptions = null; - - public SearchRulesParams query(String query) { - this.query = query; - return this; - } - - /** - * Full text query. - * - * @return query - */ - @javax.annotation.Nullable - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public SearchRulesParams anchoring(Anchoring anchoring) { - this.anchoring = anchoring; - return this; - } - - /** - * Get anchoring - * - * @return anchoring - */ - @javax.annotation.Nullable - public Anchoring getAnchoring() { - return anchoring; - } - - public void setAnchoring(Anchoring anchoring) { - this.anchoring = anchoring; - } - - public SearchRulesParams context(String context) { - this.context = context; - return this; - } - - /** - * Restricts matches to contextual rules with a specific context (exact match). - * - * @return context - */ - @javax.annotation.Nullable - public String getContext() { - return context; - } - - public void setContext(String context) { - this.context = context; - } - - public SearchRulesParams page(Integer page) { - this.page = page; - return this; - } - - /** - * Requested page (zero-based). - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchRulesParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Maximum number of hits in a page. Minimum is 1, maximum is 1000. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public SearchRulesParams enabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * When specified, restricts matches to rules with a specific enabled status. When absent - * (default), all rules are retrieved, regardless of their enabled status. - * - * @return enabled - */ - @javax.annotation.Nullable - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public SearchRulesParams requestOptions(List requestOptions) { - this.requestOptions = requestOptions; - return this; - } - - public SearchRulesParams addRequestOptionsItem(Object requestOptionsItem) { - if (this.requestOptions == null) { - this.requestOptions = new ArrayList<>(); - } - this.requestOptions.add(requestOptionsItem); - return this; - } - - /** - * A mapping of requestOptions to send along with the request. - * - * @return requestOptions - */ - @javax.annotation.Nullable - public List getRequestOptions() { - return requestOptions; - } - - public void setRequestOptions(List requestOptions) { - this.requestOptions = requestOptions; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchRulesParams searchRulesParams = (SearchRulesParams) o; - return ( - Objects.equals(this.query, searchRulesParams.query) && - Objects.equals(this.anchoring, searchRulesParams.anchoring) && - Objects.equals(this.context, searchRulesParams.context) && - Objects.equals(this.page, searchRulesParams.page) && - Objects.equals(this.hitsPerPage, searchRulesParams.hitsPerPage) && - Objects.equals(this.enabled, searchRulesParams.enabled) && - Objects.equals(this.requestOptions, searchRulesParams.requestOptions) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - query, - anchoring, - context, - page, - hitsPerPage, - enabled, - requestOptions - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchRulesParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" anchoring: ") - .append(toIndentedString(anchoring)) - .append("\n"); - sb.append(" context: ").append(toIndentedString(context)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb - .append(" requestOptions: ") - .append(toIndentedString(requestOptions)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesResponse.java deleted file mode 100644 index 0d9e1f9cf1..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchRulesResponse.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** SearchRulesResponse */ -public class SearchRulesResponse { - - @SerializedName("hits") - private List hits = new ArrayList<>(); - - @SerializedName("nbHits") - private Integer nbHits; - - @SerializedName("page") - private Integer page; - - @SerializedName("nbPages") - private Integer nbPages; - - public SearchRulesResponse hits(List hits) { - this.hits = hits; - return this; - } - - public SearchRulesResponse addHitsItem(Rule hitsItem) { - this.hits.add(hitsItem); - return this; - } - - /** - * Fetched rules. - * - * @return hits - */ - @javax.annotation.Nonnull - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - public SearchRulesResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** - * Number of fetched rules. - * - * @return nbHits - */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public void setNbHits(Integer nbHits) { - this.nbHits = nbHits; - } - - public SearchRulesResponse page(Integer page) { - this.page = page; - return this; - } - - /** - * Current page. - * - * @return page - */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchRulesResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; - return this; - } - - /** - * Number of pages. - * - * @return nbPages - */ - @javax.annotation.Nonnull - public Integer getNbPages() { - return nbPages; - } - - public void setNbPages(Integer nbPages) { - this.nbPages = nbPages; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchRulesResponse searchRulesResponse = (SearchRulesResponse) o; - return ( - Objects.equals(this.hits, searchRulesResponse.hits) && - Objects.equals(this.nbHits, searchRulesResponse.nbHits) && - Objects.equals(this.page, searchRulesResponse.page) && - Objects.equals(this.nbPages, searchRulesResponse.nbPages) - ); - } - - @Override - public int hashCode() { - return Objects.hash(hits, nbHits, page, nbPages); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchRulesResponse {\n"); - sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java deleted file mode 100644 index 49e1f94bf7..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; - -/** SearchSynonymsResponse */ -public class SearchSynonymsResponse extends HashMap { - - @SerializedName("hits") - private List hits = new ArrayList<>(); - - @SerializedName("nbHits") - private Integer nbHits; - - public SearchSynonymsResponse hits(List hits) { - this.hits = hits; - return this; - } - - public SearchSynonymsResponse addHitsItem(SynonymHit hitsItem) { - this.hits.add(hitsItem); - return this; - } - - /** - * Array of synonym objects. - * - * @return hits - */ - @javax.annotation.Nonnull - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - public SearchSynonymsResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** - * Number of hits that the search query matched. - * - * @return nbHits - */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public void setNbHits(Integer nbHits) { - this.nbHits = nbHits; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchSynonymsResponse searchSynonymsResponse = (SearchSynonymsResponse) o; - return ( - Objects.equals(this.hits, searchSynonymsResponse.hits) && - Objects.equals(this.nbHits, searchSynonymsResponse.nbHits) && - super.equals(o) - ); - } - - @Override - public int hashCode() { - return Objects.hash(hits, nbHits, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchSynonymsResponse {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsParams.java deleted file mode 100644 index b86938a2df..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsParams.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** OK */ -public class SearchUserIdsParams { - - @SerializedName("query") - private String query; - - @SerializedName("clusterName") - private String clusterName; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - public SearchUserIdsParams query(String query) { - this.query = query; - return this; - } - - /** - * Query to search. The search is a prefix search with typoTolerance. Use empty query to retrieve - * all users. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public SearchUserIdsParams clusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - /** - * Name of the cluster. - * - * @return clusterName - */ - @javax.annotation.Nullable - public String getClusterName() { - return clusterName; - } - - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - - public SearchUserIdsParams page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nullable - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchUserIdsParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Set the number of hits per page. - * - * @return hitsPerPage - */ - @javax.annotation.Nullable - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchUserIdsParams searchUserIdsParams = (SearchUserIdsParams) o; - return ( - Objects.equals(this.query, searchUserIdsParams.query) && - Objects.equals(this.clusterName, searchUserIdsParams.clusterName) && - Objects.equals(this.page, searchUserIdsParams.page) && - Objects.equals(this.hitsPerPage, searchUserIdsParams.hitsPerPage) - ); - } - - @Override - public int hashCode() { - return Objects.hash(query, clusterName, page, hitsPerPage); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchUserIdsParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb - .append(" clusterName: ") - .append(toIndentedString(clusterName)) - .append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponse.java deleted file mode 100644 index fa4aba4b7d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponse.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** userIDs data. */ -public class SearchUserIdsResponse { - - @SerializedName("hits") - private List hits = new ArrayList<>(); - - @SerializedName("nbHits") - private Integer nbHits; - - @SerializedName("page") - private Integer page = 0; - - @SerializedName("hitsPerPage") - private Integer hitsPerPage = 20; - - @SerializedName("updatedAt") - private String updatedAt; - - public SearchUserIdsResponse hits(List hits) { - this.hits = hits; - return this; - } - - public SearchUserIdsResponse addHitsItem(SearchUserIdsResponseHits hitsItem) { - this.hits.add(hitsItem); - return this; - } - - /** - * List of user object matching the query. - * - * @return hits - */ - @javax.annotation.Nonnull - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - public SearchUserIdsResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; - return this; - } - - /** - * Number of hits that the search query matched. - * - * @return nbHits - */ - @javax.annotation.Nonnull - public Integer getNbHits() { - return nbHits; - } - - public void setNbHits(Integer nbHits) { - this.nbHits = nbHits; - } - - public SearchUserIdsResponse page(Integer page) { - this.page = page; - return this; - } - - /** - * Specify the page to retrieve. - * - * @return page - */ - @javax.annotation.Nonnull - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public SearchUserIdsResponse hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - return this; - } - - /** - * Maximum number of hits in a page. Minimum is 1, maximum is 1000. - * - * @return hitsPerPage - */ - @javax.annotation.Nonnull - public Integer getHitsPerPage() { - return hitsPerPage; - } - - public void setHitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; - } - - public SearchUserIdsResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchUserIdsResponse searchUserIdsResponse = (SearchUserIdsResponse) o; - return ( - Objects.equals(this.hits, searchUserIdsResponse.hits) && - Objects.equals(this.nbHits, searchUserIdsResponse.nbHits) && - Objects.equals(this.page, searchUserIdsResponse.page) && - Objects.equals(this.hitsPerPage, searchUserIdsResponse.hitsPerPage) && - Objects.equals(this.updatedAt, searchUserIdsResponse.updatedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(hits, nbHits, page, hitsPerPage, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchUserIdsResponse {\n"); - sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); - sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb - .append(" hitsPerPage: ") - .append(toIndentedString(hitsPerPage)) - .append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHighlightResult.java deleted file mode 100644 index 0b030d0870..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHighlightResult.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SearchUserIdsResponseHighlightResult */ -public class SearchUserIdsResponseHighlightResult { - - @SerializedName("userID") - private HighlightResult userID; - - @SerializedName("clusterName") - private HighlightResult clusterName; - - public SearchUserIdsResponseHighlightResult userID(HighlightResult userID) { - this.userID = userID; - return this; - } - - /** - * Get userID - * - * @return userID - */ - @javax.annotation.Nonnull - public HighlightResult getUserID() { - return userID; - } - - public void setUserID(HighlightResult userID) { - this.userID = userID; - } - - public SearchUserIdsResponseHighlightResult clusterName( - HighlightResult clusterName - ) { - this.clusterName = clusterName; - return this; - } - - /** - * Get clusterName - * - * @return clusterName - */ - @javax.annotation.Nonnull - public HighlightResult getClusterName() { - return clusterName; - } - - public void setClusterName(HighlightResult clusterName) { - this.clusterName = clusterName; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchUserIdsResponseHighlightResult searchUserIdsResponseHighlightResult = (SearchUserIdsResponseHighlightResult) o; - return ( - Objects.equals( - this.userID, - searchUserIdsResponseHighlightResult.userID - ) && - Objects.equals( - this.clusterName, - searchUserIdsResponseHighlightResult.clusterName - ) - ); - } - - @Override - public int hashCode() { - return Objects.hash(userID, clusterName); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchUserIdsResponseHighlightResult {\n"); - sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); - sb - .append(" clusterName: ") - .append(toIndentedString(clusterName)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHits.java deleted file mode 100644 index 9a948b39fa..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHits.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** SearchUserIdsResponseHits */ -public class SearchUserIdsResponseHits { - - @SerializedName("userID") - private String userID; - - @SerializedName("clusterName") - private String clusterName; - - @SerializedName("nbRecords") - private Integer nbRecords; - - @SerializedName("dataSize") - private Integer dataSize; - - @SerializedName("objectID") - private String objectID; - - @SerializedName("_highlightResult") - private SearchUserIdsResponseHighlightResult highlightResult; - - public SearchUserIdsResponseHits userID(String userID) { - this.userID = userID; - return this; - } - - /** - * userID of the user. - * - * @return userID - */ - @javax.annotation.Nonnull - public String getUserID() { - return userID; - } - - public void setUserID(String userID) { - this.userID = userID; - } - - public SearchUserIdsResponseHits clusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - /** - * Name of the cluster. - * - * @return clusterName - */ - @javax.annotation.Nonnull - public String getClusterName() { - return clusterName; - } - - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - - public SearchUserIdsResponseHits nbRecords(Integer nbRecords) { - this.nbRecords = nbRecords; - return this; - } - - /** - * Number of records in the cluster. - * - * @return nbRecords - */ - @javax.annotation.Nonnull - public Integer getNbRecords() { - return nbRecords; - } - - public void setNbRecords(Integer nbRecords) { - this.nbRecords = nbRecords; - } - - public SearchUserIdsResponseHits dataSize(Integer dataSize) { - this.dataSize = dataSize; - return this; - } - - /** - * Data size taken by all the users assigned to the cluster. - * - * @return dataSize - */ - @javax.annotation.Nonnull - public Integer getDataSize() { - return dataSize; - } - - public void setDataSize(Integer dataSize) { - this.dataSize = dataSize; - } - - public SearchUserIdsResponseHits objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * userID of the requested user. Same as userID. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public SearchUserIdsResponseHits highlightResult( - SearchUserIdsResponseHighlightResult highlightResult - ) { - this.highlightResult = highlightResult; - return this; - } - - /** - * Get highlightResult - * - * @return highlightResult - */ - @javax.annotation.Nonnull - public SearchUserIdsResponseHighlightResult getHighlightResult() { - return highlightResult; - } - - public void setHighlightResult( - SearchUserIdsResponseHighlightResult highlightResult - ) { - this.highlightResult = highlightResult; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchUserIdsResponseHits searchUserIdsResponseHits = (SearchUserIdsResponseHits) o; - return ( - Objects.equals(this.userID, searchUserIdsResponseHits.userID) && - Objects.equals(this.clusterName, searchUserIdsResponseHits.clusterName) && - Objects.equals(this.nbRecords, searchUserIdsResponseHits.nbRecords) && - Objects.equals(this.dataSize, searchUserIdsResponseHits.dataSize) && - Objects.equals(this.objectID, searchUserIdsResponseHits.objectID) && - Objects.equals( - this.highlightResult, - searchUserIdsResponseHits.highlightResult - ) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - userID, - clusterName, - nbRecords, - dataSize, - objectID, - highlightResult - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchUserIdsResponseHits {\n"); - sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); - sb - .append(" clusterName: ") - .append(toIndentedString(clusterName)) - .append("\n"); - sb - .append(" nbRecords: ") - .append(toIndentedString(nbRecords)) - .append("\n"); - sb.append(" dataSize: ").append(toIndentedString(dataSize)).append("\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb - .append(" highlightResult: ") - .append(toIndentedString(highlightResult)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java deleted file mode 100644 index 25386fac2d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** SnippetResult */ -public class SnippetResult { - - @SerializedName("value") - private String value; - - /** Indicates how well the attribute matched the search query. */ - @JsonAdapter(MatchLevelEnum.Adapter.class) - public enum MatchLevelEnum { - NONE("none"), - - PARTIAL("partial"), - - FULL("full"); - - private String value; - - MatchLevelEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MatchLevelEnum fromValue(String value) { - for (MatchLevelEnum b : MatchLevelEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MatchLevelEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MatchLevelEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MatchLevelEnum.fromValue(value); - } - } - } - - @SerializedName("matchLevel") - private MatchLevelEnum matchLevel; - - public SnippetResult value(String value) { - this.value = value; - return this; - } - - /** - * Markup text with occurrences highlighted. - * - * @return value - */ - @javax.annotation.Nullable - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public SnippetResult matchLevel(MatchLevelEnum matchLevel) { - this.matchLevel = matchLevel; - return this; - } - - /** - * Indicates how well the attribute matched the search query. - * - * @return matchLevel - */ - @javax.annotation.Nullable - public MatchLevelEnum getMatchLevel() { - return matchLevel; - } - - public void setMatchLevel(MatchLevelEnum matchLevel) { - this.matchLevel = matchLevel; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SnippetResult snippetResult = (SnippetResult) o; - return ( - Objects.equals(this.value, snippetResult.value) && - Objects.equals(this.matchLevel, snippetResult.matchLevel) - ); - } - - @Override - public int hashCode() { - return Objects.hash(value, matchLevel); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SnippetResult {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb - .append(" matchLevel: ") - .append(toIndentedString(matchLevel)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java deleted file mode 100644 index 3640457e8b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** The source. */ -public class Source { - - @SerializedName("source") - private String source; - - @SerializedName("description") - private String description; - - public Source source(String source) { - this.source = source; - return this; - } - - /** - * The IP range of the source. - * - * @return source - */ - @javax.annotation.Nonnull - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public Source description(String description) { - this.description = description; - return this; - } - - /** - * The description of the source. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source source = (Source) o; - return ( - Objects.equals(this.source, source.source) && - Objects.equals(this.description, source.description) - ); - } - - @Override - public int hashCode() { - return Objects.hash(source, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb - .append(" description: ") - .append(toIndentedString(description)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/StandardEntries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/StandardEntries.java deleted file mode 100644 index 40de457f3d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/StandardEntries.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Map of language ISO code supported by the dictionary (e.g., \"en\" for English) to a boolean - * value. - */ -public class StandardEntries { - - @SerializedName("plurals") - private Map plurals = null; - - @SerializedName("stopwords") - private Map stopwords = null; - - @SerializedName("compounds") - private Map compounds = null; - - public StandardEntries plurals(Map plurals) { - this.plurals = plurals; - return this; - } - - public StandardEntries putPluralsItem(String key, Boolean pluralsItem) { - if (this.plurals == null) { - this.plurals = new HashMap<>(); - } - this.plurals.put(key, pluralsItem); - return this; - } - - /** - * Language ISO code. - * - * @return plurals - */ - @javax.annotation.Nullable - public Map getPlurals() { - return plurals; - } - - public void setPlurals(Map plurals) { - this.plurals = plurals; - } - - public StandardEntries stopwords(Map stopwords) { - this.stopwords = stopwords; - return this; - } - - public StandardEntries putStopwordsItem(String key, Boolean stopwordsItem) { - if (this.stopwords == null) { - this.stopwords = new HashMap<>(); - } - this.stopwords.put(key, stopwordsItem); - return this; - } - - /** - * Language ISO code. - * - * @return stopwords - */ - @javax.annotation.Nullable - public Map getStopwords() { - return stopwords; - } - - public void setStopwords(Map stopwords) { - this.stopwords = stopwords; - } - - public StandardEntries compounds(Map compounds) { - this.compounds = compounds; - return this; - } - - public StandardEntries putCompoundsItem(String key, Boolean compoundsItem) { - if (this.compounds == null) { - this.compounds = new HashMap<>(); - } - this.compounds.put(key, compoundsItem); - return this; - } - - /** - * Language ISO code. - * - * @return compounds - */ - @javax.annotation.Nullable - public Map getCompounds() { - return compounds; - } - - public void setCompounds(Map compounds) { - this.compounds = compounds; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - StandardEntries standardEntries = (StandardEntries) o; - return ( - Objects.equals(this.plurals, standardEntries.plurals) && - Objects.equals(this.stopwords, standardEntries.stopwords) && - Objects.equals(this.compounds, standardEntries.compounds) - ); - } - - @Override - public int hashCode() { - return Objects.hash(plurals, stopwords, compounds); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StandardEntries {\n"); - sb.append(" plurals: ").append(toIndentedString(plurals)).append("\n"); - sb - .append(" stopwords: ") - .append(toIndentedString(stopwords)) - .append("\n"); - sb - .append(" compounds: ") - .append(toIndentedString(compounds)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java deleted file mode 100644 index ffa9eaeeb1..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java +++ /dev/null @@ -1,308 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Synonym object. */ -public class SynonymHit { - - @SerializedName("objectID") - private String objectID; - - @SerializedName("type") - private SynonymType type; - - @SerializedName("synonyms") - private List synonyms = null; - - @SerializedName("input") - private String input; - - @SerializedName("word") - private String word; - - @SerializedName("corrections") - private List corrections = null; - - @SerializedName("placeholder") - private String placeholder; - - @SerializedName("replacements") - private List replacements = null; - - @SerializedName("_highlightResult") - private SynonymHitHighlightResult highlightResult; - - public SynonymHit objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the synonym object to be created or updated. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public SynonymHit type(SynonymType type) { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type - */ - @javax.annotation.Nonnull - public SynonymType getType() { - return type; - } - - public void setType(SynonymType type) { - this.type = type; - } - - public SynonymHit synonyms(List synonyms) { - this.synonyms = synonyms; - return this; - } - - public SynonymHit addSynonymsItem(String synonymsItem) { - if (this.synonyms == null) { - this.synonyms = new ArrayList<>(); - } - this.synonyms.add(synonymsItem); - return this; - } - - /** - * Words or phrases to be considered equivalent. - * - * @return synonyms - */ - @javax.annotation.Nullable - public List getSynonyms() { - return synonyms; - } - - public void setSynonyms(List synonyms) { - this.synonyms = synonyms; - } - - public SynonymHit input(String input) { - this.input = input; - return this; - } - - /** - * Word or phrase to appear in query strings (for onewaysynonym). - * - * @return input - */ - @javax.annotation.Nullable - public String getInput() { - return input; - } - - public void setInput(String input) { - this.input = input; - } - - public SynonymHit word(String word) { - this.word = word; - return this; - } - - /** - * Word or phrase to appear in query strings (for altcorrection1 and altcorrection2). - * - * @return word - */ - @javax.annotation.Nullable - public String getWord() { - return word; - } - - public void setWord(String word) { - this.word = word; - } - - public SynonymHit corrections(List corrections) { - this.corrections = corrections; - return this; - } - - public SynonymHit addCorrectionsItem(String correctionsItem) { - if (this.corrections == null) { - this.corrections = new ArrayList<>(); - } - this.corrections.add(correctionsItem); - return this; - } - - /** - * Words to be matched in records. - * - * @return corrections - */ - @javax.annotation.Nullable - public List getCorrections() { - return corrections; - } - - public void setCorrections(List corrections) { - this.corrections = corrections; - } - - public SynonymHit placeholder(String placeholder) { - this.placeholder = placeholder; - return this; - } - - /** - * Token to be put inside records. - * - * @return placeholder - */ - @javax.annotation.Nullable - public String getPlaceholder() { - return placeholder; - } - - public void setPlaceholder(String placeholder) { - this.placeholder = placeholder; - } - - public SynonymHit replacements(List replacements) { - this.replacements = replacements; - return this; - } - - public SynonymHit addReplacementsItem(String replacementsItem) { - if (this.replacements == null) { - this.replacements = new ArrayList<>(); - } - this.replacements.add(replacementsItem); - return this; - } - - /** - * List of query words that will match the token. - * - * @return replacements - */ - @javax.annotation.Nullable - public List getReplacements() { - return replacements; - } - - public void setReplacements(List replacements) { - this.replacements = replacements; - } - - public SynonymHit highlightResult(SynonymHitHighlightResult highlightResult) { - this.highlightResult = highlightResult; - return this; - } - - /** - * Get highlightResult - * - * @return highlightResult - */ - @javax.annotation.Nullable - public SynonymHitHighlightResult getHighlightResult() { - return highlightResult; - } - - public void setHighlightResult(SynonymHitHighlightResult highlightResult) { - this.highlightResult = highlightResult; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SynonymHit synonymHit = (SynonymHit) o; - return ( - Objects.equals(this.objectID, synonymHit.objectID) && - Objects.equals(this.type, synonymHit.type) && - Objects.equals(this.synonyms, synonymHit.synonyms) && - Objects.equals(this.input, synonymHit.input) && - Objects.equals(this.word, synonymHit.word) && - Objects.equals(this.corrections, synonymHit.corrections) && - Objects.equals(this.placeholder, synonymHit.placeholder) && - Objects.equals(this.replacements, synonymHit.replacements) && - Objects.equals(this.highlightResult, synonymHit.highlightResult) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - objectID, - type, - synonyms, - input, - word, - corrections, - placeholder, - replacements, - highlightResult - ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SynonymHit {\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb.append(" input: ").append(toIndentedString(input)).append("\n"); - sb.append(" word: ").append(toIndentedString(word)).append("\n"); - sb - .append(" corrections: ") - .append(toIndentedString(corrections)) - .append("\n"); - sb - .append(" placeholder: ") - .append(toIndentedString(placeholder)) - .append("\n"); - sb - .append(" replacements: ") - .append(toIndentedString(replacements)) - .append("\n"); - sb - .append(" highlightResult: ") - .append(toIndentedString(highlightResult)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java deleted file mode 100644 index 83b1986a87..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Highlighted results */ -public class SynonymHitHighlightResult { - - @SerializedName("type") - private HighlightResult type; - - @SerializedName("synonyms") - private List synonyms = null; - - public SynonymHitHighlightResult type(HighlightResult type) { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type - */ - @javax.annotation.Nullable - public HighlightResult getType() { - return type; - } - - public void setType(HighlightResult type) { - this.type = type; - } - - public SynonymHitHighlightResult synonyms(List synonyms) { - this.synonyms = synonyms; - return this; - } - - public SynonymHitHighlightResult addSynonymsItem( - HighlightResult synonymsItem - ) { - if (this.synonyms == null) { - this.synonyms = new ArrayList<>(); - } - this.synonyms.add(synonymsItem); - return this; - } - - /** - * Get synonyms - * - * @return synonyms - */ - @javax.annotation.Nullable - public List getSynonyms() { - return synonyms; - } - - public void setSynonyms(List synonyms) { - this.synonyms = synonyms; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SynonymHitHighlightResult synonymHitHighlightResult = (SynonymHitHighlightResult) o; - return ( - Objects.equals(this.type, synonymHitHighlightResult.type) && - Objects.equals(this.synonyms, synonymHitHighlightResult.synonyms) - ); - } - - @Override - public int hashCode() { - return Objects.hash(type, synonyms); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SynonymHitHighlightResult {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymType.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymType.java deleted file mode 100644 index cd57b50d7a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymType.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.algolia.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Type of the synonym object. */ -@JsonAdapter(SynonymType.Adapter.class) -public enum SynonymType { - SYNONYM("synonym"), - - ONEWAYSYNONYM("onewaysynonym"), - - ALTCORRECTION1("altcorrection1"), - - ALTCORRECTION2("altcorrection2"), - - PLACEHOLDER("placeholder"); - - private String value; - - SynonymType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static SynonymType fromValue(String value) { - for (SynonymType b : SynonymType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final SynonymType enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SynonymType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SynonymType.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/TimeRange.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/TimeRange.java deleted file mode 100644 index 446c5f6c7d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/TimeRange.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** TimeRange */ -public class TimeRange { - - @SerializedName("from") - private Integer from; - - @SerializedName("until") - private Integer until; - - public TimeRange from(Integer from) { - this.from = from; - return this; - } - - /** - * Lower bound of the time range (Unix timestamp). - * - * @return from - */ - @javax.annotation.Nonnull - public Integer getFrom() { - return from; - } - - public void setFrom(Integer from) { - this.from = from; - } - - public TimeRange until(Integer until) { - this.until = until; - return this; - } - - /** - * Upper bound of the time range (Unix timestamp). - * - * @return until - */ - @javax.annotation.Nonnull - public Integer getUntil() { - return until; - } - - public void setUntil(Integer until) { - this.until = until; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TimeRange timeRange = (TimeRange) o; - return ( - Objects.equals(this.from, timeRange.from) && - Objects.equals(this.until, timeRange.until) - ); - } - - @Override - public int hashCode() { - return Objects.hash(from, until); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TimeRange {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" until: ").append(toIndentedString(until)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdateApiKeyResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdateApiKeyResponse.java deleted file mode 100644 index 6dd34ac8e0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdateApiKeyResponse.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** UpdateApiKeyResponse */ -public class UpdateApiKeyResponse { - - @SerializedName("key") - private String key; - - @SerializedName("updatedAt") - private String updatedAt; - - public UpdateApiKeyResponse key(String key) { - this.key = key; - return this; - } - - /** - * Key string. - * - * @return key - */ - @javax.annotation.Nonnull - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public UpdateApiKeyResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateApiKeyResponse updateApiKeyResponse = (UpdateApiKeyResponse) o; - return ( - Objects.equals(this.key, updateApiKeyResponse.key) && - Objects.equals(this.updatedAt, updateApiKeyResponse.updatedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(key, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateApiKeyResponse {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java deleted file mode 100644 index acea12958d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** The response with a taskID and an updatedAt timestamp. */ -public class UpdatedAtResponse { - - @SerializedName("taskID") - private Integer taskID; - - @SerializedName("updatedAt") - private String updatedAt; - - public UpdatedAtResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nonnull - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public UpdatedAtResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdatedAtResponse updatedAtResponse = (UpdatedAtResponse) o; - return ( - Objects.equals(this.taskID, updatedAtResponse.taskID) && - Objects.equals(this.updatedAt, updatedAtResponse.updatedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdatedAtResponse {\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java deleted file mode 100644 index c3dcc83580..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** The response with a taskID, an objectID and an updatedAt timestamp. */ -public class UpdatedAtWithObjectIdResponse { - - @SerializedName("taskID") - private Integer taskID; - - @SerializedName("updatedAt") - private String updatedAt; - - @SerializedName("objectID") - private String objectID; - - public UpdatedAtWithObjectIdResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public UpdatedAtWithObjectIdResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nullable - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - public UpdatedAtWithObjectIdResponse objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nullable - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdatedAtWithObjectIdResponse updatedAtWithObjectIdResponse = (UpdatedAtWithObjectIdResponse) o; - return ( - Objects.equals(this.taskID, updatedAtWithObjectIdResponse.taskID) && - Objects.equals(this.updatedAt, updatedAtWithObjectIdResponse.updatedAt) && - Objects.equals(this.objectID, updatedAtWithObjectIdResponse.objectID) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, updatedAt, objectID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdatedAtWithObjectIdResponse {\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java deleted file mode 100644 index b0e87465e2..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** UpdatedRuleResponse */ -public class UpdatedRuleResponse { - - @SerializedName("objectID") - private String objectID; - - @SerializedName("updatedAt") - private String updatedAt; - - @SerializedName("taskID") - private Integer taskID; - - public UpdatedRuleResponse objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nonnull - public String getObjectID() { - return objectID; - } - - public void setObjectID(String objectID) { - this.objectID = objectID; - } - - public UpdatedRuleResponse updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nonnull - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - public UpdatedRuleResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the task to wait for. - * - * @return taskID - */ - @javax.annotation.Nonnull - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdatedRuleResponse updatedRuleResponse = (UpdatedRuleResponse) o; - return ( - Objects.equals(this.objectID, updatedRuleResponse.objectID) && - Objects.equals(this.updatedAt, updatedRuleResponse.updatedAt) && - Objects.equals(this.taskID, updatedRuleResponse.taskID) - ); - } - - @Override - public int hashCode() { - return Objects.hash(objectID, updatedAt, taskID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdatedRuleResponse {\n"); - sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .append("\n"); - sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UserId.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UserId.java deleted file mode 100644 index d5a9994b9e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UserId.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** A userID. */ -public class UserId { - - @SerializedName("userID") - private String userID; - - @SerializedName("clusterName") - private String clusterName; - - @SerializedName("nbRecords") - private Integer nbRecords; - - @SerializedName("dataSize") - private Integer dataSize; - - public UserId userID(String userID) { - this.userID = userID; - return this; - } - - /** - * userID of the user. - * - * @return userID - */ - @javax.annotation.Nonnull - public String getUserID() { - return userID; - } - - public void setUserID(String userID) { - this.userID = userID; - } - - public UserId clusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - /** - * Cluster on which the user is assigned. - * - * @return clusterName - */ - @javax.annotation.Nonnull - public String getClusterName() { - return clusterName; - } - - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - - public UserId nbRecords(Integer nbRecords) { - this.nbRecords = nbRecords; - return this; - } - - /** - * Number of records belonging to the user. - * - * @return nbRecords - */ - @javax.annotation.Nonnull - public Integer getNbRecords() { - return nbRecords; - } - - public void setNbRecords(Integer nbRecords) { - this.nbRecords = nbRecords; - } - - public UserId dataSize(Integer dataSize) { - this.dataSize = dataSize; - return this; - } - - /** - * Data size used by the user. - * - * @return dataSize - */ - @javax.annotation.Nonnull - public Integer getDataSize() { - return dataSize; - } - - public void setDataSize(Integer dataSize) { - this.dataSize = dataSize; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserId userId = (UserId) o; - return ( - Objects.equals(this.userID, userId.userID) && - Objects.equals(this.clusterName, userId.clusterName) && - Objects.equals(this.nbRecords, userId.nbRecords) && - Objects.equals(this.dataSize, userId.dataSize) - ); - } - - @Override - public int hashCode() { - return Objects.hash(userID, clusterName, nbRecords, dataSize); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserId {\n"); - sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); - sb - .append(" clusterName: ") - .append(toIndentedString(clusterName)) - .append("\n"); - sb - .append(" nbRecords: ") - .append(toIndentedString(nbRecords)) - .append("\n"); - sb.append(" dataSize: ").append(toIndentedString(dataSize)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java deleted file mode 100644 index 4c9f5f528b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ /dev/null @@ -1,6103 +0,0 @@ -package com.algolia.search; - -import com.algolia.ApiCallback; -import com.algolia.ApiClient; -import com.algolia.ApiException; -import com.algolia.ApiResponse; -import com.algolia.Pair; -import com.algolia.model.*; -import com.algolia.utils.*; -import com.algolia.utils.echo.*; -import com.google.gson.reflect.TypeToken; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Call; - -public class SearchApi extends ApiClient { - - public SearchApi(String appId, String apiKey) { - super(appId, apiKey, new HttpRequester()); - } - - public SearchApi(String appId, String apiKey, Requester requester) { - super(appId, apiKey, requester); - } - - /** - * Build call for addApiKey - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call addApiKeyCall( - ApiKey apiKey, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = apiKey; - - // create path and map variables - String path = "/1/keys"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call addApiKeyValidateBeforeCall( - ApiKey apiKey, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'apiKey' is set - if (apiKey == null) { - throw new ApiException( - "Missing the required parameter 'apiKey' when calling addApiKey(Async)" - ); - } - - return addApiKeyCall(apiKey, _callback); - } - - /** - * Add a new API Key with specific permissions/restrictions. - * - * @param apiKey (required) - * @return AddApiKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public AddApiKeyResponse addApiKey(ApiKey apiKey) throws ApiException { - Call req = addApiKeyValidateBeforeCall(apiKey, null); - if (req instanceof CallEcho) { - return new EchoResponse.AddApiKey(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Add a new API Key with specific permissions/restrictions. - * - * @param apiKey (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call addApiKeyAsync( - ApiKey apiKey, - final ApiCallback _callback - ) throws ApiException { - Call call = addApiKeyValidateBeforeCall(apiKey, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for addOrUpdateObject - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call addOrUpdateObjectCall( - String indexName, - String objectID, - Object body, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = body; - - // create path and map variables - String path = - "/1/indexes/{indexName}/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call addOrUpdateObjectValidateBeforeCall( - String indexName, - String objectID, - Object body, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling addOrUpdateObject(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling addOrUpdateObject(Async)" - ); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException( - "Missing the required parameter 'body' when calling addOrUpdateObject(Async)" - ); - } - - return addOrUpdateObjectCall(indexName, objectID, body, _callback); - } - - /** - * Add or replace an object with a given object ID. If the object does not exist, it will be - * created. If it already exists, it will be replaced. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param body The Algolia object. (required) - * @return UpdatedAtWithObjectIdResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtWithObjectIdResponse addOrUpdateObject( - String indexName, - String objectID, - Object body - ) throws ApiException { - Call req = addOrUpdateObjectValidateBeforeCall( - indexName, - objectID, - body, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.AddOrUpdateObject(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Add or replace an object with a given object ID. If the object does not exist, - * it will be created. If it already exists, it will be replaced. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param body The Algolia object. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call addOrUpdateObjectAsync( - String indexName, - String objectID, - Object body, - final ApiCallback _callback - ) throws ApiException { - Call call = addOrUpdateObjectValidateBeforeCall( - indexName, - objectID, - body, - _callback - ); - Type returnType = new TypeToken() {} - .getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for appendSource - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call appendSourceCall( - Source source, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = source; - - // create path and map variables - String path = "/1/security/sources/append"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call appendSourceValidateBeforeCall( - Source source, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'source' is set - if (source == null) { - throw new ApiException( - "Missing the required parameter 'source' when calling appendSource(Async)" - ); - } - - return appendSourceCall(source, _callback); - } - - /** - * Add a single source to the list of allowed sources. - * - * @param source The source to add. (required) - * @return CreatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public CreatedAtResponse appendSource(Source source) throws ApiException { - Call req = appendSourceValidateBeforeCall(source, null); - if (req instanceof CallEcho) { - return new EchoResponse.AppendSource(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Add a single source to the list of allowed sources. - * - * @param source The source to add. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call appendSourceAsync( - Source source, - final ApiCallback _callback - ) throws ApiException { - Call call = appendSourceValidateBeforeCall(source, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for assignUserId - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call assignUserIdCall( - String xAlgoliaUserID, - AssignUserIdParams assignUserIdParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = assignUserIdParams; - - // create path and map variables - String path = "/1/clusters/mapping"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (xAlgoliaUserID != null) { - queryParams.addAll( - this.parameterToPair("X-Algolia-User-ID", xAlgoliaUserID) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call assignUserIdValidateBeforeCall( - String xAlgoliaUserID, - AssignUserIdParams assignUserIdParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'xAlgoliaUserID' is set - if (xAlgoliaUserID == null) { - throw new ApiException( - "Missing the required parameter 'xAlgoliaUserID' when calling assignUserId(Async)" - ); - } - - // verify the required parameter 'assignUserIdParams' is set - if (assignUserIdParams == null) { - throw new ApiException( - "Missing the required parameter 'assignUserIdParams' when calling assignUserId(Async)" - ); - } - - return assignUserIdCall(xAlgoliaUserID, assignUserIdParams, _callback); - } - - /** - * Assign or Move a userID to a cluster. The time it takes to migrate (move) a user is - * proportional to the amount of data linked to the userID. Upon success, the response is 200 OK. - * A successful response indicates that the operation has been taken into account, and the userID - * is directly usable. - * - * @param xAlgoliaUserID userID to assign. (required) - * @param assignUserIdParams (required) - * @return CreatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public CreatedAtResponse assignUserId( - String xAlgoliaUserID, - AssignUserIdParams assignUserIdParams - ) throws ApiException { - Call req = assignUserIdValidateBeforeCall( - xAlgoliaUserID, - assignUserIdParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.AssignUserId(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Assign or Move a userID to a cluster. The time it takes to migrate (move) a - * user is proportional to the amount of data linked to the userID. Upon success, the response is - * 200 OK. A successful response indicates that the operation has been taken into account, and the - * userID is directly usable. - * - * @param xAlgoliaUserID userID to assign. (required) - * @param assignUserIdParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call assignUserIdAsync( - String xAlgoliaUserID, - AssignUserIdParams assignUserIdParams, - final ApiCallback _callback - ) throws ApiException { - Call call = assignUserIdValidateBeforeCall( - xAlgoliaUserID, - assignUserIdParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for batch - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call batchCall( - String indexName, - BatchWriteParams batchWriteParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = batchWriteParams; - - // create path and map variables - String path = - "/1/indexes/{indexName}/batch".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call batchValidateBeforeCall( - String indexName, - BatchWriteParams batchWriteParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling batch(Async)" - ); - } - - // verify the required parameter 'batchWriteParams' is set - if (batchWriteParams == null) { - throw new ApiException( - "Missing the required parameter 'batchWriteParams' when calling batch(Async)" - ); - } - - return batchCall(indexName, batchWriteParams, _callback); - } - - /** - * Performs multiple write operations in a single API call. - * - * @param indexName The index in which to perform the request. (required) - * @param batchWriteParams (required) - * @return BatchResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public BatchResponse batch( - String indexName, - BatchWriteParams batchWriteParams - ) throws ApiException { - Call req = batchValidateBeforeCall(indexName, batchWriteParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.Batch(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Performs multiple write operations in a single API call. - * - * @param indexName The index in which to perform the request. (required) - * @param batchWriteParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call batchAsync( - String indexName, - BatchWriteParams batchWriteParams, - final ApiCallback _callback - ) throws ApiException { - Call call = batchValidateBeforeCall(indexName, batchWriteParams, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for batchAssignUserIds - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call batchAssignUserIdsCall( - String xAlgoliaUserID, - BatchAssignUserIdsParams batchAssignUserIdsParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = batchAssignUserIdsParams; - - // create path and map variables - String path = "/1/clusters/mapping/batch"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (xAlgoliaUserID != null) { - queryParams.addAll( - this.parameterToPair("X-Algolia-User-ID", xAlgoliaUserID) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call batchAssignUserIdsValidateBeforeCall( - String xAlgoliaUserID, - BatchAssignUserIdsParams batchAssignUserIdsParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'xAlgoliaUserID' is set - if (xAlgoliaUserID == null) { - throw new ApiException( - "Missing the required parameter 'xAlgoliaUserID' when calling batchAssignUserIds(Async)" - ); - } - - // verify the required parameter 'batchAssignUserIdsParams' is set - if (batchAssignUserIdsParams == null) { - throw new ApiException( - "Missing the required parameter 'batchAssignUserIdsParams' when calling" + - " batchAssignUserIds(Async)" - ); - } - - return batchAssignUserIdsCall( - xAlgoliaUserID, - batchAssignUserIdsParams, - _callback - ); - } - - /** - * Assign multiple userIDs to a cluster. Upon success, the response is 200 OK. A successful - * response indicates that the operation has been taken into account, and the userIDs are directly - * usable. - * - * @param xAlgoliaUserID userID to assign. (required) - * @param batchAssignUserIdsParams (required) - * @return CreatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public CreatedAtResponse batchAssignUserIds( - String xAlgoliaUserID, - BatchAssignUserIdsParams batchAssignUserIdsParams - ) throws ApiException { - Call req = batchAssignUserIdsValidateBeforeCall( - xAlgoliaUserID, - batchAssignUserIdsParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.BatchAssignUserIds(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Assign multiple userIDs to a cluster. Upon success, the response is 200 OK. A - * successful response indicates that the operation has been taken into account, and the userIDs - * are directly usable. - * - * @param xAlgoliaUserID userID to assign. (required) - * @param batchAssignUserIdsParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call batchAssignUserIdsAsync( - String xAlgoliaUserID, - BatchAssignUserIdsParams batchAssignUserIdsParams, - final ApiCallback _callback - ) throws ApiException { - Call call = batchAssignUserIdsValidateBeforeCall( - xAlgoliaUserID, - batchAssignUserIdsParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for batchDictionaryEntries - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call batchDictionaryEntriesCall( - String dictionaryName, - BatchDictionaryEntriesParams batchDictionaryEntriesParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = batchDictionaryEntriesParams; - - // create path and map variables - String path = - "/1/dictionaries/{dictionaryName}/batch".replaceAll( - "\\{" + "dictionaryName" + "\\}", - this.escapeString(dictionaryName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call batchDictionaryEntriesValidateBeforeCall( - String dictionaryName, - BatchDictionaryEntriesParams batchDictionaryEntriesParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'dictionaryName' is set - if (dictionaryName == null) { - throw new ApiException( - "Missing the required parameter 'dictionaryName' when calling" + - " batchDictionaryEntries(Async)" - ); - } - - // verify the required parameter 'batchDictionaryEntriesParams' is set - if (batchDictionaryEntriesParams == null) { - throw new ApiException( - "Missing the required parameter 'batchDictionaryEntriesParams' when calling" + - " batchDictionaryEntries(Async)" - ); - } - - return batchDictionaryEntriesCall( - dictionaryName, - batchDictionaryEntriesParams, - _callback - ); - } - - /** - * Send a batch of dictionary entries. - * - * @param dictionaryName The dictionary to search in. (required) - * @param batchDictionaryEntriesParams (required) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse batchDictionaryEntries( - String dictionaryName, - BatchDictionaryEntriesParams batchDictionaryEntriesParams - ) throws ApiException { - Call req = batchDictionaryEntriesValidateBeforeCall( - dictionaryName, - batchDictionaryEntriesParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.BatchDictionaryEntries( - ((CallEcho) req).request() - ); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Send a batch of dictionary entries. - * - * @param dictionaryName The dictionary to search in. (required) - * @param batchDictionaryEntriesParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call batchDictionaryEntriesAsync( - String dictionaryName, - BatchDictionaryEntriesParams batchDictionaryEntriesParams, - final ApiCallback _callback - ) throws ApiException { - Call call = batchDictionaryEntriesValidateBeforeCall( - dictionaryName, - batchDictionaryEntriesParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for batchRules - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call batchRulesCall( - String indexName, - List rule, - Boolean forwardToReplicas, - Boolean clearExistingRules, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = rule; - - // create path and map variables - String path = - "/1/indexes/{indexName}/rules/batch".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - if (clearExistingRules != null) { - queryParams.addAll( - this.parameterToPair("clearExistingRules", clearExistingRules) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call batchRulesValidateBeforeCall( - String indexName, - List rule, - Boolean forwardToReplicas, - Boolean clearExistingRules, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling batchRules(Async)" - ); - } - - // verify the required parameter 'rule' is set - if (rule == null) { - throw new ApiException( - "Missing the required parameter 'rule' when calling batchRules(Async)" - ); - } - - return batchRulesCall( - indexName, - rule, - forwardToReplicas, - clearExistingRules, - _callback - ); - } - - /** - * Create or update a batch of Rules. - * - * @param indexName The index in which to perform the request. (required) - * @param rule (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param clearExistingRules When true, existing Rules are cleared before adding this batch. When - * false, existing Rules are kept. (optional) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse batchRules( - String indexName, - List rule, - Boolean forwardToReplicas, - Boolean clearExistingRules - ) throws ApiException { - Call req = batchRulesValidateBeforeCall( - indexName, - rule, - forwardToReplicas, - clearExistingRules, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.BatchRules(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtResponse batchRules(String indexName, List rule) - throws ApiException { - return this.batchRules(indexName, rule, null, null); - } - - /** - * (asynchronously) Create or update a batch of Rules. - * - * @param indexName The index in which to perform the request. (required) - * @param rule (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param clearExistingRules When true, existing Rules are cleared before adding this batch. When - * false, existing Rules are kept. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call batchRulesAsync( - String indexName, - List rule, - Boolean forwardToReplicas, - Boolean clearExistingRules, - final ApiCallback _callback - ) throws ApiException { - Call call = batchRulesValidateBeforeCall( - indexName, - rule, - forwardToReplicas, - clearExistingRules, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for browse - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call browseCall( - String indexName, - BrowseRequest browseRequest, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = browseRequest; - - // create path and map variables - String path = - "/1/indexes/{indexName}/browse".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call browseValidateBeforeCall( - String indexName, - BrowseRequest browseRequest, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling browse(Async)" - ); - } - - return browseCall(indexName, browseRequest, _callback); - } - - /** - * This method allows you to retrieve all index content. It can retrieve up to 1,000 records per - * call and supports full text search and filters. For performance reasons, some features are not - * supported, including `distinct`, sorting by `typos`, `words` or `geo distance`. When there is - * more content to be browsed, the response contains a cursor field. This cursor has to be passed - * to the subsequent call to browse in order to get the next page of results. When the end of the - * index has been reached, the cursor field is absent from the response. - * - * @param indexName The index in which to perform the request. (required) - * @param browseRequest (optional) - * @return BrowseResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public BrowseResponse browse(String indexName, BrowseRequest browseRequest) - throws ApiException { - Call req = browseValidateBeforeCall(indexName, browseRequest, null); - if (req instanceof CallEcho) { - return new EchoResponse.Browse(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public BrowseResponse browse(String indexName) throws ApiException { - return this.browse(indexName, null); - } - - /** - * (asynchronously) This method allows you to retrieve all index content. It can retrieve up to - * 1,000 records per call and supports full text search and filters. For performance reasons, some - * features are not supported, including `distinct`, sorting by `typos`, - * `words` or `geo distance`. When there is more content to be browsed, the - * response contains a cursor field. This cursor has to be passed to the subsequent call to browse - * in order to get the next page of results. When the end of the index has been reached, the - * cursor field is absent from the response. - * - * @param indexName The index in which to perform the request. (required) - * @param browseRequest (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call browseAsync( - String indexName, - BrowseRequest browseRequest, - final ApiCallback _callback - ) throws ApiException { - Call call = browseValidateBeforeCall(indexName, browseRequest, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for clearAllSynonyms - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call clearAllSynonymsCall( - String indexName, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/synonyms/clear".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call clearAllSynonymsValidateBeforeCall( - String indexName, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling clearAllSynonyms(Async)" - ); - } - - return clearAllSynonymsCall(indexName, forwardToReplicas, _callback); - } - - /** - * Remove all synonyms from an index. - * - * @param indexName The index in which to perform the request. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse clearAllSynonyms( - String indexName, - Boolean forwardToReplicas - ) throws ApiException { - Call req = clearAllSynonymsValidateBeforeCall( - indexName, - forwardToReplicas, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.ClearAllSynonyms(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtResponse clearAllSynonyms(String indexName) - throws ApiException { - return this.clearAllSynonyms(indexName, null); - } - - /** - * (asynchronously) Remove all synonyms from an index. - * - * @param indexName The index in which to perform the request. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call clearAllSynonymsAsync( - String indexName, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = clearAllSynonymsValidateBeforeCall( - indexName, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for clearObjects - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call clearObjectsCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/clear".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call clearObjectsValidateBeforeCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling clearObjects(Async)" - ); - } - - return clearObjectsCall(indexName, _callback); - } - - /** - * Delete an index's content, but leave settings and index-specific API keys untouched. - * - * @param indexName The index in which to perform the request. (required) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse clearObjects(String indexName) throws ApiException { - Call req = clearObjectsValidateBeforeCall(indexName, null); - if (req instanceof CallEcho) { - return new EchoResponse.ClearObjects(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Delete an index's content, but leave settings and index-specific API keys - * untouched. - * - * @param indexName The index in which to perform the request. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call clearObjectsAsync( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Call call = clearObjectsValidateBeforeCall(indexName, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for clearRules - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call clearRulesCall( - String indexName, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/rules/clear".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call clearRulesValidateBeforeCall( - String indexName, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling clearRules(Async)" - ); - } - - return clearRulesCall(indexName, forwardToReplicas, _callback); - } - - /** - * Delete all Rules in the index. - * - * @param indexName The index in which to perform the request. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse clearRules( - String indexName, - Boolean forwardToReplicas - ) throws ApiException { - Call req = clearRulesValidateBeforeCall(indexName, forwardToReplicas, null); - if (req instanceof CallEcho) { - return new EchoResponse.ClearRules(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtResponse clearRules(String indexName) throws ApiException { - return this.clearRules(indexName, null); - } - - /** - * (asynchronously) Delete all Rules in the index. - * - * @param indexName The index in which to perform the request. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call clearRulesAsync( - String indexName, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = clearRulesValidateBeforeCall( - indexName, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteApiKey - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteApiKeyCall( - String key, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/keys/{key}".replaceAll( - "\\{" + "key" + "\\}", - this.escapeString(key.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteApiKeyValidateBeforeCall( - String key, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'key' is set - if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling deleteApiKey(Async)" - ); - } - - return deleteApiKeyCall(key, _callback); - } - - /** - * Delete an existing API Key. - * - * @param key API Key string. (required) - * @return DeleteApiKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public DeleteApiKeyResponse deleteApiKey(String key) throws ApiException { - Call req = deleteApiKeyValidateBeforeCall(key, null); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteApiKey(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Delete an existing API Key. - * - * @param key API Key string. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteApiKeyAsync( - String key, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteApiKeyValidateBeforeCall(key, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteBy - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteByCall( - String indexName, - SearchParams searchParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = searchParams; - - // create path and map variables - String path = - "/1/indexes/{indexName}/deleteByQuery".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteByValidateBeforeCall( - String indexName, - SearchParams searchParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteBy(Async)" - ); - } - - // verify the required parameter 'searchParams' is set - if (searchParams == null) { - throw new ApiException( - "Missing the required parameter 'searchParams' when calling deleteBy(Async)" - ); - } - - return deleteByCall(indexName, searchParams, _callback); - } - - /** - * Remove all objects matching a filter (including geo filters). This method enables you to delete - * one or more objects based on filters (numeric, facet, tag or geo queries). It doesn't accept - * empty filters or a query. - * - * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) - * @return DeletedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public DeletedAtResponse deleteBy( - String indexName, - SearchParams searchParams - ) throws ApiException { - Call req = deleteByValidateBeforeCall(indexName, searchParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteBy(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Remove all objects matching a filter (including geo filters). This method - * enables you to delete one or more objects based on filters (numeric, facet, tag or geo - * queries). It doesn't accept empty filters or a query. - * - * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteByAsync( - String indexName, - SearchParams searchParams, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteByValidateBeforeCall(indexName, searchParams, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteIndex - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteIndexCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteIndexValidateBeforeCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteIndex(Async)" - ); - } - - return deleteIndexCall(indexName, _callback); - } - - /** - * Delete an existing index. - * - * @param indexName The index in which to perform the request. (required) - * @return DeletedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public DeletedAtResponse deleteIndex(String indexName) throws ApiException { - Call req = deleteIndexValidateBeforeCall(indexName, null); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteIndex(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Delete an existing index. - * - * @param indexName The index in which to perform the request. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteIndexAsync( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteIndexValidateBeforeCall(indexName, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteObject - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteObjectCall( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteObjectValidateBeforeCall( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteObject(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling deleteObject(Async)" - ); - } - - return deleteObjectCall(indexName, objectID, _callback); - } - - /** - * Delete an existing object. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @return DeletedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public DeletedAtResponse deleteObject(String indexName, String objectID) - throws ApiException { - Call req = deleteObjectValidateBeforeCall(indexName, objectID, null); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteObject(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Delete an existing object. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteObjectAsync( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteObjectValidateBeforeCall(indexName, objectID, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteRule - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteRuleCall( - String indexName, - String objectID, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/rules/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteRuleValidateBeforeCall( - String indexName, - String objectID, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteRule(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling deleteRule(Async)" - ); - } - - return deleteRuleCall(indexName, objectID, forwardToReplicas, _callback); - } - - /** - * Delete the Rule with the specified objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse deleteRule( - String indexName, - String objectID, - Boolean forwardToReplicas - ) throws ApiException { - Call req = deleteRuleValidateBeforeCall( - indexName, - objectID, - forwardToReplicas, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteRule(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtResponse deleteRule(String indexName, String objectID) - throws ApiException { - return this.deleteRule(indexName, objectID, null); - } - - /** - * (asynchronously) Delete the Rule with the specified objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteRuleAsync( - String indexName, - String objectID, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteRuleValidateBeforeCall( - indexName, - objectID, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteSource - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteSourceCall( - String source, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/security/sources/{source}".replaceAll( - "\\{" + "source" + "\\}", - this.escapeString(source.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteSourceValidateBeforeCall( - String source, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'source' is set - if (source == null) { - throw new ApiException( - "Missing the required parameter 'source' when calling deleteSource(Async)" - ); - } - - return deleteSourceCall(source, _callback); - } - - /** - * Remove a single source from the list of allowed sources. - * - * @param source The IP range of the source. (required) - * @return DeleteSourceResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public DeleteSourceResponse deleteSource(String source) throws ApiException { - Call req = deleteSourceValidateBeforeCall(source, null); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteSource(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Remove a single source from the list of allowed sources. - * - * @param source The IP range of the source. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteSourceAsync( - String source, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteSourceValidateBeforeCall(source, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for deleteSynonym - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call deleteSynonymCall( - String indexName, - String objectID, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/synonyms/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call deleteSynonymValidateBeforeCall( - String indexName, - String objectID, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteSynonym(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling deleteSynonym(Async)" - ); - } - - return deleteSynonymCall(indexName, objectID, forwardToReplicas, _callback); - } - - /** - * Delete a single synonyms set, identified by the given objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return DeletedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public DeletedAtResponse deleteSynonym( - String indexName, - String objectID, - Boolean forwardToReplicas - ) throws ApiException { - Call req = deleteSynonymValidateBeforeCall( - indexName, - objectID, - forwardToReplicas, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.DeleteSynonym(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public DeletedAtResponse deleteSynonym(String indexName, String objectID) - throws ApiException { - return this.deleteSynonym(indexName, objectID, null); - } - - /** - * (asynchronously) Delete a single synonyms set, identified by the given objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteSynonymAsync( - String indexName, - String objectID, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = deleteSynonymValidateBeforeCall( - indexName, - objectID, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getApiKey - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getApiKeyCall(String key, final ApiCallback _callback) - throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/keys/{key}".replaceAll( - "\\{" + "key" + "\\}", - this.escapeString(key.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getApiKeyValidateBeforeCall( - String key, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'key' is set - if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling getApiKey(Async)" - ); - } - - return getApiKeyCall(key, _callback); - } - - /** - * Get the permissions of an API key. - * - * @param key API Key string. (required) - * @return Key - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public Key getApiKey(String key) throws ApiException { - Call req = getApiKeyValidateBeforeCall(key, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetApiKey(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Get the permissions of an API key. - * - * @param key API Key string. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getApiKeyAsync(String key, final ApiCallback _callback) - throws ApiException { - Call call = getApiKeyValidateBeforeCall(key, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getDictionaryLanguages - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getDictionaryLanguagesCall( - final ApiCallback> _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/dictionaries/*/languages"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getDictionaryLanguagesValidateBeforeCall( - final ApiCallback> _callback - ) throws ApiException { - return getDictionaryLanguagesCall(_callback); - } - - /** - * List dictionaries supported per language. - * - * @return Map<String, Languages> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public Map getDictionaryLanguages() throws ApiException { - Call req = getDictionaryLanguagesValidateBeforeCall(null); - if (req instanceof CallEcho) { - return new EchoResponse.GetDictionaryLanguages( - ((CallEcho) req).request() - ); - } - Call call = (Call) req; - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) List dictionaries supported per language. - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getDictionaryLanguagesAsync( - final ApiCallback> _callback - ) throws ApiException { - Call call = getDictionaryLanguagesValidateBeforeCall(_callback); - Type returnType = new TypeToken>() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getDictionarySettings - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getDictionarySettingsCall( - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/dictionaries/*/settings"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getDictionarySettingsValidateBeforeCall( - final ApiCallback _callback - ) throws ApiException { - return getDictionarySettingsCall(_callback); - } - - /** - * Retrieve dictionaries settings. - * - * @return GetDictionarySettingsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public GetDictionarySettingsResponse getDictionarySettings() - throws ApiException { - Call req = getDictionarySettingsValidateBeforeCall(null); - if (req instanceof CallEcho) { - return new EchoResponse.GetDictionarySettings(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Retrieve dictionaries settings. - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getDictionarySettingsAsync( - final ApiCallback _callback - ) throws ApiException { - Call call = getDictionarySettingsValidateBeforeCall(_callback); - Type returnType = new TypeToken() {} - .getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getLogs - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getLogsCall( - Integer offset, - Integer length, - String indexName, - String type, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/logs"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); - } - - if (length != null) { - queryParams.addAll(this.parameterToPair("length", length)); - } - - if (indexName != null) { - queryParams.addAll(this.parameterToPair("indexName", indexName)); - } - - if (type != null) { - queryParams.addAll(this.parameterToPair("type", type)); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getLogsValidateBeforeCall( - Integer offset, - Integer length, - String indexName, - String type, - final ApiCallback _callback - ) throws ApiException { - return getLogsCall(offset, length, indexName, type, _callback); - } - - /** - * Return the lastest log entries. - * - * @param offset First entry to retrieve (zero-based). Log entries are sorted by decreasing date, - * therefore 0 designates the most recent log entry. (optional, default to 0) - * @param length Maximum number of entries to retrieve. The maximum allowed value is 1000. - * (optional, default to 10) - * @param indexName Index for which log entries should be retrieved. When omitted, log entries are - * retrieved across all indices. (optional, default to null) - * @param type Type of log entries to retrieve. When omitted, all log entries are retrieved. - * (optional, default to all) - * @return GetLogsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public GetLogsResponse getLogs( - Integer offset, - Integer length, - String indexName, - String type - ) throws ApiException { - Call req = getLogsValidateBeforeCall(offset, length, indexName, type, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetLogs(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public GetLogsResponse getLogs() throws ApiException { - return this.getLogs(0, 10, "null", "all"); - } - - /** - * (asynchronously) Return the lastest log entries. - * - * @param offset First entry to retrieve (zero-based). Log entries are sorted by decreasing date, - * therefore 0 designates the most recent log entry. (optional, default to 0) - * @param length Maximum number of entries to retrieve. The maximum allowed value is 1000. - * (optional, default to 10) - * @param indexName Index for which log entries should be retrieved. When omitted, log entries are - * retrieved across all indices. (optional, default to null) - * @param type Type of log entries to retrieve. When omitted, all log entries are retrieved. - * (optional, default to all) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getLogsAsync( - Integer offset, - Integer length, - String indexName, - String type, - final ApiCallback _callback - ) throws ApiException { - Call call = getLogsValidateBeforeCall( - offset, - length, - indexName, - type, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getObject - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getObjectCall( - String indexName, - String objectID, - List attributesToRetrieve, - final ApiCallback> _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (attributesToRetrieve != null) { - queryParams.addAll( - this.parameterToPair("attributesToRetrieve", attributesToRetrieve) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getObjectValidateBeforeCall( - String indexName, - String objectID, - List attributesToRetrieve, - final ApiCallback> _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling getObject(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling getObject(Async)" - ); - } - - return getObjectCall(indexName, objectID, attributesToRetrieve, _callback); - } - - /** - * Retrieve one object from the index. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable - * attributes are returned. (optional) - * @return Map<String, String> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public Map getObject( - String indexName, - String objectID, - List attributesToRetrieve - ) throws ApiException { - Call req = getObjectValidateBeforeCall( - indexName, - objectID, - attributesToRetrieve, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.GetObject(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return res.getData(); - } - - public Map getObject(String indexName, String objectID) - throws ApiException { - return this.getObject(indexName, objectID, null); - } - - /** - * (asynchronously) Retrieve one object from the index. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable - * attributes are returned. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getObjectAsync( - String indexName, - String objectID, - List attributesToRetrieve, - final ApiCallback> _callback - ) throws ApiException { - Call call = getObjectValidateBeforeCall( - indexName, - objectID, - attributesToRetrieve, - _callback - ); - Type returnType = new TypeToken>() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getObjects - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getObjectsCall( - GetObjectsParams getObjectsParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = getObjectsParams; - - // create path and map variables - String path = "/1/indexes/*/objects"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getObjectsValidateBeforeCall( - GetObjectsParams getObjectsParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'getObjectsParams' is set - if (getObjectsParams == null) { - throw new ApiException( - "Missing the required parameter 'getObjectsParams' when calling getObjects(Async)" - ); - } - - return getObjectsCall(getObjectsParams, _callback); - } - - /** - * Retrieve one or more objects, potentially from different indices, in a single API call. - * - * @param getObjectsParams (required) - * @return GetObjectsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public GetObjectsResponse getObjects(GetObjectsParams getObjectsParams) - throws ApiException { - Call req = getObjectsValidateBeforeCall(getObjectsParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetObjects(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Retrieve one or more objects, potentially from different indices, in a single - * API call. - * - * @param getObjectsParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getObjectsAsync( - GetObjectsParams getObjectsParams, - final ApiCallback _callback - ) throws ApiException { - Call call = getObjectsValidateBeforeCall(getObjectsParams, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getRule - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getRuleCall( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/rules/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getRuleValidateBeforeCall( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling getRule(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling getRule(Async)" - ); - } - - return getRuleCall(indexName, objectID, _callback); - } - - /** - * Retrieve the Rule with the specified objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @return Rule - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public Rule getRule(String indexName, String objectID) throws ApiException { - Call req = getRuleValidateBeforeCall(indexName, objectID, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetRule(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Retrieve the Rule with the specified objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getRuleAsync( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - Call call = getRuleValidateBeforeCall(indexName, objectID, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getSettings - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getSettingsCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/settings".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getSettingsValidateBeforeCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling getSettings(Async)" - ); - } - - return getSettingsCall(indexName, _callback); - } - - /** - * Retrieve settings of a given indexName. - * - * @param indexName The index in which to perform the request. (required) - * @return IndexSettings - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public IndexSettings getSettings(String indexName) throws ApiException { - Call req = getSettingsValidateBeforeCall(indexName, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetSettings(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Retrieve settings of a given indexName. - * - * @param indexName The index in which to perform the request. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getSettingsAsync( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Call call = getSettingsValidateBeforeCall(indexName, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getSources - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getSourcesCall(final ApiCallback> _callback) - throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/security/sources"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getSourcesValidateBeforeCall( - final ApiCallback> _callback - ) throws ApiException { - return getSourcesCall(_callback); - } - - /** - * List all allowed sources. - * - * @return List<Source> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public List getSources() throws ApiException { - Call req = getSourcesValidateBeforeCall(null); - if (req instanceof CallEcho) { - return new EchoResponse.GetSources(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) List all allowed sources. - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getSourcesAsync(final ApiCallback> _callback) - throws ApiException { - Call call = getSourcesValidateBeforeCall(_callback); - Type returnType = new TypeToken>() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getSynonym - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getSynonymCall( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/synonyms/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getSynonymValidateBeforeCall( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling getSynonym(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling getSynonym(Async)" - ); - } - - return getSynonymCall(indexName, objectID, _callback); - } - - /** - * Fetch a synonym object identified by its objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @return SynonymHit - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SynonymHit getSynonym(String indexName, String objectID) - throws ApiException { - Call req = getSynonymValidateBeforeCall(indexName, objectID, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetSynonym(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Fetch a synonym object identified by its objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getSynonymAsync( - String indexName, - String objectID, - final ApiCallback _callback - ) throws ApiException { - Call call = getSynonymValidateBeforeCall(indexName, objectID, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getTask - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getTaskCall( - String indexName, - Integer taskID, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/task/{taskID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "taskID" + "\\}", - this.escapeString(taskID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getTaskValidateBeforeCall( - String indexName, - Integer taskID, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling getTask(Async)" - ); - } - - // verify the required parameter 'taskID' is set - if (taskID == null) { - throw new ApiException( - "Missing the required parameter 'taskID' when calling getTask(Async)" - ); - } - - return getTaskCall(indexName, taskID, _callback); - } - - /** - * Check the current status of a given task. - * - * @param indexName The index in which to perform the request. (required) - * @param taskID Unique identifier of an task. Numeric value (up to 64bits) (required) - * @return GetTaskResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public GetTaskResponse getTask(String indexName, Integer taskID) - throws ApiException { - Call req = getTaskValidateBeforeCall(indexName, taskID, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetTask(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Check the current status of a given task. - * - * @param indexName The index in which to perform the request. (required) - * @param taskID Unique identifier of an task. Numeric value (up to 64bits) (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getTaskAsync( - String indexName, - Integer taskID, - final ApiCallback _callback - ) throws ApiException { - Call call = getTaskValidateBeforeCall(indexName, taskID, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getTopUserIds - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getTopUserIdsCall( - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/clusters/mapping/top"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getTopUserIdsValidateBeforeCall( - final ApiCallback _callback - ) throws ApiException { - return getTopUserIdsCall(_callback); - } - - /** - * Get the top 10 userIDs with the highest number of records per cluster. The data returned will - * usually be a few seconds behind real time, because userID usage may take up to a few seconds to - * propagate to the different clusters. Upon success, the response is 200 OK and contains the - * following array of userIDs and clusters. - * - * @return GetTopUserIdsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public GetTopUserIdsResponse getTopUserIds() throws ApiException { - Call req = getTopUserIdsValidateBeforeCall(null); - if (req instanceof CallEcho) { - return new EchoResponse.GetTopUserIds(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Get the top 10 userIDs with the highest number of records per cluster. The - * data returned will usually be a few seconds behind real time, because userID usage may take up - * to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK - * and contains the following array of userIDs and clusters. - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getTopUserIdsAsync( - final ApiCallback _callback - ) throws ApiException { - Call call = getTopUserIdsValidateBeforeCall(_callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for getUserId - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call getUserIdCall( - String userID, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/clusters/mapping/{userID}".replaceAll( - "\\{" + "userID" + "\\}", - this.escapeString(userID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call getUserIdValidateBeforeCall( - String userID, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'userID' is set - if (userID == null) { - throw new ApiException( - "Missing the required parameter 'userID' when calling getUserId(Async)" - ); - } - - return getUserIdCall(userID, _callback); - } - - /** - * Returns the userID data stored in the mapping. The data returned will usually be a few seconds - * behind real time, because userID usage may take up to a few seconds to propagate to the - * different clusters. Upon success, the response is 200 OK and contains the following userID - * data. - * - * @param userID userID to assign. (required) - * @return UserId - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UserId getUserId(String userID) throws ApiException { - Call req = getUserIdValidateBeforeCall(userID, null); - if (req instanceof CallEcho) { - return new EchoResponse.GetUserId(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Returns the userID data stored in the mapping. The data returned will usually - * be a few seconds behind real time, because userID usage may take up to a few seconds to - * propagate to the different clusters. Upon success, the response is 200 OK and contains the - * following userID data. - * - * @param userID userID to assign. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getUserIdAsync( - String userID, - final ApiCallback _callback - ) throws ApiException { - Call call = getUserIdValidateBeforeCall(userID, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for hasPendingMappings - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call hasPendingMappingsCall( - Boolean getClusters, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/clusters/mapping/pending"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (getClusters != null) { - queryParams.addAll(this.parameterToPair("getClusters", getClusters)); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call hasPendingMappingsValidateBeforeCall( - Boolean getClusters, - final ApiCallback _callback - ) throws ApiException { - return hasPendingMappingsCall(getClusters, _callback); - } - - /** - * Get the status of your clusters' migrations or user creations. Creating a large batch of users - * or migrating your multi-cluster may take quite some time. This method lets you retrieve the - * status of the migration, so you can know when it's done. Upon success, the response is 200 OK. - * A successful response indicates that the operation has been taken into account, and the userIDs - * are directly usable. - * - * @param getClusters Whether to get clusters or not. (optional) - * @return CreatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public CreatedAtResponse hasPendingMappings(Boolean getClusters) - throws ApiException { - Call req = hasPendingMappingsValidateBeforeCall(getClusters, null); - if (req instanceof CallEcho) { - return new EchoResponse.HasPendingMappings(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public CreatedAtResponse hasPendingMappings() throws ApiException { - return this.hasPendingMappings(null); - } - - /** - * (asynchronously) Get the status of your clusters' migrations or user creations. Creating a - * large batch of users or migrating your multi-cluster may take quite some time. This method lets - * you retrieve the status of the migration, so you can know when it's done. Upon success, the - * response is 200 OK. A successful response indicates that the operation has been taken into - * account, and the userIDs are directly usable. - * - * @param getClusters Whether to get clusters or not. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call hasPendingMappingsAsync( - Boolean getClusters, - final ApiCallback _callback - ) throws ApiException { - Call call = hasPendingMappingsValidateBeforeCall(getClusters, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for listApiKeys - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call listApiKeysCall( - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/keys"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call listApiKeysValidateBeforeCall( - final ApiCallback _callback - ) throws ApiException { - return listApiKeysCall(_callback); - } - - /** - * List API keys, along with their associated rights. - * - * @return ListApiKeysResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public ListApiKeysResponse listApiKeys() throws ApiException { - Call req = listApiKeysValidateBeforeCall(null); - if (req instanceof CallEcho) { - return new EchoResponse.ListApiKeys(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) List API keys, along with their associated rights. - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call listApiKeysAsync( - final ApiCallback _callback - ) throws ApiException { - Call call = listApiKeysValidateBeforeCall(_callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for listClusters - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call listClustersCall( - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/clusters"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call listClustersValidateBeforeCall( - final ApiCallback _callback - ) throws ApiException { - return listClustersCall(_callback); - } - - /** - * List the clusters available in a multi-clusters setup for a single appID. Upon success, the - * response is 200 OK and contains the following clusters. - * - * @return ListClustersResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public ListClustersResponse listClusters() throws ApiException { - Call req = listClustersValidateBeforeCall(null); - if (req instanceof CallEcho) { - return new EchoResponse.ListClusters(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) List the clusters available in a multi-clusters setup for a single appID. Upon - * success, the response is 200 OK and contains the following clusters. - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call listClustersAsync( - final ApiCallback _callback - ) throws ApiException { - Call call = listClustersValidateBeforeCall(_callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for listIndices - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call listIndicesCall( - Integer page, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/indexes"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (page != null) { - queryParams.addAll(this.parameterToPair("page", page)); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call listIndicesValidateBeforeCall( - Integer page, - final ApiCallback _callback - ) throws ApiException { - return listIndicesCall(page, _callback); - } - - /** - * List existing indexes from an application. - * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @return ListIndicesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public ListIndicesResponse listIndices(Integer page) throws ApiException { - Call req = listIndicesValidateBeforeCall(page, null); - if (req instanceof CallEcho) { - return new EchoResponse.ListIndices(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public ListIndicesResponse listIndices() throws ApiException { - return this.listIndices(null); - } - - /** - * (asynchronously) List existing indexes from an application. - * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call listIndicesAsync( - Integer page, - final ApiCallback _callback - ) throws ApiException { - Call call = listIndicesValidateBeforeCall(page, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for listUserIds - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call listUserIdsCall( - Integer page, - Integer hitsPerPage, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = "/1/clusters/mapping"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (page != null) { - queryParams.addAll(this.parameterToPair("page", page)); - } - - if (hitsPerPage != null) { - queryParams.addAll(this.parameterToPair("hitsPerPage", hitsPerPage)); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "GET", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call listUserIdsValidateBeforeCall( - Integer page, - Integer hitsPerPage, - final ApiCallback _callback - ) throws ApiException { - return listUserIdsCall(page, hitsPerPage, _callback); - } - - /** - * List the userIDs assigned to a multi-clusters appID. The data returned will usually be a few - * seconds behind real time, because userID usage may take up to a few seconds to propagate to the - * different clusters. Upon success, the response is 200 OK and contains the following userIDs - * data. - * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) - * @return ListUserIdsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public ListUserIdsResponse listUserIds(Integer page, Integer hitsPerPage) - throws ApiException { - Call req = listUserIdsValidateBeforeCall(page, hitsPerPage, null); - if (req instanceof CallEcho) { - return new EchoResponse.ListUserIds(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public ListUserIdsResponse listUserIds() throws ApiException { - return this.listUserIds(null, 100); - } - - /** - * (asynchronously) List the userIDs assigned to a multi-clusters appID. The data returned will - * usually be a few seconds behind real time, because userID usage may take up to a few seconds to - * propagate to the different clusters. Upon success, the response is 200 OK and contains the - * following userIDs data. - * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call listUserIdsAsync( - Integer page, - Integer hitsPerPage, - final ApiCallback _callback - ) throws ApiException { - Call call = listUserIdsValidateBeforeCall(page, hitsPerPage, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for multipleBatch - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call multipleBatchCall( - BatchParams batchParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = batchParams; - - // create path and map variables - String path = "/1/indexes/*/batch"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call multipleBatchValidateBeforeCall( - BatchParams batchParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'batchParams' is set - if (batchParams == null) { - throw new ApiException( - "Missing the required parameter 'batchParams' when calling multipleBatch(Async)" - ); - } - - return multipleBatchCall(batchParams, _callback); - } - - /** - * Perform multiple write operations, potentially targeting multiple indices, in a single API - * call. - * - * @param batchParams (required) - * @return MultipleBatchResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public MultipleBatchResponse multipleBatch(BatchParams batchParams) - throws ApiException { - Call req = multipleBatchValidateBeforeCall(batchParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.MultipleBatch(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Perform multiple write operations, potentially targeting multiple indices, in - * a single API call. - * - * @param batchParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call multipleBatchAsync( - BatchParams batchParams, - final ApiCallback _callback - ) throws ApiException { - Call call = multipleBatchValidateBeforeCall(batchParams, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for multipleQueries - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call multipleQueriesCall( - MultipleQueriesParams multipleQueriesParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = multipleQueriesParams; - - // create path and map variables - String path = "/1/indexes/*/queries"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call multipleQueriesValidateBeforeCall( - MultipleQueriesParams multipleQueriesParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'multipleQueriesParams' is set - if (multipleQueriesParams == null) { - throw new ApiException( - "Missing the required parameter 'multipleQueriesParams' when calling" + - " multipleQueries(Async)" - ); - } - - return multipleQueriesCall(multipleQueriesParams, _callback); - } - - /** - * Get search results for the given requests. - * - * @param multipleQueriesParams (required) - * @return MultipleQueriesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public MultipleQueriesResponse multipleQueries( - MultipleQueriesParams multipleQueriesParams - ) throws ApiException { - Call req = multipleQueriesValidateBeforeCall(multipleQueriesParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.MultipleQueries(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Get search results for the given requests. - * - * @param multipleQueriesParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call multipleQueriesAsync( - MultipleQueriesParams multipleQueriesParams, - final ApiCallback _callback - ) throws ApiException { - Call call = multipleQueriesValidateBeforeCall( - multipleQueriesParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for operationIndex - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call operationIndexCall( - String indexName, - OperationIndexParams operationIndexParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = operationIndexParams; - - // create path and map variables - String path = - "/1/indexes/{indexName}/operation".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call operationIndexValidateBeforeCall( - String indexName, - OperationIndexParams operationIndexParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling operationIndex(Async)" - ); - } - - // verify the required parameter 'operationIndexParams' is set - if (operationIndexParams == null) { - throw new ApiException( - "Missing the required parameter 'operationIndexParams' when calling" + - " operationIndex(Async)" - ); - } - - return operationIndexCall(indexName, operationIndexParams, _callback); - } - - /** - * Peforms a copy or a move operation on a index. - * - * @param indexName The index in which to perform the request. (required) - * @param operationIndexParams (required) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse operationIndex( - String indexName, - OperationIndexParams operationIndexParams - ) throws ApiException { - Call req = operationIndexValidateBeforeCall( - indexName, - operationIndexParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.OperationIndex(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Peforms a copy or a move operation on a index. - * - * @param indexName The index in which to perform the request. (required) - * @param operationIndexParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call operationIndexAsync( - String indexName, - OperationIndexParams operationIndexParams, - final ApiCallback _callback - ) throws ApiException { - Call call = operationIndexValidateBeforeCall( - indexName, - operationIndexParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for partialUpdateObject - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call partialUpdateObjectCall( - String indexName, - String objectID, - List> oneOfstringbuiltInOperation, - Boolean createIfNotExists, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = oneOfstringbuiltInOperation; - - // create path and map variables - String path = - "/1/indexes/{indexName}/{objectID}/partial".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (createIfNotExists != null) { - queryParams.addAll( - this.parameterToPair("createIfNotExists", createIfNotExists) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call partialUpdateObjectValidateBeforeCall( - String indexName, - String objectID, - List> oneOfstringbuiltInOperation, - Boolean createIfNotExists, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling partialUpdateObject(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling partialUpdateObject(Async)" - ); - } - - // verify the required parameter 'oneOfstringbuiltInOperation' is set - if (oneOfstringbuiltInOperation == null) { - throw new ApiException( - "Missing the required parameter 'oneOfstringbuiltInOperation' when calling" + - " partialUpdateObject(Async)" - ); - } - - return partialUpdateObjectCall( - indexName, - objectID, - oneOfstringbuiltInOperation, - createIfNotExists, - _callback - ); - } - - /** - * Update one or more attributes of an existing object. This method lets you update only a part of - * an existing object, either by adding new attributes or updating existing ones. You can - * partially update several objects in a single method call. If the index targeted by this - * operation doesn't exist yet, it's automatically created. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param oneOfstringbuiltInOperation List of attributes to update. (required) - * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to - * true) - * @return UpdatedAtWithObjectIdResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtWithObjectIdResponse partialUpdateObject( - String indexName, - String objectID, - List> oneOfstringbuiltInOperation, - Boolean createIfNotExists - ) throws ApiException { - Call req = partialUpdateObjectValidateBeforeCall( - indexName, - objectID, - oneOfstringbuiltInOperation, - createIfNotExists, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.PartialUpdateObject(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtWithObjectIdResponse partialUpdateObject( - String indexName, - String objectID, - List> oneOfstringbuiltInOperation - ) throws ApiException { - return this.partialUpdateObject( - indexName, - objectID, - oneOfstringbuiltInOperation, - true - ); - } - - /** - * (asynchronously) Update one or more attributes of an existing object. This method lets you - * update only a part of an existing object, either by adding new attributes or updating existing - * ones. You can partially update several objects in a single method call. If the index targeted - * by this operation doesn't exist yet, it's automatically created. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param oneOfstringbuiltInOperation List of attributes to update. (required) - * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to - * true) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call partialUpdateObjectAsync( - String indexName, - String objectID, - List> oneOfstringbuiltInOperation, - Boolean createIfNotExists, - final ApiCallback _callback - ) throws ApiException { - Call call = partialUpdateObjectValidateBeforeCall( - indexName, - objectID, - oneOfstringbuiltInOperation, - createIfNotExists, - _callback - ); - Type returnType = new TypeToken() {} - .getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for removeUserId - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call removeUserIdCall( - String userID, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/clusters/mapping/{userID}".replaceAll( - "\\{" + "userID" + "\\}", - this.escapeString(userID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "DELETE", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call removeUserIdValidateBeforeCall( - String userID, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'userID' is set - if (userID == null) { - throw new ApiException( - "Missing the required parameter 'userID' when calling removeUserId(Async)" - ); - } - - return removeUserIdCall(userID, _callback); - } - - /** - * Remove a userID and its associated data from the multi-clusters. Upon success, the response is - * 200 OK and a task is created to remove the userID data and mapping. - * - * @param userID userID to assign. (required) - * @return RemoveUserIdResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public RemoveUserIdResponse removeUserId(String userID) throws ApiException { - Call req = removeUserIdValidateBeforeCall(userID, null); - if (req instanceof CallEcho) { - return new EchoResponse.RemoveUserId(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Remove a userID and its associated data from the multi-clusters. Upon success, - * the response is 200 OK and a task is created to remove the userID data and mapping. - * - * @param userID userID to assign. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call removeUserIdAsync( - String userID, - final ApiCallback _callback - ) throws ApiException { - Call call = removeUserIdValidateBeforeCall(userID, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for replaceSources - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call replaceSourcesCall( - List source, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = source; - - // create path and map variables - String path = "/1/security/sources"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call replaceSourcesValidateBeforeCall( - List source, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'source' is set - if (source == null) { - throw new ApiException( - "Missing the required parameter 'source' when calling replaceSources(Async)" - ); - } - - return replaceSourcesCall(source, _callback); - } - - /** - * Replace all allowed sources. - * - * @param source The sources to allow. (required) - * @return ReplaceSourceResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public ReplaceSourceResponse replaceSources(List source) - throws ApiException { - Call req = replaceSourcesValidateBeforeCall(source, null); - if (req instanceof CallEcho) { - return new EchoResponse.ReplaceSources(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Replace all allowed sources. - * - * @param source The sources to allow. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call replaceSourcesAsync( - List source, - final ApiCallback _callback - ) throws ApiException { - Call call = replaceSourcesValidateBeforeCall(source, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for restoreApiKey - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call restoreApiKeyCall( - String key, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/keys/{key}/restore".replaceAll( - "\\{" + "key" + "\\}", - this.escapeString(key.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call restoreApiKeyValidateBeforeCall( - String key, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'key' is set - if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling restoreApiKey(Async)" - ); - } - - return restoreApiKeyCall(key, _callback); - } - - /** - * Restore a deleted API key, along with its associated rights. - * - * @param key API Key string. (required) - * @return AddApiKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public AddApiKeyResponse restoreApiKey(String key) throws ApiException { - Call req = restoreApiKeyValidateBeforeCall(key, null); - if (req instanceof CallEcho) { - return new EchoResponse.RestoreApiKey(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Restore a deleted API key, along with its associated rights. - * - * @param key API Key string. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call restoreApiKeyAsync( - String key, - final ApiCallback _callback - ) throws ApiException { - Call call = restoreApiKeyValidateBeforeCall(key, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for saveObject - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call saveObjectCall( - String indexName, - Object body, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = body; - - // create path and map variables - String path = - "/1/indexes/{indexName}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call saveObjectValidateBeforeCall( - String indexName, - Object body, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling saveObject(Async)" - ); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException( - "Missing the required parameter 'body' when calling saveObject(Async)" - ); - } - - return saveObjectCall(indexName, body, _callback); - } - - /** - * Add an object to the index, automatically assigning it an object ID. - * - * @param indexName The index in which to perform the request. (required) - * @param body The Algolia record. (required) - * @return SaveObjectResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SaveObjectResponse saveObject(String indexName, Object body) - throws ApiException { - Call req = saveObjectValidateBeforeCall(indexName, body, null); - if (req instanceof CallEcho) { - return new EchoResponse.SaveObject(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Add an object to the index, automatically assigning it an object ID. - * - * @param indexName The index in which to perform the request. (required) - * @param body The Algolia record. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call saveObjectAsync( - String indexName, - Object body, - final ApiCallback _callback - ) throws ApiException { - Call call = saveObjectValidateBeforeCall(indexName, body, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for saveRule - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call saveRuleCall( - String indexName, - String objectID, - Rule rule, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = rule; - - // create path and map variables - String path = - "/1/indexes/{indexName}/rules/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call saveRuleValidateBeforeCall( - String indexName, - String objectID, - Rule rule, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling saveRule(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling saveRule(Async)" - ); - } - - // verify the required parameter 'rule' is set - if (rule == null) { - throw new ApiException( - "Missing the required parameter 'rule' when calling saveRule(Async)" - ); - } - - return saveRuleCall( - indexName, - objectID, - rule, - forwardToReplicas, - _callback - ); - } - - /** - * Create or update the Rule with the specified objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param rule (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return UpdatedRuleResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedRuleResponse saveRule( - String indexName, - String objectID, - Rule rule, - Boolean forwardToReplicas - ) throws ApiException { - Call req = saveRuleValidateBeforeCall( - indexName, - objectID, - rule, - forwardToReplicas, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SaveRule(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedRuleResponse saveRule( - String indexName, - String objectID, - Rule rule - ) throws ApiException { - return this.saveRule(indexName, objectID, rule, null); - } - - /** - * (asynchronously) Create or update the Rule with the specified objectID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param rule (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call saveRuleAsync( - String indexName, - String objectID, - Rule rule, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = saveRuleValidateBeforeCall( - indexName, - objectID, - rule, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for saveSynonym - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call saveSynonymCall( - String indexName, - String objectID, - SynonymHit synonymHit, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = synonymHit; - - // create path and map variables - String path = - "/1/indexes/{indexName}/synonyms/{objectID}".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "objectID" + "\\}", - this.escapeString(objectID.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call saveSynonymValidateBeforeCall( - String indexName, - String objectID, - SynonymHit synonymHit, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling saveSynonym(Async)" - ); - } - - // verify the required parameter 'objectID' is set - if (objectID == null) { - throw new ApiException( - "Missing the required parameter 'objectID' when calling saveSynonym(Async)" - ); - } - - // verify the required parameter 'synonymHit' is set - if (synonymHit == null) { - throw new ApiException( - "Missing the required parameter 'synonymHit' when calling saveSynonym(Async)" - ); - } - - return saveSynonymCall( - indexName, - objectID, - synonymHit, - forwardToReplicas, - _callback - ); - } - - /** - * Create a new synonym object or update the existing synonym object with the given object ID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param synonymHit (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return SaveSynonymResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SaveSynonymResponse saveSynonym( - String indexName, - String objectID, - SynonymHit synonymHit, - Boolean forwardToReplicas - ) throws ApiException { - Call req = saveSynonymValidateBeforeCall( - indexName, - objectID, - synonymHit, - forwardToReplicas, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SaveSynonym(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public SaveSynonymResponse saveSynonym( - String indexName, - String objectID, - SynonymHit synonymHit - ) throws ApiException { - return this.saveSynonym(indexName, objectID, synonymHit, null); - } - - /** - * (asynchronously) Create a new synonym object or update the existing synonym object with the - * given object ID. - * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param synonymHit (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call saveSynonymAsync( - String indexName, - String objectID, - SynonymHit synonymHit, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = saveSynonymValidateBeforeCall( - indexName, - objectID, - synonymHit, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for saveSynonyms - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call saveSynonymsCall( - String indexName, - List synonymHit, - Boolean forwardToReplicas, - Boolean replaceExistingSynonyms, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = synonymHit; - - // create path and map variables - String path = - "/1/indexes/{indexName}/synonyms/batch".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - if (replaceExistingSynonyms != null) { - queryParams.addAll( - this.parameterToPair("replaceExistingSynonyms", replaceExistingSynonyms) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call saveSynonymsValidateBeforeCall( - String indexName, - List synonymHit, - Boolean forwardToReplicas, - Boolean replaceExistingSynonyms, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling saveSynonyms(Async)" - ); - } - - // verify the required parameter 'synonymHit' is set - if (synonymHit == null) { - throw new ApiException( - "Missing the required parameter 'synonymHit' when calling saveSynonyms(Async)" - ); - } - - return saveSynonymsCall( - indexName, - synonymHit, - forwardToReplicas, - replaceExistingSynonyms, - _callback - ); - } - - /** - * Create/update multiple synonym objects at once, potentially replacing the entire list of - * synonyms if replaceExistingSynonyms is true. - * - * @param indexName The index in which to perform the request. (required) - * @param synonymHit (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this - * request. (optional) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse saveSynonyms( - String indexName, - List synonymHit, - Boolean forwardToReplicas, - Boolean replaceExistingSynonyms - ) throws ApiException { - Call req = saveSynonymsValidateBeforeCall( - indexName, - synonymHit, - forwardToReplicas, - replaceExistingSynonyms, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SaveSynonyms(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtResponse saveSynonyms( - String indexName, - List synonymHit - ) throws ApiException { - return this.saveSynonyms(indexName, synonymHit, null, null); - } - - /** - * (asynchronously) Create/update multiple synonym objects at once, potentially replacing the - * entire list of synonyms if replaceExistingSynonyms is true. - * - * @param indexName The index in which to perform the request. (required) - * @param synonymHit (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this - * request. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call saveSynonymsAsync( - String indexName, - List synonymHit, - Boolean forwardToReplicas, - Boolean replaceExistingSynonyms, - final ApiCallback _callback - ) throws ApiException { - Call call = saveSynonymsValidateBeforeCall( - indexName, - synonymHit, - forwardToReplicas, - replaceExistingSynonyms, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for search - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call searchCall( - String indexName, - SearchParams searchParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = searchParams; - - // create path and map variables - String path = - "/1/indexes/{indexName}/query".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call searchValidateBeforeCall( - String indexName, - SearchParams searchParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling search(Async)" - ); - } - - // verify the required parameter 'searchParams' is set - if (searchParams == null) { - throw new ApiException( - "Missing the required parameter 'searchParams' when calling search(Async)" - ); - } - - return searchCall(indexName, searchParams, _callback); - } - - /** - * Get search results. - * - * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) - * @return SearchResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SearchResponse search(String indexName, SearchParams searchParams) - throws ApiException { - Call req = searchValidateBeforeCall(indexName, searchParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.Search(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Get search results. - * - * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call searchAsync( - String indexName, - SearchParams searchParams, - final ApiCallback _callback - ) throws ApiException { - Call call = searchValidateBeforeCall(indexName, searchParams, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for searchDictionaryEntries - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call searchDictionaryEntriesCall( - String dictionaryName, - SearchDictionaryEntriesParams searchDictionaryEntriesParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = searchDictionaryEntriesParams; - - // create path and map variables - String path = - "/1/dictionaries/{dictionaryName}/search".replaceAll( - "\\{" + "dictionaryName" + "\\}", - this.escapeString(dictionaryName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call searchDictionaryEntriesValidateBeforeCall( - String dictionaryName, - SearchDictionaryEntriesParams searchDictionaryEntriesParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'dictionaryName' is set - if (dictionaryName == null) { - throw new ApiException( - "Missing the required parameter 'dictionaryName' when calling" + - " searchDictionaryEntries(Async)" - ); - } - - // verify the required parameter 'searchDictionaryEntriesParams' is set - if (searchDictionaryEntriesParams == null) { - throw new ApiException( - "Missing the required parameter 'searchDictionaryEntriesParams' when calling" + - " searchDictionaryEntries(Async)" - ); - } - - return searchDictionaryEntriesCall( - dictionaryName, - searchDictionaryEntriesParams, - _callback - ); - } - - /** - * Search the dictionary entries. - * - * @param dictionaryName The dictionary to search in. (required) - * @param searchDictionaryEntriesParams (required) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse searchDictionaryEntries( - String dictionaryName, - SearchDictionaryEntriesParams searchDictionaryEntriesParams - ) throws ApiException { - Call req = searchDictionaryEntriesValidateBeforeCall( - dictionaryName, - searchDictionaryEntriesParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SearchDictionaryEntries( - ((CallEcho) req).request() - ); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Search the dictionary entries. - * - * @param dictionaryName The dictionary to search in. (required) - * @param searchDictionaryEntriesParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call searchDictionaryEntriesAsync( - String dictionaryName, - SearchDictionaryEntriesParams searchDictionaryEntriesParams, - final ApiCallback _callback - ) throws ApiException { - Call call = searchDictionaryEntriesValidateBeforeCall( - dictionaryName, - searchDictionaryEntriesParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for searchForFacetValues - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call searchForFacetValuesCall( - String indexName, - String facetName, - SearchForFacetValuesRequest searchForFacetValuesRequest, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = searchForFacetValuesRequest; - - // create path and map variables - String path = - "/1/indexes/{indexName}/facets/{facetName}/query".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ) - .replaceAll( - "\\{" + "facetName" + "\\}", - this.escapeString(facetName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call searchForFacetValuesValidateBeforeCall( - String indexName, - String facetName, - SearchForFacetValuesRequest searchForFacetValuesRequest, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling searchForFacetValues(Async)" - ); - } - - // verify the required parameter 'facetName' is set - if (facetName == null) { - throw new ApiException( - "Missing the required parameter 'facetName' when calling searchForFacetValues(Async)" - ); - } - - return searchForFacetValuesCall( - indexName, - facetName, - searchForFacetValuesRequest, - _callback - ); - } - - /** - * Search for values of a given facet, optionally restricting the returned values to those - * contained in objects matching other search criteria. - * - * @param indexName The index in which to perform the request. (required) - * @param facetName The facet name. (required) - * @param searchForFacetValuesRequest (optional) - * @return SearchForFacetValuesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SearchForFacetValuesResponse searchForFacetValues( - String indexName, - String facetName, - SearchForFacetValuesRequest searchForFacetValuesRequest - ) throws ApiException { - Call req = searchForFacetValuesValidateBeforeCall( - indexName, - facetName, - searchForFacetValuesRequest, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SearchForFacetValues(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); - } - - public SearchForFacetValuesResponse searchForFacetValues( - String indexName, - String facetName - ) throws ApiException { - return this.searchForFacetValues(indexName, facetName, null); - } - - /** - * (asynchronously) Search for values of a given facet, optionally restricting the returned values - * to those contained in objects matching other search criteria. - * - * @param indexName The index in which to perform the request. (required) - * @param facetName The facet name. (required) - * @param searchForFacetValuesRequest (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call searchForFacetValuesAsync( - String indexName, - String facetName, - SearchForFacetValuesRequest searchForFacetValuesRequest, - final ApiCallback _callback - ) throws ApiException { - Call call = searchForFacetValuesValidateBeforeCall( - indexName, - facetName, - searchForFacetValuesRequest, - _callback - ); - Type returnType = new TypeToken() {} - .getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for searchRules - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call searchRulesCall( - String indexName, - SearchRulesParams searchRulesParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = searchRulesParams; - - // create path and map variables - String path = - "/1/indexes/{indexName}/rules/search".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call searchRulesValidateBeforeCall( - String indexName, - SearchRulesParams searchRulesParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling searchRules(Async)" - ); - } - - // verify the required parameter 'searchRulesParams' is set - if (searchRulesParams == null) { - throw new ApiException( - "Missing the required parameter 'searchRulesParams' when calling searchRules(Async)" - ); - } - - return searchRulesCall(indexName, searchRulesParams, _callback); - } - - /** - * Search for rules matching various criteria. - * - * @param indexName The index in which to perform the request. (required) - * @param searchRulesParams (required) - * @return SearchRulesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SearchRulesResponse searchRules( - String indexName, - SearchRulesParams searchRulesParams - ) throws ApiException { - Call req = searchRulesValidateBeforeCall( - indexName, - searchRulesParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SearchRules(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Search for rules matching various criteria. - * - * @param indexName The index in which to perform the request. (required) - * @param searchRulesParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call searchRulesAsync( - String indexName, - SearchRulesParams searchRulesParams, - final ApiCallback _callback - ) throws ApiException { - Call call = searchRulesValidateBeforeCall( - indexName, - searchRulesParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for searchSynonyms - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call searchSynonymsCall( - String indexName, - String query, - SynonymType type, - Integer page, - Integer hitsPerPage, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = null; - - // create path and map variables - String path = - "/1/indexes/{indexName}/synonyms/search".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (query != null) { - queryParams.addAll(this.parameterToPair("query", query)); - } - - if (type != null) { - queryParams.addAll(this.parameterToPair("type", type)); - } - - if (page != null) { - queryParams.addAll(this.parameterToPair("page", page)); - } - - if (hitsPerPage != null) { - queryParams.addAll(this.parameterToPair("hitsPerPage", hitsPerPage)); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call searchSynonymsValidateBeforeCall( - String indexName, - String query, - SynonymType type, - Integer page, - Integer hitsPerPage, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling searchSynonyms(Async)" - ); - } - - return searchSynonymsCall( - indexName, - query, - type, - page, - hitsPerPage, - _callback - ); - } - - /** - * Search or browse all synonyms, optionally filtering them by type. - * - * @param indexName The index in which to perform the request. (required) - * @param query Search for specific synonyms matching this string. (optional, default to ) - * @param type Only search for specific types of synonyms. (optional) - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional, default to 0) - * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) - * @return SearchSynonymsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SearchSynonymsResponse searchSynonyms( - String indexName, - String query, - SynonymType type, - Integer page, - Integer hitsPerPage - ) throws ApiException { - Call req = searchSynonymsValidateBeforeCall( - indexName, - query, - type, - page, - hitsPerPage, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SearchSynonyms(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public SearchSynonymsResponse searchSynonyms(String indexName) - throws ApiException { - return this.searchSynonyms(indexName, "", null, 0, 100); - } - - /** - * (asynchronously) Search or browse all synonyms, optionally filtering them by type. - * - * @param indexName The index in which to perform the request. (required) - * @param query Search for specific synonyms matching this string. (optional, default to ) - * @param type Only search for specific types of synonyms. (optional) - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional, default to 0) - * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call searchSynonymsAsync( - String indexName, - String query, - SynonymType type, - Integer page, - Integer hitsPerPage, - final ApiCallback _callback - ) throws ApiException { - Call call = searchSynonymsValidateBeforeCall( - indexName, - query, - type, - page, - hitsPerPage, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for searchUserIds - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call searchUserIdsCall( - SearchUserIdsParams searchUserIdsParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = searchUserIdsParams; - - // create path and map variables - String path = "/1/clusters/mapping/search"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "POST", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call searchUserIdsValidateBeforeCall( - SearchUserIdsParams searchUserIdsParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'searchUserIdsParams' is set - if (searchUserIdsParams == null) { - throw new ApiException( - "Missing the required parameter 'searchUserIdsParams' when calling searchUserIds(Async)" - ); - } - - return searchUserIdsCall(searchUserIdsParams, _callback); - } - - /** - * Search for userIDs. The data returned will usually be a few seconds behind real time, because - * userID usage may take up to a few seconds propagate to the different clusters. To keep updates - * moving quickly, the index of userIDs isn't built synchronously with the mapping. Instead, the - * index is built once every 12h, at the same time as the update of userID usage. For example, - * when you perform a modification like adding or moving a userID, the search will report an - * outdated value until the next rebuild of the mapping, which takes place every 12h. Upon - * success, the response is 200 OK and contains the following userIDs data. - * - * @param searchUserIdsParams (required) - * @return SearchUserIdsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public SearchUserIdsResponse searchUserIds( - SearchUserIdsParams searchUserIdsParams - ) throws ApiException { - Call req = searchUserIdsValidateBeforeCall(searchUserIdsParams, null); - if (req instanceof CallEcho) { - return new EchoResponse.SearchUserIds(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Search for userIDs. The data returned will usually be a few seconds behind - * real time, because userID usage may take up to a few seconds propagate to the different - * clusters. To keep updates moving quickly, the index of userIDs isn't built synchronously - * with the mapping. Instead, the index is built once every 12h, at the same time as the update of - * userID usage. For example, when you perform a modification like adding or moving a userID, the - * search will report an outdated value until the next rebuild of the mapping, which takes place - * every 12h. Upon success, the response is 200 OK and contains the following userIDs data. - * - * @param searchUserIdsParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call searchUserIdsAsync( - SearchUserIdsParams searchUserIdsParams, - final ApiCallback _callback - ) throws ApiException { - Call call = searchUserIdsValidateBeforeCall(searchUserIdsParams, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for setDictionarySettings - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call setDictionarySettingsCall( - DictionarySettingsParams dictionarySettingsParams, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = dictionarySettingsParams; - - // create path and map variables - String path = "/1/dictionaries/*/settings"; - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call setDictionarySettingsValidateBeforeCall( - DictionarySettingsParams dictionarySettingsParams, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'dictionarySettingsParams' is set - if (dictionarySettingsParams == null) { - throw new ApiException( - "Missing the required parameter 'dictionarySettingsParams' when calling" + - " setDictionarySettings(Async)" - ); - } - - return setDictionarySettingsCall(dictionarySettingsParams, _callback); - } - - /** - * Set dictionary settings. - * - * @param dictionarySettingsParams (required) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse setDictionarySettings( - DictionarySettingsParams dictionarySettingsParams - ) throws ApiException { - Call req = setDictionarySettingsValidateBeforeCall( - dictionarySettingsParams, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SetDictionarySettings(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Set dictionary settings. - * - * @param dictionarySettingsParams (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call setDictionarySettingsAsync( - DictionarySettingsParams dictionarySettingsParams, - final ApiCallback _callback - ) throws ApiException { - Call call = setDictionarySettingsValidateBeforeCall( - dictionarySettingsParams, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for setSettings - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call setSettingsCall( - String indexName, - IndexSettings indexSettings, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = indexSettings; - - // create path and map variables - String path = - "/1/indexes/{indexName}/settings".replaceAll( - "\\{" + "indexName" + "\\}", - this.escapeString(indexName.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) - ); - } - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call setSettingsValidateBeforeCall( - String indexName, - IndexSettings indexSettings, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling setSettings(Async)" - ); - } - - // verify the required parameter 'indexSettings' is set - if (indexSettings == null) { - throw new ApiException( - "Missing the required parameter 'indexSettings' when calling setSettings(Async)" - ); - } - - return setSettingsCall( - indexName, - indexSettings, - forwardToReplicas, - _callback - ); - } - - /** - * Update settings of a given indexName. Only specified settings are overridden; unspecified - * settings are left unchanged. Specifying null for a setting resets it to its default value. - * - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return UpdatedAtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdatedAtResponse setSettings( - String indexName, - IndexSettings indexSettings, - Boolean forwardToReplicas - ) throws ApiException { - Call req = setSettingsValidateBeforeCall( - indexName, - indexSettings, - forwardToReplicas, - null - ); - if (req instanceof CallEcho) { - return new EchoResponse.SetSettings(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - public UpdatedAtResponse setSettings( - String indexName, - IndexSettings indexSettings - ) throws ApiException { - return this.setSettings(indexName, indexSettings, null); - } - - /** - * (asynchronously) Update settings of a given indexName. Only specified settings are overridden; - * unspecified settings are left unchanged. Specifying null for a setting resets it to its default - * value. - * - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call setSettingsAsync( - String indexName, - IndexSettings indexSettings, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Call call = setSettingsValidateBeforeCall( - indexName, - indexSettings, - forwardToReplicas, - _callback - ); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } - - /** - * Build call for updateApiKey - * - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - private Call updateApiKeyCall( - String key, - ApiKey apiKey, - final ApiCallback _callback - ) throws ApiException { - Object bodyObj = apiKey; - - // create path and map variables - String path = - "/1/keys/{key}".replaceAll( - "\\{" + "key" + "\\}", - this.escapeString(key.toString()) - ); - - List queryParams = new ArrayList(); - Map headers = new HashMap(); - - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall( - path, - "PUT", - queryParams, - bodyObj, - headers, - _callback - ); - } - - private Call updateApiKeyValidateBeforeCall( - String key, - ApiKey apiKey, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'key' is set - if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling updateApiKey(Async)" - ); - } - - // verify the required parameter 'apiKey' is set - if (apiKey == null) { - throw new ApiException( - "Missing the required parameter 'apiKey' when calling updateApiKey(Async)" - ); - } - - return updateApiKeyCall(key, apiKey, _callback); - } - - /** - * Replace every permission of an existing API key. - * - * @param key API Key string. (required) - * @param apiKey (required) - * @return UpdateApiKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - */ - public UpdateApiKeyResponse updateApiKey(String key, ApiKey apiKey) - throws ApiException { - Call req = updateApiKeyValidateBeforeCall(key, apiKey, null); - if (req instanceof CallEcho) { - return new EchoResponse.UpdateApiKey(((CallEcho) req).request()); - } - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); - } - - /** - * (asynchronously) Replace every permission of an existing API key. - * - * @param key API Key string. (required) - * @param apiKey (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call updateApiKeyAsync( - String key, - ApiKey apiKey, - final ApiCallback _callback - ) throws ApiException { - Call call = updateApiKeyValidateBeforeCall(key, apiKey, _callback); - Type returnType = new TypeToken() {}.getType(); - this.executeAsync(call, returnType, _callback); - return call; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java deleted file mode 100644 index 1da39b461e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.algolia.utils; - -import com.algolia.ApiCallback; -import com.algolia.ApiException; -import com.algolia.ProgressResponseBody; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import okhttp3.Call; -import okhttp3.Interceptor; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; - -public class HttpRequester implements Requester { - - private OkHttpClient httpClient; - private HttpLoggingInterceptor loggingInterceptor; - private boolean debugging; - - public HttpRequester() { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - - httpClient = builder.build(); - } - - public Call newCall(Request request) throws ApiException { - return httpClient.newCall(request); - } - - public void setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = - httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); - } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; - } - } - this.debugging = debugging; - } - - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } - - public void setConnectTimeout(int connectionTimeout) { - httpClient = - httpClient - .newBuilder() - .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) - .build(); - } - - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } - - public void setReadTimeout(int readTimeout) { - httpClient = - httpClient - .newBuilder() - .readTimeout(readTimeout, TimeUnit.MILLISECONDS) - .build(); - } - - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } - - public void setWriteTimeout(int writeTimeout) { - httpClient = - httpClient - .newBuilder() - .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) - .build(); - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for async - * requests. - */ - private Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse - .newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java deleted file mode 100644 index 9f7f262846..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.algolia.utils; - -import com.algolia.ApiException; -import okhttp3.Call; -import okhttp3.Request; - -public interface Requester { - public Call newCall(Request request) throws ApiException; - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - */ - public void setDebugging(boolean debugging); - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout(); - - /** - * Sets the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values - * must be between 1 and {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - */ - public void setConnectTimeout(int connectionTimeout); - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout(); - - /** - * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - */ - public void setReadTimeout(int readTimeout); - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout(); - - /** - * Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - */ - public void setWriteTimeout(int writeTimeout); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java deleted file mode 100644 index 1712669790..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.algolia.utils.echo; - -import java.io.IOException; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Request; -import okhttp3.Response; -import okio.Timeout; - -public class CallEcho implements Call { - - private Request request; - - public CallEcho(Request request) { - this.request = request; - } - - @Override - public Request request() { - return request; - } - - @Override - public void cancel() {} - - @Override - public Call clone() { - return null; - } - - @Override - public void enqueue(Callback arg0) {} - - @Override - public Response execute() throws IOException { - return null; - } - - @Override - public boolean isExecuted() { - return false; - } - - @Override - public boolean isCanceled() { - return false; - } - - @Override - public Timeout timeout() { - return null; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java deleted file mode 100644 index 7719400fcd..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.ApiException; -import com.algolia.utils.Requester; -import okhttp3.Request; - -public class EchoRequester implements Requester { - - public CallEcho newCall(Request request) throws ApiException { - return new CallEcho(request); - } - - // NO-OP for now - - public void setDebugging(boolean debugging) {} - - public int getConnectTimeout() { - return 100; - } - - public void setConnectTimeout(int connectionTimeout) {} - - public int getReadTimeout() { - return 100; - } - - public void setReadTimeout(int readTimeout) {} - - public int getWriteTimeout() { - return 100; - } - - public void setWriteTimeout(int writeTimeout) {} -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java deleted file mode 100644 index c9e9b4e64e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java +++ /dev/null @@ -1,1571 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponse { - - private static String parseRequestBody(Request req) { - try { - final Request copy = req.newBuilder().build(); - final Buffer buffer = new Buffer(); - copy.body().writeTo(buffer); - return buffer.readUtf8(); - } catch (final IOException e) { - return "error"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class AddApiKey - extends AddApiKeyResponse - implements EchoResponseInterface { - - private Request request; - - public AddApiKey(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class AddOrUpdateObject - extends UpdatedAtWithObjectIdResponse - implements EchoResponseInterface { - - private Request request; - - public AddOrUpdateObject(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class AppendSource - extends CreatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public AppendSource(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class AssignUserId - extends CreatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public AssignUserId(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class Batch - extends BatchResponse - implements EchoResponseInterface { - - private Request request; - - public Batch(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class BatchAssignUserIds - extends CreatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public BatchAssignUserIds(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class BatchDictionaryEntries - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public BatchDictionaryEntries(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class BatchRules - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public BatchRules(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class Browse - extends BrowseResponse - implements EchoResponseInterface { - - private Request request; - - public Browse(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ClearAllSynonyms - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public ClearAllSynonyms(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ClearObjects - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public ClearObjects(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ClearRules - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public ClearRules(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteApiKey - extends DeleteApiKeyResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteApiKey(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteBy - extends DeletedAtResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteBy(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteIndex - extends DeletedAtResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteIndex(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteObject - extends DeletedAtResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteObject(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteRule - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteRule(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteSource - extends DeleteSourceResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteSource(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class DeleteSynonym - extends DeletedAtResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteSynonym(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetApiKey extends Key implements EchoResponseInterface { - - private Request request; - - public GetApiKey(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetDictionaryLanguages - extends HashMap - implements EchoResponseInterface { - - private Request request; - - public GetDictionaryLanguages(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetDictionarySettings - extends GetDictionarySettingsResponse - implements EchoResponseInterface { - - private Request request; - - public GetDictionarySettings(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetLogs - extends GetLogsResponse - implements EchoResponseInterface { - - private Request request; - - public GetLogs(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetObject - extends HashMap - implements EchoResponseInterface { - - private Request request; - - public GetObject(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetObjects - extends GetObjectsResponse - implements EchoResponseInterface { - - private Request request; - - public GetObjects(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetRule extends Rule implements EchoResponseInterface { - - private Request request; - - public GetRule(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetSettings - extends IndexSettings - implements EchoResponseInterface { - - private Request request; - - public GetSettings(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetSources - extends ArrayList - implements EchoResponseInterface { - - private Request request; - - public GetSources(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetSynonym - extends SynonymHit - implements EchoResponseInterface { - - private Request request; - - public GetSynonym(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetTask - extends GetTaskResponse - implements EchoResponseInterface { - - private Request request; - - public GetTask(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetTopUserIds - extends GetTopUserIdsResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopUserIds(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class GetUserId - extends UserId - implements EchoResponseInterface { - - private Request request; - - public GetUserId(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class HasPendingMappings - extends CreatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public HasPendingMappings(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ListApiKeys - extends ListApiKeysResponse - implements EchoResponseInterface { - - private Request request; - - public ListApiKeys(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ListClusters - extends ListClustersResponse - implements EchoResponseInterface { - - private Request request; - - public ListClusters(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ListIndices - extends ListIndicesResponse - implements EchoResponseInterface { - - private Request request; - - public ListIndices(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ListUserIds - extends ListUserIdsResponse - implements EchoResponseInterface { - - private Request request; - - public ListUserIds(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class MultipleBatch - extends MultipleBatchResponse - implements EchoResponseInterface { - - private Request request; - - public MultipleBatch(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class MultipleQueries - extends MultipleQueriesResponse - implements EchoResponseInterface { - - private Request request; - - public MultipleQueries(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class OperationIndex - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public OperationIndex(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class PartialUpdateObject - extends UpdatedAtWithObjectIdResponse - implements EchoResponseInterface { - - private Request request; - - public PartialUpdateObject(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class RemoveUserId - extends RemoveUserIdResponse - implements EchoResponseInterface { - - private Request request; - - public RemoveUserId(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class ReplaceSources - extends ReplaceSourceResponse - implements EchoResponseInterface { - - private Request request; - - public ReplaceSources(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class RestoreApiKey - extends AddApiKeyResponse - implements EchoResponseInterface { - - private Request request; - - public RestoreApiKey(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SaveObject - extends SaveObjectResponse - implements EchoResponseInterface { - - private Request request; - - public SaveObject(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SaveRule - extends UpdatedRuleResponse - implements EchoResponseInterface { - - private Request request; - - public SaveRule(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SaveSynonym - extends SaveSynonymResponse - implements EchoResponseInterface { - - private Request request; - - public SaveSynonym(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SaveSynonyms - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public SaveSynonyms(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class Search - extends SearchResponse - implements EchoResponseInterface { - - private Request request; - - public Search(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SearchDictionaryEntries - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public SearchDictionaryEntries(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SearchForFacetValues - extends SearchForFacetValuesResponse - implements EchoResponseInterface { - - private Request request; - - public SearchForFacetValues(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SearchRules - extends SearchRulesResponse - implements EchoResponseInterface { - - private Request request; - - public SearchRules(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SearchSynonyms - extends SearchSynonymsResponse - implements EchoResponseInterface { - - private Request request; - - public SearchSynonyms(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SearchUserIds - extends SearchUserIdsResponse - implements EchoResponseInterface { - - private Request request; - - public SearchUserIds(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SetDictionarySettings - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public SetDictionarySettings(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class SetSettings - extends UpdatedAtResponse - implements EchoResponseInterface { - - private Request request; - - public SetSettings(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } - - public static class UpdateApiKey - extends UpdateApiKeyResponse - implements EchoResponseInterface { - - private Request request; - - public UpdateApiKey(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java deleted file mode 100644 index 1a5ab9cbae..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import java.util.List; - -public interface EchoResponseInterface { - public String getPath(); - - public String getMethod(); - - public String getBody(); - - public List getQueryParams(); -} diff --git a/clients/algoliasearch-client-java-2/build.gradle b/clients/algoliasearch-client-java-2/build.gradle deleted file mode 100644 index 6649f26175..0000000000 --- a/clients/algoliasearch-client-java-2/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -plugins { - id 'java' - id 'maven-publish' -} - -group = 'com.algolia' -version = '0.1.0' -description = 'algoliasearch-client-java-2' -java.sourceCompatibility = JavaVersion.VERSION_1_8 - -repositories { - mavenCentral() -} - -dependencies { - implementation 'com.google.code.findbugs:jsr305:3.0.2' - implementation 'com.squareup.okhttp3:okhttp:4.9.1' - implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' - implementation 'com.google.code.gson:gson:2.8.9' - implementation 'io.gsonfire:gson-fire:1.8.5' -} - -publishing { - publications { - maven(MavenPublication) { - from(components.java) - } - } -} - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -sourceSets { - main { - java { - srcDirs = ["algoliasearch-core"] - } - } -} diff --git a/clients/algoliasearch-client-java-2/settings.gradle b/clients/algoliasearch-client-java-2/settings.gradle deleted file mode 100644 index 8fb6ea50f7..0000000000 --- a/clients/algoliasearch-client-java-2/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "algoliasearch-client-java-2" \ No newline at end of file diff --git a/clients/algoliasearch-client-javascript/.gitignore b/clients/algoliasearch-client-javascript/.gitignore deleted file mode 100644 index e502a1555d..0000000000 --- a/clients/algoliasearch-client-javascript/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -**dist -**.openapi-generator - -yarn-error.log - -.yarn/* -!.yarn/releases -!.yarn/plugins - -node_modules diff --git a/clients/algoliasearch-client-javascript/.nvmrc b/clients/algoliasearch-client-javascript/.nvmrc deleted file mode 100644 index 07c142ffe2..0000000000 --- a/clients/algoliasearch-client-javascript/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -16.13.1 diff --git a/clients/algoliasearch-client-javascript/README.md b/clients/algoliasearch-client-javascript/README.md deleted file mode 100644 index 2b1a128fdc..0000000000 --- a/clients/algoliasearch-client-javascript/README.md +++ /dev/null @@ -1,30 +0,0 @@ -.... - -

- - Algolia for JavaScript - - -

The perfect starting point to integrate Algolia within your JavaScript project

- -

- NPM version - NPM downloads - jsDelivr Downloads - License -

-

- -

- Documentation • - InstantSearch • - Community Forum • - Stack Overflow • - Report a bug • - FAQ • - Support -

- -# Contributing to this repository - -The Algolia API clients are automatically generated, you can find everything here https://github.com/algolia/api-clients-automation diff --git a/clients/algoliasearch-client-javascript/bundlesize.config.json b/clients/algoliasearch-client-javascript/bundlesize.config.json deleted file mode 100644 index 27e80d2f40..0000000000 --- a/clients/algoliasearch-client-javascript/bundlesize.config.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "files": [ - { - "path": "packages/algoliasearch/dist/algoliasearch.umd.browser.js", - "maxSize": "6.25KB" - }, - { - "path": "packages/client-abtesting/dist/client-abtesting.umd.browser.js", - "maxSize": "3.25KB" - }, - { - "path": "packages/client-analytics/dist/client-analytics.umd.browser.js", - "maxSize": "3.75KB" - }, - { - "path": "packages/client-insights/dist/client-insights.umd.browser.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/client-personalization/dist/client-personalization.umd.browser.js", - "maxSize": "3.25KB" - }, - { - "path": "packages/client-query-suggestions/dist/client-query-suggestions.umd.browser.js", - "maxSize": "3.25KB" - }, - { - "path": "packages/client-search/dist/client-search.umd.browser.js", - "maxSize": "5.25KB" - }, - { - "path": "packages/client-sources/dist/client-sources.umd.browser.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/recommend/dist/recommend.umd.browser.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/client-common/dist/client-common.esm.node.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/requester-browser-xhr/dist/requester-browser-xhr.esm.node.js", - "maxSize": "1.00KB" - }, - { - "path": "packages/requester-node-http/dist/requester-node-http.esm.node.js", - "maxSize": "1.00KB" - } - ] -} diff --git a/clients/algoliasearch-client-javascript/package.json b/clients/algoliasearch-client-javascript/package.json deleted file mode 100644 index 69cd7909f4..0000000000 --- a/clients/algoliasearch-client-javascript/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "algoliasearch-client-javascript", - "version": "5.0.0", - "workspaces": [ - "packages/*" - ], - "private": true, - "scripts": { - "build:utils": "UTILS=${0:-all} yarn rollup -c rollup.config.js", - "build": "CLIENT=${0:-all} yarn rollup -c rollup.config.js", - "clean:utils": "yarn workspace @algolia/client-common clean && yarn workspace @algolia/requester-node-http clean && yarn workspace @algolia/requester-browser-xhr clean", - "clean": "rm -rf packages/*/dist", - "release": "shipjs prepare", - "test:size": "bundlesize", - "test:lint": "eslint . --ext .js,.ts", - "test:types": "yarn tsc --noEmit" - }, - "devDependencies": { - "@babel/core": "7.17.2", - "@babel/plugin-transform-runtime": "7.17.0", - "@babel/preset-env": "7.16.11", - "@babel/runtime": "7.17.2", - "@rollup/plugin-babel": "5.3.0", - "@rollup/plugin-node-resolve": "13.1.3", - "@types/rollup-plugin-node-globals": "1.4.1", - "bundlesize": "0.18.1", - "rollup": "2.67.1", - "rollup-plugin-filesize": "9.1.2", - "rollup-plugin-node-globals": "1.4.0", - "rollup-plugin-terser": "7.0.2", - "rollup-plugin-typescript2": "0.31.2", - "typescript": "4.5.4" - }, - "engines": { - "node": "^14.0.0", - "yarn": "^3.0.0" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts deleted file mode 100644 index 4da5a3355e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { - AnalyticsApi, - Region as AnalyticsRegion, -} from '@algolia/client-analytics/src/analyticsApi'; -import { createAnalyticsApi } from '@algolia/client-analytics/src/analyticsApi'; -import type { - CreateClientOptions, - Host, - Requester, -} from '@algolia/client-common'; -import type { - PersonalizationApi, - Region as PersonalizationRegion, -} from '@algolia/client-personalization/src/personalizationApi'; -import { createPersonalizationApi } from '@algolia/client-personalization/src/personalizationApi'; -import { createSearchApi } from '@algolia/client-search/src/searchApi'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function algoliasearch( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -) { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - const commonOptions: Omit = { - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }; - - function initAnalytics( - analyticsAppId: string, - analyticsApiKey: string, - region?: AnalyticsRegion, - analyticsOptions?: { requester?: Requester; hosts?: Host[] } - ): AnalyticsApi { - return createAnalyticsApi({ - appId: analyticsAppId, - apiKey: analyticsApiKey, - region, - ...analyticsOptions, - ...commonOptions, - }); - } - - function initPersonalization( - personalizationAppId: string, - personalizationApiKey: string, - region: PersonalizationRegion, - personalizationOptions?: { requester?: Requester; hosts?: Host[] } - ): PersonalizationApi { - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId: personalizationAppId, - apiKey: personalizationApiKey, - region, - ...personalizationOptions, - ...commonOptions, - }); - } - - return { - ...createSearchApi({ appId, apiKey, ...commonOptions }), - initAnalytics, - initPersonalization, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts deleted file mode 100644 index e17d171f54..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { - AnalyticsApi, - Region as AnalyticsRegion, -} from '@algolia/client-analytics/src/analyticsApi'; -import { createAnalyticsApi } from '@algolia/client-analytics/src/analyticsApi'; -import type { - CreateClientOptions, - Host, - Requester, -} from '@algolia/client-common'; -import type { - PersonalizationApi, - Region as PersonalizationRegion, -} from '@algolia/client-personalization/src/personalizationApi'; -import { createPersonalizationApi } from '@algolia/client-personalization/src/personalizationApi'; -import { createSearchApi } from '@algolia/client-search/src/searchApi'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function algoliasearch( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -) { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - const commonOptions: Omit = { - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }; - - function initAnalytics( - analyticsAppId: string, - analyticsApiKey: string, - region?: AnalyticsRegion, - analyticsOptions?: { requester?: Requester; hosts?: Host[] } - ): AnalyticsApi { - return createAnalyticsApi({ - appId: analyticsAppId, - apiKey: analyticsApiKey, - region, - ...analyticsOptions, - ...commonOptions, - }); - } - - function initPersonalization( - personalizationAppId: string, - personalizationApiKey: string, - region: PersonalizationRegion, - personalizationOptions?: { requester?: Requester; hosts?: Host[] } - ): PersonalizationApi { - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId: personalizationAppId, - apiKey: personalizationApiKey, - region, - ...personalizationOptions, - ...commonOptions, - }); - } - - return { - ...createSearchApi({ appId, apiKey, ...commonOptions }), - initAnalytics, - initPersonalization, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts deleted file mode 100644 index 7b4d638346..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/algoliasearch/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.js b/clients/algoliasearch-client-javascript/packages/algoliasearch/index.js deleted file mode 100644 index 1bfaf73d0e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/algoliasearch.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/package.json b/clients/algoliasearch-client-javascript/packages/algoliasearch/package.json deleted file mode 100644 index 3808b693f0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "algoliasearch", - "version": "5.0.0", - "description": "A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/algoliasearch.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/algoliasearch.umd.browser.js", - "unpkg": "dist/algoliasearch.umd.browser.js", - "browser": { - "./index.js": "./dist/algoliasearch.cjs.browser.js", - "./lite.js": "./dist/algoliasearch-lite.cjs.browser.js" - }, - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-analytics": "5.0.0", - "@algolia/client-common": "5.0.0", - "@algolia/client-personalization": "5.0.0", - "@algolia/client-search": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json b/clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json deleted file mode 100644 index e5af720cb3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts deleted file mode 100644 index 31bbae9d49..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createAbtestingApi } from '../src/abtestingApi'; -import type { AbtestingApi, Region } from '../src/abtestingApi'; - -export * from '../src/abtestingApi'; - -export function abtestingApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AbtestingApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAbtestingApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts deleted file mode 100644 index 034c5ea5b9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createAbtestingApi } from '../src/abtestingApi'; -import type { AbtestingApi, Region } from '../src/abtestingApi'; - -export * from '../src/abtestingApi'; - -export function abtestingApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AbtestingApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAbtestingApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.js b/clients/algoliasearch-client-javascript/packages/client-abtesting/index.js deleted file mode 100644 index c6b9604592..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-abtesting.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts deleted file mode 100644 index 3d076739f6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Variant } from './variant'; - -export type ABTest = { - /** - * The A/B test ID. - */ - abTestID: number; - /** - * A/B test significance based on click data. Should be > 0.95 to be considered significant (no matter which variant is winning). - */ - clickSignificance: number; - /** - * A/B test significance based on conversion data. Should be > 0.95 to be considered significant (no matter which variant is winning). - */ - conversionSignificance: number; - /** - * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. - */ - endAt: string; - /** - * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. - */ - createdAt: string; - /** - * A/B test name. - */ - name: string; - /** - * Status of the A/B test. - */ - status: string; - /** - * List of A/B test variant. - */ - variants: Variant[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts deleted file mode 100644 index bf211fd44d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type ABTestResponse = { - /** - * The index performing the A/B test. - */ - index: string; - /** - * The A/B test ID. - */ - abTestID: number; - /** - * TaskID of the task to wait for. - */ - taskID: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts deleted file mode 100644 index 5100fec263..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type AbTestsVariant = { - /** - * The index performing the A/B test. - */ - index: string; - /** - * The traffic perfecentage for the A/B test. - */ - trafficPercentage: number; - /** - * The A/B test description. - */ - description?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts deleted file mode 100644 index b9cede265e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { AbTestsVariant } from './abTestsVariant'; -import type { CustomSearchParams } from './customSearchParams'; - -export type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts deleted file mode 100644 index 7f06f24a37..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { AddABTestsVariant } from './addABTestsVariant'; - -export type AddABTestsRequest = { - /** - * A/B test name. - */ - name: string; - /** - * List of 2 variants for the A/B test. - */ - variant: AddABTestsVariant[]; - /** - * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. - */ - endAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts deleted file mode 100644 index 70e611f007..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { AbTestsVariant } from './abTestsVariant'; -import type { AbTestsVariantSearchParams } from './abTestsVariantSearchParams'; - -export type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts deleted file mode 100644 index 44f24075b6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type CustomSearchParams = { - customSearchParameters: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts deleted file mode 100644 index 44f25e3b5f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ABTest } from './aBTest'; - -export type ListABTestsResponse = { - /** - * List of A/B tests. - */ - abtests: ABTest[]; - /** - * Number of A/B tests found for the app. - */ - count: number; - /** - * Number of A/B tests retrievable. - */ - total: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts deleted file mode 100644 index 3328858f2b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts +++ /dev/null @@ -1,50 +0,0 @@ -export type Variant = { - /** - * Average click position for the variant. - */ - averageClickPosition: number; - /** - * Distinct click count for the variant. - */ - clickCount: number; - /** - * Click through rate for the variant. - */ - clickThroughRate: number; - /** - * Distinct conversion count for the variant. - */ - conversionCount: number; - /** - * Conversion rate for the variant. - */ - conversionRate: number; - /** - * The A/B test description. - */ - description: string; - /** - * The index performing the A/B test. - */ - index: string; - /** - * The number of occurrences. - */ - noResultCount: number; - /** - * The number of search during the A/B test. - */ - searchCount: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The traffic perfecentage for the A/B test. - */ - trafficPercentage: number; - /** - * The number of user during the A/B test. - */ - userCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/package.json b/clients/algoliasearch-client-javascript/packages/client-abtesting/package.json deleted file mode 100644 index 348cc5ae4e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-abtesting", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-abtesting", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-abtesting.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-abtesting.umd.browser.js", - "unpkg": "dist/client-abtesting.umd.browser.js", - "browser": "dist/client-abtesting.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts deleted file mode 100644 index a1533a5e79..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts +++ /dev/null @@ -1,277 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { ABTest } from '../model/aBTest'; -import type { ABTestResponse } from '../model/aBTestResponse'; -import type { AddABTestsRequest } from '../model/addABTestsRequest'; -import type { ListABTestsResponse } from '../model/listABTestsResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region?: Region): Host[] { - const regionHost = region ? `.${region}.` : '.'; - - return [ - { - url: `analytics${regionHost}algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createAbtestingApi( - options: CreateClientOptions & { region?: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Abtesting', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Creates a new A/B test with provided configuration. You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants. - * - * @summary Creates a new A/B test with provided configuration. - * @param addABTestsRequest - The addABTestsRequest object. - */ - function addABTests( - addABTestsRequest: AddABTestsRequest - ): Promise { - const path = '/2/abtests'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!addABTestsRequest) { - throw new Error( - 'Parameter `addABTestsRequest` is required when calling `addABTests`.' - ); - } - - if (!addABTestsRequest.name) { - throw new Error( - 'Parameter `addABTestsRequest.name` is required when calling `addABTests`.' - ); - } - if (!addABTestsRequest.variant) { - throw new Error( - 'Parameter `addABTestsRequest.variant` is required when calling `addABTests`.' - ); - } - if (!addABTestsRequest.endAt) { - throw new Error( - 'Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: addABTestsRequest, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Deletes the A/B Test and removes all associated metadata & metrics. - * - * @summary Deletes the A/B Test. - * @param deleteABTest - The deleteABTest object. - * @param deleteABTest.id - The A/B test ID. - */ - function deleteABTest({ id }: DeleteABTestProps): Promise { - const path = '/2/abtests/{id}'.replace( - '{id}', - encodeURIComponent(String(id)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!id) { - throw new Error( - 'Parameter `id` is required when calling `deleteABTest`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns metadata and metrics for A/B test id. Behaves in the same way as GET /2/abtests however the endpoint will return 403. - * - * @summary Returns metadata and metrics for A/B test id. - * @param getABTest - The getABTest object. - * @param getABTest.id - The A/B test ID. - */ - function getABTest({ id }: GetABTestProps): Promise { - const path = '/2/abtests/{id}'.replace( - '{id}', - encodeURIComponent(String(id)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!id) { - throw new Error('Parameter `id` is required when calling `getABTest`.'); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Fetch all existing A/B tests for App that are available for the current API Key. Returns an array of metadata and metrics. When no data has been processed, the metrics will be returned as null. - * - * @summary Fetch all existing A/B tests for App that are available for the current API Key. - * @param listABTests - The listABTests object. - * @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param listABTests.limit - Number of records to return. Limit is the size of the page. - */ - function listABTests({ - offset, - limit, - }: ListABTestsProps): Promise { - const path = '/2/abtests'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Marks the A/B test as stopped. At this point, the test is over and cannot be restarted. As a result, your application is back to normal: index A will perform as usual, receiving 100% of all search requests. Associated metadata and metrics are still stored. - * - * @summary Marks the A/B test as stopped. - * @param stopABTest - The stopABTest object. - * @param stopABTest.id - The A/B test ID. - */ - function stopABTest({ id }: StopABTestProps): Promise { - const path = '/2/abtests/{id}/stop'.replace( - '{id}', - encodeURIComponent(String(id)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!id) { - throw new Error('Parameter `id` is required when calling `stopABTest`.'); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - addABTests, - deleteABTest, - getABTest, - listABTests, - stopABTest, - }; -} - -export type AbtestingApi = ReturnType; - -export type DeleteABTestProps = { - /** - * The A/B test ID. - */ - id: number; -}; - -export type GetABTestProps = { - /** - * The A/B test ID. - */ - id: number; -}; - -export type ListABTestsProps = { - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; -}; - -export type StopABTestProps = { - /** - * The A/B test ID. - */ - id: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts deleted file mode 100644 index ca2ad2d132..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createAnalyticsApi } from '../src/analyticsApi'; -import type { AnalyticsApi, Region } from '../src/analyticsApi'; - -export * from '../src/analyticsApi'; - -export function analyticsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AnalyticsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAnalyticsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts deleted file mode 100644 index 10a674ef6d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createAnalyticsApi } from '../src/analyticsApi'; -import type { AnalyticsApi, Region } from '../src/analyticsApi'; - -export * from '../src/analyticsApi'; - -export function analyticsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AnalyticsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAnalyticsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/index.js b/clients/algoliasearch-client-javascript/packages/client-analytics/index.js deleted file mode 100644 index 72eddf17b0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-analytics.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts deleted file mode 100644 index 594148b405..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { GetAverageClickPositionResponseDates } from './getAverageClickPositionResponseDates'; - -export type GetAverageClickPositionResponse = { - /** - * The average of all the click count event. - */ - average: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * A list of average click position with their date. - */ - dates: GetAverageClickPositionResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts deleted file mode 100644 index 297387383b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetAverageClickPositionResponseDates = { - /** - * The average of all the click count event. - */ - average: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts deleted file mode 100644 index 85ea2e7177..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetClickPositionsResponsePositions } from './getClickPositionsResponsePositions'; - -export type GetClickPositionsResponse = { - /** - * A list of the click positions with their click count. - */ - positions: GetClickPositionsResponsePositions[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts deleted file mode 100644 index f1fb8bbecd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetClickPositionsResponsePositions = { - /** - * Range of positions with the following pattern: Positions from 1 to 10 included are displayed in separated groups. Positions from 11 to 20 included are grouped together. Positions from 21 and up are grouped together. - */ - position: number[]; - /** - * The number of click event. - */ - clickCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts deleted file mode 100644 index e22dcf9e92..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetClickThroughRateResponseDates } from './getClickThroughRateResponseDates'; - -export type GetClickThroughRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * A list of click-through rate events with their date. - */ - dates: GetClickThroughRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts deleted file mode 100644 index 4b512e006a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetClickThroughRateResponseDates = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts deleted file mode 100644 index 04ecd51de5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetConversationRateResponseDates } from './getConversationRateResponseDates'; - -export type GetConversationRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; - /** - * A list of conversion events with their date. - */ - dates: GetConversationRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts deleted file mode 100644 index bee3367b80..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetConversationRateResponseDates = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts deleted file mode 100644 index e45f85d2f0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetNoClickRateResponseDates } from './getNoClickRateResponseDates'; - -export type GetNoClickRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - count: number; - /** - * The number of click event. - */ - noClickCount: number; - /** - * A list of searches without clicks with their date, rate and counts. - */ - dates: GetNoClickRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts deleted file mode 100644 index 72692149c5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetNoClickRateResponseDates = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - count: number; - /** - * The number of click event. - */ - noClickCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts deleted file mode 100644 index bebc3527e7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetNoResultsRateResponseDates } from './getNoResultsRateResponseDates'; - -export type GetNoResultsRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of occurrences. - */ - count: number; - /** - * The number of occurrences. - */ - noResultCount: number; - /** - * A list of searches without results with their date, rate and counts. - */ - dates: GetNoResultsRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts deleted file mode 100644 index 01856b0b0a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetNoResultsRateResponseDates = { - /** - * Date of the event. - */ - date: string; - /** - * The number of occurrences. - */ - noResultCount: number; - /** - * The number of occurrences. - */ - count: number; - /** - * The click-through rate. - */ - rate: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts deleted file mode 100644 index 4b67c49096..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GetSearchesCountResponseDates } from './getSearchesCountResponseDates'; - -export type GetSearchesCountResponse = { - /** - * The number of occurrences. - */ - count: number; - /** - * A list of search events with their date and count. - */ - dates: GetSearchesCountResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts deleted file mode 100644 index 096b1f055e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetSearchesCountResponseDates = { - /** - * Date of the event. - */ - date: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts deleted file mode 100644 index d4ab03d68d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetSearchesNoClicksResponseSearches } from './getSearchesNoClicksResponseSearches'; - -export type GetSearchesNoClicksResponse = { - /** - * A list of searches with no clicks and their count. - */ - searches: GetSearchesNoClicksResponseSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts deleted file mode 100644 index 5fd59ec278..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetSearchesNoClicksResponseSearches = { - /** - * The search query. - */ - search: string; - /** - * The number of occurrences. - */ - count: number; - /** - * The number of occurrences. - */ - withFilterCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts deleted file mode 100644 index c44df94b77..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetSearchesNoResultsResponseSearches } from './getSearchesNoResultsResponseSearches'; - -export type GetSearchesNoResultsResponse = { - /** - * A list of searches with no results and their count. - */ - searches: GetSearchesNoResultsResponseSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts deleted file mode 100644 index 592730c073..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetSearchesNoResultsResponseSearches = { - /** - * The search query. - */ - search: string; - /** - * The number of occurrences. - */ - count: number; - /** - * Number of hits that the search query matched. - */ - nbHits: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts deleted file mode 100644 index 379fff0845..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type GetStatusResponse = { - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts deleted file mode 100644 index 6093557d10..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopCountriesResponseCountries } from './getTopCountriesResponseCountries'; - -export type GetTopCountriesResponse = { - /** - * A list of countries with their count. - */ - countries: GetTopCountriesResponseCountries[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts deleted file mode 100644 index a5c121a487..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetTopCountriesResponseCountries = { - /** - * The country. - */ - country: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts deleted file mode 100644 index 85fe43b917..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetTopFilterAttribute = { - /** - * The attribute. - */ - attribute: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts deleted file mode 100644 index d54653be74..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopFilterAttribute } from './getTopFilterAttribute'; - -export type GetTopFilterAttributesResponse = { - /** - * A list of attributes with their count. - */ - attributes: GetTopFilterAttribute[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts deleted file mode 100644 index 501a4298a1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetTopFilterForAttribute = { - /** - * The attribute. - */ - attribute: string; - /** - * The operator. - */ - operator: string; - /** - * The value of the attribute. - */ - value: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts deleted file mode 100644 index 982de7c3ce..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopFilterForAttribute } from './getTopFilterForAttribute'; - -export type GetTopFilterForAttributeResponse = { - /** - * A list of filters for the given attributes. - */ - values: GetTopFilterForAttribute[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts deleted file mode 100644 index 60d85c2abf..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopFiltersNoResultsValues } from './getTopFiltersNoResultsValues'; - -export type GetTopFiltersNoResultsResponse = { - /** - * A list of filters without results. - */ - values: GetTopFiltersNoResultsValues[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts deleted file mode 100644 index fb40a51d7b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetTopFiltersNoResultsValue = { - /** - * The attribute. - */ - attribute: string; - /** - * The operator. - */ - operator: string; - /** - * The value of the attribute. - */ - value: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts deleted file mode 100644 index fb8c39d7a9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GetTopFiltersNoResultsValue } from './getTopFiltersNoResultsValue'; - -export type GetTopFiltersNoResultsValues = { - /** - * The number of occurrences. - */ - count: number; - /** - * A list of filters without results. - */ - values: GetTopFiltersNoResultsValue[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts deleted file mode 100644 index 454261b174..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopHitsResponseHits } from './getTopHitsResponseHits'; - -export type GetTopHitsResponse = { - /** - * A list of top hits with their count. - */ - hits: GetTopHitsResponseHits[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts deleted file mode 100644 index 4a24c30a21..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetTopHitsResponseHits = { - /** - * The hit. - */ - hit: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts deleted file mode 100644 index 254e062bd1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopHitsResponseWithAnalyticsHits } from './getTopHitsResponseWithAnalyticsHits'; - -export type GetTopHitsResponseWithAnalytics = { - /** - * A list of top hits with their count and analytics. - */ - hits: GetTopHitsResponseWithAnalyticsHits[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts deleted file mode 100644 index 0a117f396f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts +++ /dev/null @@ -1,30 +0,0 @@ -export type GetTopHitsResponseWithAnalyticsHits = { - /** - * The hit. - */ - hit: string; - /** - * The number of occurrences. - */ - count: number; - /** - * The click-through rate. - */ - clickThroughRate: number; - /** - * The conversion rate. - */ - conversionRate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts deleted file mode 100644 index cc805fa4e6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetSearchesNoResultsResponseSearches } from './getSearchesNoResultsResponseSearches'; - -export type GetTopSearchesResponse = { - /** - * A list of top searches with their count. - */ - searches: GetSearchesNoResultsResponseSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts deleted file mode 100644 index 78fad12f8b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopSearchesResponseWithAnalyticsSearches } from './getTopSearchesResponseWithAnalyticsSearches'; - -export type GetTopSearchesResponseWithAnalytics = { - /** - * A list of top searches with their count and analytics. - */ - searches: GetTopSearchesResponseWithAnalyticsSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts deleted file mode 100644 index dca7dd1d3a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts +++ /dev/null @@ -1,38 +0,0 @@ -export type GetTopSearchesResponseWithAnalyticsSearches = { - /** - * The search query. - */ - search: string; - /** - * The number of occurrences. - */ - count: number; - /** - * The click-through rate. - */ - clickThroughRate: number; - /** - * The average position of all the click count event. - */ - averageClickPosition: number; - /** - * The conversion rate. - */ - conversionRate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; - /** - * Number of hits that the search query matched. - */ - nbHits: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts deleted file mode 100644 index 437bba9b00..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GetSearchesCountResponseDates } from './getSearchesCountResponseDates'; - -export type GetUsersCountResponse = { - /** - * The number of occurrences. - */ - count: number; - /** - * A list of users count with their date. - */ - dates: GetSearchesCountResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/package.json b/clients/algoliasearch-client-javascript/packages/client-analytics/package.json deleted file mode 100644 index 6324f14570..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-analytics", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-analytics", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-analytics.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-analytics.umd.browser.js", - "unpkg": "dist/client-analytics.umd.browser.js", - "browser": "dist/client-analytics.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts deleted file mode 100644 index 7486b001f1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts +++ /dev/null @@ -1,1553 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { GetAverageClickPositionResponse } from '../model/getAverageClickPositionResponse'; -import type { GetClickPositionsResponse } from '../model/getClickPositionsResponse'; -import type { GetClickThroughRateResponse } from '../model/getClickThroughRateResponse'; -import type { GetConversationRateResponse } from '../model/getConversationRateResponse'; -import type { GetNoClickRateResponse } from '../model/getNoClickRateResponse'; -import type { GetNoResultsRateResponse } from '../model/getNoResultsRateResponse'; -import type { GetSearchesCountResponse } from '../model/getSearchesCountResponse'; -import type { GetSearchesNoClicksResponse } from '../model/getSearchesNoClicksResponse'; -import type { GetSearchesNoResultsResponse } from '../model/getSearchesNoResultsResponse'; -import type { GetStatusResponse } from '../model/getStatusResponse'; -import type { GetTopCountriesResponse } from '../model/getTopCountriesResponse'; -import type { GetTopFilterAttributesResponse } from '../model/getTopFilterAttributesResponse'; -import type { GetTopFilterForAttributeResponse } from '../model/getTopFilterForAttributeResponse'; -import type { GetTopFiltersNoResultsResponse } from '../model/getTopFiltersNoResultsResponse'; -import type { GetTopHitsResponse } from '../model/getTopHitsResponse'; -import type { GetTopHitsResponseWithAnalytics } from '../model/getTopHitsResponseWithAnalytics'; -import type { GetTopSearchesResponse } from '../model/getTopSearchesResponse'; -import type { GetTopSearchesResponseWithAnalytics } from '../model/getTopSearchesResponseWithAnalytics'; -import type { GetUsersCountResponse } from '../model/getUsersCountResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region?: Region): Host[] { - const regionHost = region ? `.${region}.` : '.'; - - return [ - { - url: `analytics${regionHost}algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createAnalyticsApi( - options: CreateClientOptions & { region?: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Analytics', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Returns the average click position. The endpoint returns a value for the complete given time range, as well as a value per day. - * - * @summary Returns the average click position. - * @param getAverageClickPosition - The getAverageClickPosition object. - * @param getAverageClickPosition.index - The index name to target. - * @param getAverageClickPosition.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getAverageClickPosition.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getAverageClickPosition.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getAverageClickPosition({ - index, - startDate, - endDate, - tags, - }: GetAverageClickPositionProps): Promise { - const path = '/2/clicks/averageClickPosition'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getAverageClickPosition`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the distribution of clicks per range of positions. - * - * @summary Returns the distribution of clicks per range of positions. - * @param getClickPositions - The getClickPositions object. - * @param getClickPositions.index - The index name to target. - * @param getClickPositions.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickPositions.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickPositions.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getClickPositions({ - index, - startDate, - endDate, - tags, - }: GetClickPositionsProps): Promise { - const path = '/2/clicks/positions'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getClickPositions`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns a click-through rate (CTR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of clicks and searches used to compute the rates. - * - * @summary Returns a click-through rate (CTR). - * @param getClickThroughRate - The getClickThroughRate object. - * @param getClickThroughRate.index - The index name to target. - * @param getClickThroughRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickThroughRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickThroughRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getClickThroughRate({ - index, - startDate, - endDate, - tags, - }: GetClickThroughRateProps): Promise { - const path = '/2/clicks/clickThroughRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getClickThroughRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns a conversion rate (CR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of conversion and searches used to compute the rates. - * - * @summary Returns a conversion rate (CR). - * @param getConversationRate - The getConversationRate object. - * @param getConversationRate.index - The index name to target. - * @param getConversationRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getConversationRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getConversationRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getConversationRate({ - index, - startDate, - endDate, - tags, - }: GetConversationRateProps): Promise { - const path = '/2/conversions/conversionRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getConversationRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the rate at which searches didn\'t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. - * - * @summary Returns the rate at which searches didn\'t lead to any clicks. - * @param getNoClickRate - The getNoClickRate object. - * @param getNoClickRate.index - The index name to target. - * @param getNoClickRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoClickRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoClickRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getNoClickRate({ - index, - startDate, - endDate, - tags, - }: GetNoClickRateProps): Promise { - const path = '/2/searches/noClickRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getNoClickRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the rate at which searches didn\'t return any results. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without results used to compute the rates. - * - * @summary Returns the rate at which searches didn\'t return any results. - * @param getNoResultsRate - The getNoResultsRate object. - * @param getNoResultsRate.index - The index name to target. - * @param getNoResultsRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoResultsRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoResultsRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getNoResultsRate({ - index, - startDate, - endDate, - tags, - }: GetNoResultsRateProps): Promise { - const path = '/2/searches/noResultRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getNoResultsRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the number of searches across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day. - * - * @summary Returns the number of searches across the given time range. - * @param getSearchesCount - The getSearchesCount object. - * @param getSearchesCount.index - The index name to target. - * @param getSearchesCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getSearchesCount({ - index, - startDate, - endDate, - tags, - }: GetSearchesCountProps): Promise { - const path = '/2/searches/count'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getSearchesCount`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top searches that didn\'t lead to any clicks. Limited to the 1000 most frequent ones. For each search, also returns the average number of found hits. - * - * @summary Returns top searches that didn\'t lead to any clicks. - * @param getSearchesNoClicks - The getSearchesNoClicks object. - * @param getSearchesNoClicks.index - The index name to target. - * @param getSearchesNoClicks.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoClicks.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoClicks.limit - Number of records to return. Limit is the size of the page. - * @param getSearchesNoClicks.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getSearchesNoClicks.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getSearchesNoClicks({ - index, - startDate, - endDate, - limit, - offset, - tags, - }: GetSearchesNoClicksProps): Promise { - const path = '/2/searches/noClicks'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getSearchesNoClicks`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top searches that didn\'t return any results. Limited to the 1000 most frequent ones. - * - * @summary Returns top searches that didn\'t return any results. - * @param getSearchesNoResults - The getSearchesNoResults object. - * @param getSearchesNoResults.index - The index name to target. - * @param getSearchesNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoResults.limit - Number of records to return. Limit is the size of the page. - * @param getSearchesNoResults.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getSearchesNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getSearchesNoResults({ - index, - startDate, - endDate, - limit, - offset, - tags, - }: GetSearchesNoResultsProps): Promise { - const path = '/2/searches/noResults'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getSearchesNoResults`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the latest update time of the analytics API for a given index. If the index has been recently created and/or no search has been performed yet the updated time will be null. - * - * @summary Get latest update time of the analytics API. - * @param getStatus - The getStatus object. - * @param getStatus.index - The index name to target. - */ - function getStatus({ index }: GetStatusProps): Promise { - const path = '/2/status'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getStatus`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top countries. Limited to the 1000 most frequent ones. - * - * @summary Returns top countries. - * @param getTopCountries - The getTopCountries object. - * @param getTopCountries.index - The index name to target. - * @param getTopCountries.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopCountries.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopCountries.limit - Number of records to return. Limit is the size of the page. - * @param getTopCountries.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopCountries.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopCountries({ - index, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopCountriesProps): Promise { - const path = '/2/countries'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopCountries`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top filter attributes. Limited to the 1000 most used filters. - * - * @summary Returns top filter attributes. - * @param getTopFilterAttributes - The getTopFilterAttributes object. - * @param getTopFilterAttributes.index - The index name to target. - * @param getTopFilterAttributes.search - The query term to search for. Must match the exact user input. - * @param getTopFilterAttributes.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterAttributes.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterAttributes.limit - Number of records to return. Limit is the size of the page. - * @param getTopFilterAttributes.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopFilterAttributes.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopFilterAttributes({ - index, - search, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopFilterAttributesProps): Promise { - const path = '/2/filters'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopFilterAttributes`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top filters for the given attribute. Limited to the 1000 most used filters. - * - * @summary Returns top filters for the given attribute. - * @param getTopFilterForAttribute - The getTopFilterForAttribute object. - * @param getTopFilterForAttribute.attribute - The exact name of the attribute. - * @param getTopFilterForAttribute.index - The index name to target. - * @param getTopFilterForAttribute.search - The query term to search for. Must match the exact user input. - * @param getTopFilterForAttribute.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterForAttribute.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterForAttribute.limit - Number of records to return. Limit is the size of the page. - * @param getTopFilterForAttribute.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopFilterForAttribute.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopFilterForAttribute({ - attribute, - index, - search, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopFilterForAttributeProps): Promise { - const path = '/2/filters/{attribute}'.replace( - '{attribute}', - encodeURIComponent(String(attribute)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!attribute) { - throw new Error( - 'Parameter `attribute` is required when calling `getTopFilterForAttribute`.' - ); - } - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopFilterForAttribute`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top filters with no results. Limited to the 1000 most used filters. - * - * @summary Returns top filters with no results. - * @param getTopFiltersNoResults - The getTopFiltersNoResults object. - * @param getTopFiltersNoResults.index - The index name to target. - * @param getTopFiltersNoResults.search - The query term to search for. Must match the exact user input. - * @param getTopFiltersNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFiltersNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFiltersNoResults.limit - Number of records to return. Limit is the size of the page. - * @param getTopFiltersNoResults.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopFiltersNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopFiltersNoResults({ - index, - search, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopFiltersNoResultsProps): Promise { - const path = '/2/filters/noResults'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopFiltersNoResults`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top hits. Limited to the 1000 most frequent ones. - * - * @summary Returns top hits. - * @param getTopHits - The getTopHits object. - * @param getTopHits.index - The index name to target. - * @param getTopHits.search - The query term to search for. Must match the exact user input. - * @param getTopHits.clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param getTopHits.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopHits.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopHits.limit - Number of records to return. Limit is the size of the page. - * @param getTopHits.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopHits.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopHits({ - index, - search, - clickAnalytics, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopHitsProps): Promise< - GetTopHitsResponse | GetTopHitsResponseWithAnalytics - > { - const path = '/2/hits'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopHits`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (clickAnalytics !== undefined) { - queryParameters.clickAnalytics = clickAnalytics.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top searches. Limited to the 1000 most frequent ones. For each search, also returns the average number of hits returned. - * - * @summary Returns top searches. - * @param getTopSearches - The getTopSearches object. - * @param getTopSearches.index - The index name to target. - * @param getTopSearches.clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param getTopSearches.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopSearches.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopSearches.orderBy - Reorder the results. - * @param getTopSearches.direction - The sorting of the result. - * @param getTopSearches.limit - Number of records to return. Limit is the size of the page. - * @param getTopSearches.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopSearches.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopSearches({ - index, - clickAnalytics, - startDate, - endDate, - orderBy, - direction, - limit, - offset, - tags, - }: GetTopSearchesProps): Promise< - GetTopSearchesResponse | GetTopSearchesResponseWithAnalytics - > { - const path = '/2/searches'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopSearches`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (clickAnalytics !== undefined) { - queryParameters.clickAnalytics = clickAnalytics.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (orderBy !== undefined) { - queryParameters.orderBy = orderBy.toString(); - } - - if (direction !== undefined) { - queryParameters.direction = direction.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the distinct count of users across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day. - * - * @summary Returns the distinct count of users across the given time range. - * @param getUsersCount - The getUsersCount object. - * @param getUsersCount.index - The index name to target. - * @param getUsersCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getUsersCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getUsersCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getUsersCount({ - index, - startDate, - endDate, - tags, - }: GetUsersCountProps): Promise { - const path = '/2/users/count'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getUsersCount`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - getAverageClickPosition, - getClickPositions, - getClickThroughRate, - getConversationRate, - getNoClickRate, - getNoResultsRate, - getSearchesCount, - getSearchesNoClicks, - getSearchesNoResults, - getStatus, - getTopCountries, - getTopFilterAttributes, - getTopFilterForAttribute, - getTopFiltersNoResults, - getTopHits, - getTopSearches, - getUsersCount, - }; -} - -export type AnalyticsApi = ReturnType; - -export type GetAverageClickPositionProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetClickPositionsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetClickThroughRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetConversationRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetNoClickRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetNoResultsRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetSearchesCountProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetSearchesNoClicksProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetSearchesNoResultsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetStatusProps = { - /** - * The index name to target. - */ - index: string; -}; - -export type GetTopCountriesProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopFilterAttributesProps = { - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopFilterForAttributeProps = { - /** - * The exact name of the attribute. - */ - attribute: string; - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopFiltersNoResultsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopHitsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * Whether to include the click-through and conversion rates for a search. - */ - clickAnalytics?: boolean; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopSearchesProps = { - /** - * The index name to target. - */ - index: string; - /** - * Whether to include the click-through and conversion rates for a search. - */ - clickAnalytics?: boolean; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Reorder the results. - */ - orderBy?: - | 'averageClickPosition' - | 'clickThroughRate' - | 'conversionRate' - | 'searchCount'; - /** - * The sorting of the result. - */ - direction?: 'asc' | 'desc'; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetUsersCountProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/index.ts b/clients/algoliasearch-client-javascript/packages/client-common/index.ts deleted file mode 100644 index 3834d850e9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from './src/createAuth'; -export * from './src/createEchoRequester'; -export * from './src/createMemoryCache'; -export * from './src/createStatefulHost'; -export * from './src/createTransporter'; -export * from './src/createUserAgent'; -export * from './src/errors'; -export * from './src/getUserAgent'; -export * from './src/helpers'; -export * from './src/Response'; -export * from './src/stackTrace'; -export * from './src/types'; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/package.json b/clients/algoliasearch-client-javascript/packages/client-common/package.json deleted file mode 100644 index a995014c63..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@algolia/client-common", - "version": "5.0.0", - "description": "Common package for the Algolia JavaScript API client.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "dist/client-common.cjs.node.js", - "module": "dist/client-common.esm.node.js", - "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist/" - }, - "engines": { - "node": "^14.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts deleted file mode 100644 index bd22de7df9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { Response } from './types'; - -export function isNetworkError({ - isTimedOut, - status, -}: Omit): boolean { - return !isTimedOut && ~~status === 0; -} - -export function isRetryable({ - isTimedOut, - status, -}: Omit): boolean { - return ( - isTimedOut || - isNetworkError({ isTimedOut, status }) || - (~~(status / 100) !== 2 && ~~(status / 100) !== 4) - ); -} - -export function isSuccess({ status }: Pick): boolean { - return ~~(status / 100) === 2; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts deleted file mode 100644 index 80bc5e1991..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { AuthMode } from './types'; - -export function createAuth( - appId: string, - apiKey: string, - authMode: AuthMode = 'WithinHeaders' -): { - readonly headers: () => Readonly>; - readonly queryParameters: () => Readonly>; -} { - const credentials = { - 'x-algolia-api-key': apiKey, - 'x-algolia-application-id': appId, - }; - - return { - headers(): Readonly> { - return authMode === 'WithinHeaders' ? credentials : {}; - }, - - queryParameters(): Readonly> { - return authMode === 'WithinQueryParameters' ? credentials : {}; - }, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts deleted file mode 100644 index d184c7eaa6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { EchoResponse, EndRequest, Request, Response } from './types'; - -export type UrlParams = { - host: string; - userAgent: string; - searchParams: EchoResponse['searchParams']; -}; - -export type EchoRequesterParams = { - getUrlParams: (url: string) => UrlParams; - status?: number; -}; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createEchoRequester({ - getUrlParams, - status = 200, -}: EchoRequesterParams) { - function send( - { headers, url, connectTimeout, responseTimeout }: EndRequest, - { data, ...originalRequest }: Request - ): Promise { - const { host, searchParams, userAgent } = getUrlParams(url); - const originalData = - data && Object.entries(data).length > 0 ? data : undefined; - - return Promise.resolve({ - content: JSON.stringify({ - ...originalRequest, - host, - headers, - connectTimeout, - responseTimeout, - userAgent: userAgent ? encodeURI(userAgent) : undefined, - searchParams, - data: originalData, - }), - isTimedOut: false, - status, - }); - } - - return { send }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts deleted file mode 100644 index 2f7af183d6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Cache } from './types'; - -export function createMemoryCache(): Cache { - let cache: Record = {}; - - return { - async get( - key: Record | string, - defaultValue: () => Promise - ): Promise { - const keyAsString = JSON.stringify(key); - - if (keyAsString in cache) { - return Promise.resolve(cache[keyAsString]); - } - - return await defaultValue(); - }, - - set( - key: Record | string, - value: TValue - ): Promise { - cache[JSON.stringify(key)] = value; - - return Promise.resolve(value); - }, - - delete(key: Record | string): Promise { - delete cache[JSON.stringify(key)]; - - return Promise.resolve(); - }, - - clear(): Promise { - cache = {}; - - return Promise.resolve(); - }, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts deleted file mode 100644 index e69f7a285f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Host, StatefulHost } from './types'; - -// By default, API Clients at Algolia have expiration delay of 5 mins. -// In the JavaScript client, we have 2 mins. -const EXPIRATION_DELAY = 2 * 60 * 1000; - -export function createStatefulHost( - host: Host, - status: StatefulHost['status'] = 'up' -): StatefulHost { - const lastUpdate = Date.now(); - - function isUp(): boolean { - return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY; - } - - function isTimedout(): boolean { - return status === 'timedout' && Date.now() - lastUpdate <= EXPIRATION_DELAY; - } - - return { ...host, status, lastUpdate, isUp, isTimedout }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts deleted file mode 100644 index 6f298796c2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts +++ /dev/null @@ -1,226 +0,0 @@ -import { isRetryable, isSuccess } from './Response'; -import { createStatefulHost } from './createStatefulHost'; -import { RetryError } from './errors'; -import { - deserializeFailure, - deserializeSuccess, - serializeData, - serializeHeaders, - serializeUrl, -} from './helpers'; -import { - stackTraceWithoutCredentials, - stackFrameWithoutCredentials, -} from './stackTrace'; -import type { - EndRequest, - Host, - Request, - RequestOptions, - Response, - StackFrame, - TransporterOptions, - Transporter, -} from './types'; - -type RetryableOptions = { - hosts: Host[]; - getTimeout: (retryCount: number, timeout: number) => number; -}; - -export function createTransporter({ - hosts, - hostsCache, - baseHeaders, - baseQueryParameters, - userAgent, - timeouts, - requester, -}: TransporterOptions): Transporter { - async function createRetryableOptions( - compatibleHosts: Host[] - ): Promise { - const statefulHosts = await Promise.all( - compatibleHosts.map((compatibleHost) => { - return hostsCache.get(compatibleHost, () => { - return Promise.resolve(createStatefulHost(compatibleHost)); - }); - }) - ); - const hostsUp = statefulHosts.filter((host) => host.isUp()); - const hostsTimeouted = statefulHosts.filter((host) => host.isTimedout()); - - // Note, we put the hosts that previously timeouted on the end of the list. - const hostsAvailable = [...hostsUp, ...hostsTimeouted]; - const compatibleHostsAvailable = - hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts; - - return { - hosts: compatibleHostsAvailable, - getTimeout(timeoutsCount: number, baseTimeout: number): number { - /** - * Imagine that you have 4 hosts, if timeouts will increase - * on the following way: 1 (timeouted) > 4 (timeouted) > 5 (200). - * - * Note that, the very next request, we start from the previous timeout. - * - * 5 (timeouted) > 6 (timeouted) > 7 ... - * - * This strategy may need to be reviewed, but is the strategy on the our - * current v3 version. - */ - const timeoutMultiplier = - hostsTimeouted.length === 0 && timeoutsCount === 0 - ? 1 - : hostsTimeouted.length + 3 + timeoutsCount; - - return timeoutMultiplier * baseTimeout; - }, - }; - } - - async function retryableRequest( - request: Request, - requestOptions: RequestOptions - ): Promise { - const stackTrace: StackFrame[] = []; - const isRead = request.method === 'GET'; - - /** - * First we prepare the payload that do not depend from hosts. - */ - const data = serializeData(request, requestOptions); - const headers = serializeHeaders(baseHeaders, requestOptions); - const method = request.method; - - // On `GET`, the data is proxied to query parameters. - const dataQueryParameters: Record = isRead - ? { - ...request.data, - ...requestOptions.data, - } - : {}; - - const queryParameters = { - 'x-algolia-agent': userAgent.value, - ...baseQueryParameters, - ...dataQueryParameters, - ...requestOptions.queryParameters, - }; - - let timeoutsCount = 0; - - const retry = async ( - retryableHosts: Host[], - getTimeout: (timeoutsCount: number, timeout: number) => number - ): Promise => { - /** - * We iterate on each host, until there is no host left. - */ - const host = retryableHosts.pop(); - if (host === undefined) { - throw new RetryError(stackTraceWithoutCredentials(stackTrace)); - } - - let responseTimeout = requestOptions.timeout; - if (responseTimeout === undefined) { - responseTimeout = isRead ? timeouts.read : timeouts.write; - } - - const payload: EndRequest = { - data, - headers, - method, - url: serializeUrl(host, request.path, queryParameters), - connectTimeout: getTimeout(timeoutsCount, timeouts.connect), - responseTimeout: getTimeout(timeoutsCount, responseTimeout), - }; - - /** - * The stackFrame is pushed to the stackTrace so we - * can have information about onRetry and onFailure - * decisions. - */ - const pushToStackTrace = (response: Response): StackFrame => { - const stackFrame: StackFrame = { - request: payload, - response, - host, - triesLeft: retryableHosts.length, - }; - - stackTrace.push(stackFrame); - - return stackFrame; - }; - - const response = await requester.send(payload, request); - - if (isRetryable(response)) { - const stackFrame = pushToStackTrace(response); - - // If response is a timeout, we increase the number of timeouts so we can increase the timeout later. - if (response.isTimedOut) { - timeoutsCount++; - } - /** - * Failures are individually sent to the logger, allowing - * the end user to debug / store stack frames even - * when a retry error does not happen. - */ - // eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter - console.log( - 'Retryable failure', - stackFrameWithoutCredentials(stackFrame) - ); - - /** - * We also store the state of the host in failure cases. If the host, is - * down it will remain down for the next 2 minutes. In a timeout situation, - * this host will be added end of the list of hosts on the next request. - */ - await hostsCache.set( - host, - createStatefulHost(host, response.isTimedOut ? 'timedout' : 'down') - ); - - return retry(retryableHosts, getTimeout); - } - - if (isSuccess(response)) { - return deserializeSuccess(response); - } - - pushToStackTrace(response); - throw deserializeFailure(response, stackTrace); - }; - - /** - * Finally, for each retryable host perform request until we got a non - * retryable response. Some notes here: - * - * 1. The reverse here is applied so we can apply a `pop` later on => more performant. - * 2. We also get from the retryable options a timeout multiplier that is tailored - * for the current context. - */ - const compatibleHosts = hosts.filter( - (host) => - host.accept === 'readWrite' || - (isRead ? host.accept === 'read' : host.accept === 'write') - ); - const options = await createRetryableOptions(compatibleHosts); - - return retry([...options.hosts].reverse(), options.getTimeout); - } - - return { - hostsCache, - requester, - timeouts, - userAgent, - baseHeaders, - baseQueryParameters, - hosts, - request: retryableRequest, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts deleted file mode 100644 index 915a9c63ef..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { UserAgentOptions, UserAgent } from './types'; - -export function createUserAgent(version: string): UserAgent { - const userAgent = { - value: `Algolia for JavaScript (${version})`, - add(options: UserAgentOptions): UserAgent { - const addedUserAgent = `; ${options.segment}${ - options.version !== undefined ? ` (${options.version})` : '' - }`; - - if (userAgent.value.indexOf(addedUserAgent) === -1) { - userAgent.value = `${userAgent.value}${addedUserAgent}`; - } - - return userAgent; - }, - }; - - return userAgent; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts deleted file mode 100644 index a02f3004ad..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { Response, StackFrame } from './types'; - -class ErrorWithStackTrace extends Error { - stackTrace: StackFrame[]; - - constructor(message: string, stackTrace: StackFrame[]) { - super(message); - // the array and object should be frozen to reflect the stackTrace at the time of the error - this.stackTrace = stackTrace; - } -} - -export class RetryError extends ErrorWithStackTrace { - constructor(stackTrace: StackFrame[]) { - super( - 'Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', - stackTrace - ); - } -} - -export class ApiError extends ErrorWithStackTrace { - status: number; - - constructor(message: string, status: number, stackTrace: StackFrame[]) { - super(message, stackTrace); - this.status = status; - } -} - -export class DeserializationError extends Error { - response: Response; - - constructor(message: string, response: Response) { - super(message); - this.response = response; - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts deleted file mode 100644 index 1f91ebb1b8..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { createUserAgent } from './createUserAgent'; -import type { UserAgentOptions, UserAgent } from './types'; - -export type GetUserAgent = { - userAgents: UserAgentOptions[]; - client: string; - version: string; -}; - -export function getUserAgent({ - userAgents, - client, - version, -}: GetUserAgent): UserAgent { - const defaultUserAgent = createUserAgent(version).add({ - segment: client, - version, - }); - - userAgents.forEach((userAgent) => defaultUserAgent.add(userAgent)); - - return defaultUserAgent; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts deleted file mode 100644 index 0bde126a2f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { ApiError, DeserializationError } from './errors'; -import type { - Headers, - Host, - Request, - RequestOptions, - Response, - StackFrame, -} from './types'; - -export function shuffle(array: TData[]): TData[] { - const shuffledArray = array; - - for (let c = array.length - 1; c > 0; c--) { - const b = Math.floor(Math.random() * (c + 1)); - const a = array[c]; - - shuffledArray[c] = array[b]; - shuffledArray[b] = a; - } - - return shuffledArray; -} - -export function serializeUrl( - host: Host, - path: string, - queryParameters: Readonly> -): string { - const queryParametersAsString = serializeQueryParameters(queryParameters); - let url = `${host.protocol}://${host.url}/${ - path.charAt(0) === '/' ? path.substr(1) : path - }`; - - if (queryParametersAsString.length) { - url += `?${queryParametersAsString}`; - } - - return url; -} - -export function serializeQueryParameters( - parameters: Readonly> -): string { - const isObjectOrArray = (value: any): boolean => - Object.prototype.toString.call(value) === '[object Object]' || - Object.prototype.toString.call(value) === '[object Array]'; - - return Object.keys(parameters) - .map( - (key) => - `${key}=${ - isObjectOrArray(parameters[key]) - ? JSON.stringify(parameters[key]) - : parameters[key] - }` - ) - .join('&'); -} - -export function serializeData( - request: Request, - requestOptions: RequestOptions -): string | undefined { - if ( - request.method === 'GET' || - (request.data === undefined && requestOptions.data === undefined) - ) { - return undefined; - } - - const data = Array.isArray(request.data) - ? request.data - : { ...request.data, ...requestOptions.data }; - - return JSON.stringify(data); -} - -export function serializeHeaders( - baseHeaders: Headers, - requestOptions: RequestOptions -): Headers { - const headers: Headers = { - ...baseHeaders, - ...requestOptions.headers, - }; - const serializedHeaders: Headers = {}; - - Object.keys(headers).forEach((header) => { - const value = headers[header]; - serializedHeaders[header.toLowerCase()] = value; - }); - - return serializedHeaders; -} - -export function deserializeSuccess(response: Response): TObject { - try { - return JSON.parse(response.content); - } catch (e) { - throw new DeserializationError((e as Error).message, response); - } -} - -export function deserializeFailure( - { content, status }: Response, - stackFrame: StackFrame[] -): Error { - let message = content; - try { - message = JSON.parse(content).message; - } catch (e) { - // .. - } - return new ApiError(message, status, stackFrame); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts deleted file mode 100644 index 14750a54f2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { StackFrame } from './types'; - -export function stackTraceWithoutCredentials( - stackTrace: StackFrame[] -): StackFrame[] { - return stackTrace.map((stackFrame) => - stackFrameWithoutCredentials(stackFrame) - ); -} - -export function stackFrameWithoutCredentials( - stackFrame: StackFrame -): StackFrame { - const modifiedHeaders: Record = stackFrame.request.headers[ - 'x-algolia-api-key' - ] - ? { 'x-algolia-api-key': '*****' } - : {}; - - return { - ...stackFrame, - request: { - ...stackFrame.request, - headers: { - ...stackFrame.request.headers, - ...modifiedHeaders, - }, - }, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts deleted file mode 100644 index ad35ba9c90..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts +++ /dev/null @@ -1,27 +0,0 @@ -export type Cache = { - /** - * Gets the value of the given `key`. - */ - get: ( - key: Record | string, - defaultValue: () => Promise - ) => Promise; - - /** - * Sets the given value with the given `key`. - */ - set: ( - key: Record | string, - value: TValue - ) => Promise; - - /** - * Deletes the given `key`. - */ - delete: (key: Record | string) => Promise; - - /** - * Clears the cache. - */ - clear: () => Promise; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts deleted file mode 100644 index 1ee437db11..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Host } from './Host'; -import type { Requester } from './Requester'; -import type { Timeouts, UserAgentOptions } from './Transporter'; - -export type AuthMode = 'WithinHeaders' | 'WithinQueryParameters'; - -export type CreateClientOptions = { - appId: string; - apiKey: string; - requester: Requester; - timeouts: Timeouts; - userAgents: UserAgentOptions[]; - hosts?: Host[]; - authMode?: AuthMode; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts deleted file mode 100644 index 6c314e4591..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type Host = { - url: string; - accept: 'read' | 'readWrite' | 'write'; - protocol: 'http' | 'https'; -}; - -export type StatefulHost = Host & { - status: 'down' | 'timedout' | 'up'; - lastUpdate: number; - isUp: () => boolean; - isTimedout: () => boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts deleted file mode 100644 index cac301d9a4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Headers } from './Transporter'; - -export type Method = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT'; - -export type Request = { - method: Method; - path: string; - data?: Record; -}; - -export type EndRequest = { - method: Method; - url: string; - connectTimeout: number; - responseTimeout: number; - headers: Headers; - data?: string; -}; - -export type Response = { - content: string; - isTimedOut: boolean; - status: number; -}; - -export type Requester = { - /** - * Sends the given `request` to the server. - */ - send: (request: EndRequest, originalRequest: Request) => Promise; -}; - -export type EchoResponse = Request & { - connectTimeout: number; - host: string; - headers: Headers; - responseTimeout: number; - searchParams?: Record; - userAgent?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts deleted file mode 100644 index d49ebf17cd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts +++ /dev/null @@ -1,162 +0,0 @@ -import type { Cache } from './Cache'; -import type { Host } from './Host'; -import type { Request, Requester, EndRequest, Response } from './Requester'; - -export type Headers = Record; - -export type QueryParameters = Record; - -export type RequestOptions = { - /** - * Custom timeout for the request. Note that, in normal situacions - * the given timeout will be applied. But the transporter layer may - * increase this timeout if there is need for it. - */ - timeout?: number; - - /** - * Custom headers for the request. This headers are - * going to be merged the transporter headers. - */ - headers?: Headers; - - /** - * Custom query parameters for the request. This query parameters are - * going to be merged the transporter query parameters. - */ - queryParameters: QueryParameters; - data?: Record; -}; - -export type StackFrame = { - request: EndRequest; - response: Response; - host: Host; - triesLeft: number; -}; - -export type UserAgentOptions = { - /** - * The segment. Usually the integration name. - */ - readonly segment: string; - - /** - * The version. Usually the integration version. - */ - readonly version?: string; -}; - -export type UserAgent = { - /** - * The raw value of the user agent. - */ - value: string; - - /** - * Mutates the current user agent ading the given user agent options. - */ - readonly add: (options: UserAgentOptions) => UserAgent; -}; - -export type Timeouts = { - connect: number; - read: number; - write: number; -}; - -export type TransporterOptions = { - /** - * The cache of the hosts. Usually used to persist - * the state of the host when its down. - */ - hostsCache: Cache; - - /** - * The underlying requester used. Should differ - * depending of the enviroment where the client - * will be used. - */ - requester: Requester; - - /** - * The timeouts used by the requester. The transporter - * layer may increase this timeouts as defined on the - * retry strategy. - */ - timeouts: Timeouts; - - /** - * The hosts used by the requester. - */ - hosts: Host[]; - - /** - * The headers used by the requester. The transporter - * layer may add some extra headers during the request - * for the user agent, and others. - */ - baseHeaders: Headers; - - /** - * The query parameters used by the requester. The transporter - * layer may add some extra headers during the request - * for the user agent, and others. - */ - baseQueryParameters: QueryParameters; - - /** - * The user agent used. Sent on query parameters. - */ - userAgent: UserAgent; -}; - -export type Transporter = { - /** - * The cache of the hosts. Usually used to persist - * the state of the host when its down. - */ - hostsCache: Cache; - - /** - * The underlying requester used. Should differ - * depending of the enviroment where the client - * will be used. - */ - requester: Requester; - - /** - * The timeouts used by the requester. The transporter - * layer may increase this timeouts as defined on the - * retry strategy. - */ - timeouts: Timeouts; - - /** - * The user agent used. Sent on query parameters. - */ - userAgent: UserAgent; - - /** - * The headers used on each request. - */ - baseHeaders: Headers; - - /** - * The query parameters used on each request. - */ - baseQueryParameters: QueryParameters; - - /** - * The hosts used by the retry strategy. - */ - hosts: Host[]; - - /** - * Performs a read request using read hosts. - */ - request: ( - request: Request, - requestOptions: RequestOptions - ) => Promise; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts deleted file mode 100644 index ecfac34168..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './Cache'; -export * from './CreateClient'; -export * from './Host'; -export * from './Requester'; -export * from './Transporter'; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json deleted file mode 100644 index e14af78d72..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src", "index.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts deleted file mode 100644 index 7a84056553..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createInsightsApi } from '../src/insightsApi'; -import type { InsightsApi, Region } from '../src/insightsApi'; - -export * from '../src/insightsApi'; - -export function insightsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): InsightsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createInsightsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts deleted file mode 100644 index 294a12f533..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createInsightsApi } from '../src/insightsApi'; -import type { InsightsApi, Region } from '../src/insightsApi'; - -export * from '../src/insightsApi'; - -export function insightsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): InsightsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createInsightsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/index.js b/clients/algoliasearch-client-javascript/packages/client-insights/index.js deleted file mode 100644 index 948691cc65..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-insights.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts deleted file mode 100644 index 9260226fba..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Insights event. - */ -export type InsightEvent = { - /** - * An eventType can be a click, a conversion, or a view. - */ - eventType: InsightEventEventType; - /** - * A user-defined string used to categorize events. - */ - eventName: string; - /** - * Name of the targeted index. - */ - index: string; - /** - * A user identifier. Depending if the user is logged-in or not, several strategies can be used from a sessionId to a technical identifier. - */ - userToken: string; - /** - * Time of the event expressed in milliseconds since the Unix epoch. - */ - timestamp?: number; - /** - * Algolia queryID. This is required when an event is tied to a search. - */ - queryID?: string; - /** - * An array of index objectID. Limited to 20 objects. An event can’t have both objectIDs and filters at the same time. - */ - objectIDs?: string[]; - /** - * An array of filters. Limited to 10 filters. An event can’t have both objectIDs and filters at the same time. - */ - filters?: string[]; - /** - * Position of the click in the list of Algolia search results. This field is required if a queryID is provided. One position must be provided for each objectID. - */ - positions?: number[]; -}; - -export type InsightEventEventType = 'click' | 'conversion' | 'view'; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts deleted file mode 100644 index 69728810b2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { InsightEvent } from './insightEvent'; - -/** - * Object containing the events sent. - */ -export type InsightEvents = { - /** - * Array of events sent. - */ - events: InsightEvent[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts deleted file mode 100644 index ed9b5dd044..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type PushEventsResponse = { - /** - * A message confirming the event push. - */ - message: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/package.json b/clients/algoliasearch-client-javascript/packages/client-insights/package.json deleted file mode 100644 index fcbad3b920..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-insights", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-insights", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-insights.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-insights.umd.browser.js", - "unpkg": "dist/client-insights.umd.browser.js", - "browser": "dist/client-insights.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts b/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts deleted file mode 100644 index 92a4f2ea0c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { InsightEvents } from '../model/insightEvents'; -import type { PushEventsResponse } from '../model/pushEventsResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region?: Region): Host[] { - const regionHost = region ? `.${region}.` : '.'; - - return [ - { - url: `insights${regionHost}algolia.io`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createInsightsApi( - options: CreateClientOptions & { region?: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Insights', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * This command pushes an array of events. - * - * @summary Pushes an array of events. - * @param insightEvents - The insightEvents object. - */ - function pushEvents( - insightEvents: InsightEvents - ): Promise { - const path = '/1/events'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!insightEvents) { - throw new Error( - 'Parameter `insightEvents` is required when calling `pushEvents`.' - ); - } - - if (!insightEvents.events) { - throw new Error( - 'Parameter `insightEvents.events` is required when calling `pushEvents`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: insightEvents, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, pushEvents }; -} - -export type InsightsApi = ReturnType; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts deleted file mode 100644 index 1504ff76a2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createPersonalizationApi } from '../src/personalizationApi'; -import type { PersonalizationApi, Region } from '../src/personalizationApi'; - -export * from '../src/personalizationApi'; - -export function personalizationApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): PersonalizationApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts deleted file mode 100644 index 675a54f521..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createPersonalizationApi } from '../src/personalizationApi'; -import type { PersonalizationApi, Region } from '../src/personalizationApi'; - -export * from '../src/personalizationApi'; - -export function personalizationApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): PersonalizationApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/index.js b/clients/algoliasearch-client-javascript/packages/client-personalization/index.js deleted file mode 100644 index cca98d437f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-personalization.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts deleted file mode 100644 index 49717f3f25..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type DeleteUserProfileResponse = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; - /** - * A date until which the data can safely be considered as deleted for the given user. Any data received after the deletedUntil date will start building a new user profile. - */ - deletedUntil: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts deleted file mode 100644 index 277ce92eb9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type EventScoring = { - /** - * The score for the event. - */ - score: number; - /** - * The name of the event. - */ - eventName: string; - /** - * The type of the event. - */ - eventType: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts deleted file mode 100644 index ae2c9d1b5e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type FacetScoring = { - /** - * The score for the event. - */ - score: number; - /** - * The name of the facet. - */ - facetName: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts deleted file mode 100644 index 0ab1c96114..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetUserTokenResponse = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; - /** - * Date of last event update. (ISO-8601 format). - */ - lastEventAt: string; - /** - * The userToken scores. - */ - scores: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts deleted file mode 100644 index 0bcbab7e6e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { EventScoring } from './eventScoring'; -import type { FacetScoring } from './facetScoring'; - -export type PersonalizationStrategyParams = { - /** - * Scores associated with the events. - */ - eventScoring: EventScoring[]; - /** - * Scores associated with the facets. - */ - facetScoring: FacetScoring[]; - /** - * The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled). - */ - personalizationImpact: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts deleted file mode 100644 index 4eaa97be65..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type SetPersonalizationStrategyResponse = { - /** - * A message confirming the strategy update. - */ - message: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/package.json b/clients/algoliasearch-client-javascript/packages/client-personalization/package.json deleted file mode 100644 index 0942608fb3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-personalization", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-personalization", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-personalization.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-personalization.umd.browser.js", - "unpkg": "dist/client-personalization.umd.browser.js", - "browser": "dist/client-personalization.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts deleted file mode 100644 index ceeeff0aab..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse'; -import type { GetUserTokenResponse } from '../model/getUserTokenResponse'; -import type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams'; -import type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'eu' | 'us'; - -function getDefaultHosts(region: Region): Host[] { - return [ - { - url: `personalization.${region}.algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createPersonalizationApi( - options: CreateClientOptions & { region: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Personalization', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours before for the deletion request to be fully processed. - * - * @summary Delete the user profile and all its associated data. - * @param deleteUserProfile - The deleteUserProfile object. - * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. - */ - function deleteUserProfile({ - userToken, - }: DeleteUserProfileProps): Promise { - const path = '/1/profiles/{userToken}'.replace( - '{userToken}', - encodeURIComponent(String(userToken)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userToken) { - throw new Error( - 'Parameter `userToken` is required when calling `deleteUserProfile`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * The strategy contains information on the events and facets that impact user profiles and personalized search results. - * - * @summary Get the current personalization strategy. - */ - function getPersonalizationStrategy(): Promise { - const path = '/1/strategies/personalization'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. - * - * @summary Get the user profile built from Personalization strategy. - * @param getUserTokenProfile - The getUserTokenProfile object. - * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. - */ - function getUserTokenProfile({ - userToken, - }: GetUserTokenProfileProps): Promise { - const path = '/1/profiles/personalization/{userToken}'.replace( - '{userToken}', - encodeURIComponent(String(userToken)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userToken) { - throw new Error( - 'Parameter `userToken` is required when calling `getUserTokenProfile`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * A strategy defines the events and facets that impact user profiles and personalized search results. - * - * @summary Set a new personalization strategy. - * @param personalizationStrategyParams - The personalizationStrategyParams object. - */ - function setPersonalizationStrategy( - personalizationStrategyParams: PersonalizationStrategyParams - ): Promise { - const path = '/1/strategies/personalization'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!personalizationStrategyParams) { - throw new Error( - 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.' - ); - } - - if (!personalizationStrategyParams.eventScoring) { - throw new Error( - 'Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.' - ); - } - if (!personalizationStrategyParams.facetScoring) { - throw new Error( - 'Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.' - ); - } - if (!personalizationStrategyParams.personalizationImpact) { - throw new Error( - 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: personalizationStrategyParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - deleteUserProfile, - getPersonalizationStrategy, - getUserTokenProfile, - setPersonalizationStrategy, - }; -} - -export type PersonalizationApi = ReturnType; - -export type DeleteUserProfileProps = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; -}; - -export type GetUserTokenProfileProps = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts deleted file mode 100644 index 86adb2976f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createPredictApi } from '../src/predictApi'; -import type { PredictApi } from '../src/predictApi'; - -export * from '../src/predictApi'; - -export function predictApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): PredictApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createPredictApi({ - appId, - apiKey, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts deleted file mode 100644 index 9737dc6884..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createPredictApi } from '../src/predictApi'; -import type { PredictApi } from '../src/predictApi'; - -export * from '../src/predictApi'; - -export function predictApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): PredictApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createPredictApi({ - appId, - apiKey, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/index.js b/clients/algoliasearch-client-javascript/packages/client-predict/index.js deleted file mode 100644 index d4ebe8f164..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-predict.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts deleted file mode 100644 index e8187169b1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type Affinities = { - name?: string; - value?: string; - probability?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts deleted file mode 100644 index 58ebd054ad..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Predictions } from './predictions'; -import type { Properties } from './properties'; -import type { Segments } from './segments'; - -export type FetchUserProfileResponse = { - user: string; - predictions?: Predictions; - properties?: Properties; - segments?: Segments; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts deleted file mode 100644 index 2fe71efd34..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type FunnelStage = { - name?: string; - probability?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts deleted file mode 100644 index ebcae4a6f8..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Object with models and types to retrieve. - */ -export type Params = { - /** - * List with model types for which to retrieve predictions. - */ - modelsToRetrieve?: ParamsModelsToRetrieve[]; - /** - * List with types to be retrieved. - */ - typesToRetrieve?: ParamsTypesToRetrieve[]; -}; - -export type ParamsModelsToRetrieve = - | 'affinities' - | 'funnel_stage' - | 'order_value'; - -export type ParamsTypesToRetrieve = 'properties' | 'segments'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts deleted file mode 100644 index 632247b07d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { PredictionsAffinities } from './predictionsAffinities'; -import type { PredictionsFunnelStage } from './predictionsFunnelStage'; -import type { PredictionsOrderValue } from './predictionsOrderValue'; - -export type Predictions = { - funnel_stage?: PredictionsFunnelStage; - order_value?: PredictionsOrderValue; - affinities?: PredictionsAffinities; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts deleted file mode 100644 index 2f9c9060be..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Affinities } from './affinities'; - -/** - * Prediction for the **affinities** model. - */ -export type PredictionsAffinities = { - value?: Affinities[]; - lastUpdatedAt?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts deleted file mode 100644 index 9a653c5399..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { FunnelStage } from './funnelStage'; - -/** - * Prediction for the **funnel_stage** model. - */ -export type PredictionsFunnelStage = { - value?: FunnelStage[]; - lastUpdatedAt?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts deleted file mode 100644 index 2180dacb5f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Prediction for the **order_value** model. - */ -export type PredictionsOrderValue = { - value?: number; - lastUpdatedAt?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts deleted file mode 100644 index e8c8dbe7eb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Properties for the user profile. - */ -export type Properties = { - /** - * Raw user properties (key-value pairs). - */ - raw?: Record; - /** - * Computed user properties (key-value pairs). - */ - computed?: Record; - /** - * Custom user properties (key-value pairs). - */ - custom?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts deleted file mode 100644 index a05df5cf46..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Segments that the user belongs to. - */ -export type Segments = { - /** - * List of computed segments IDs. - */ - computed?: string[]; - /** - * List of custom segments IDs. - */ - custom?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/package.json b/clients/algoliasearch-client-javascript/packages/client-predict/package.json deleted file mode 100644 index b3bae9d24c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-predict", - "version": "0.0.1", - "description": "JavaScript client for @algolia/client-predict", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-predict.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-predict.umd.browser.js", - "unpkg": "dist/client-predict.umd.browser.js", - "browser": "dist/client-predict.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts b/clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts deleted file mode 100644 index 4370f36e9b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { FetchUserProfileResponse } from '../model/fetchUserProfileResponse'; -import type { Params } from '../model/params'; - -export const apiClientVersion = '0.0.1'; - -function getDefaultHosts(): Host[] { - return [ - { - url: 'predict-api-oslcbws3zq-ew.a.run.app', - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createPredictApi(options: CreateClientOptions) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Predict', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Get predictions, properties (raw, computed or custom) and segments (computed or custom) for a user profile. - * - * @summary Get user profile. - * @param fetchUserProfile - The fetchUserProfile object. - * @param fetchUserProfile.userID - User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). - * @param fetchUserProfile.params - The params object. - */ - function fetchUserProfile({ - userID, - params, - }: FetchUserProfileProps): Promise { - const path = '/1/users/{userID}/fetch'.replace( - '{userID}', - encodeURIComponent(String(userID)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userID) { - throw new Error( - 'Parameter `userID` is required when calling `fetchUserProfile`.' - ); - } - - if (!params) { - throw new Error( - 'Parameter `params` is required when calling `fetchUserProfile`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: params, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, fetchUserProfile }; -} - -export type PredictApi = ReturnType; - -export type FetchUserProfileProps = { - /** - * User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). - */ - userID: string; - params: Params; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts deleted file mode 100644 index 6eaf109907..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createQuerySuggestionsApi } from '../src/querySuggestionsApi'; -import type { QuerySuggestionsApi, Region } from '../src/querySuggestionsApi'; - -export * from '../src/querySuggestionsApi'; - -export function querySuggestionsApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): QuerySuggestionsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createQuerySuggestionsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts deleted file mode 100644 index 0b890d2707..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createQuerySuggestionsApi } from '../src/querySuggestionsApi'; -import type { QuerySuggestionsApi, Region } from '../src/querySuggestionsApi'; - -export * from '../src/querySuggestionsApi'; - -export function querySuggestionsApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): QuerySuggestionsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createQuerySuggestionsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js deleted file mode 100644 index 4b29b9aafd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-query-suggestions.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts deleted file mode 100644 index 37c585d5b4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type IndexName = { - /** - * Index name to target. - */ - indexName: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts deleted file mode 100644 index 1dac57b5d2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts +++ /dev/null @@ -1,20 +0,0 @@ -export type LogFile = { - /** - * Date and time of creation of the record. - */ - timestamp: string; - /** - * Type of the record, can be one of three values (INFO, SKIP or ERROR). - */ - level: LogFileLevel; - /** - * Detailed description of what happened. - */ - message: string; - /** - * Indicates the hierarchy of the records. For example, a record with contextLevel=1 belongs to a preceding record with contextLevel=0. - */ - contextLevel: number; -}; - -export type LogFileLevel = 'ERROR' | 'INFO' | 'SKIP'; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts deleted file mode 100644 index 74ce2d5475..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { SourceIndiceWithReplicas } from './sourceIndiceWithReplicas'; - -export type QuerySuggestionsIndex = { - /** - * Index name to target. - */ - indexName: string; - /** - * List of source indices used to generate a Query Suggestions index. - */ - sourceIndices: SourceIndiceWithReplicas[]; - /** - * De-duplicate singular and plural suggestions. For example, let\'s say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. - */ - languages: string[]; - /** - * List of words and patterns to exclude from the Query Suggestions index. - */ - exclude: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts deleted file mode 100644 index dfb47b2070..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { SourceIndex } from './sourceIndex'; - -export type QuerySuggestionsIndexParam = { - /** - * List of source indices used to generate a Query Suggestions index. - */ - sourceIndices: SourceIndex[]; - /** - * De-duplicate singular and plural suggestions. For example, let\'s say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. - */ - languages?: string[]; - /** - * List of words and patterns to exclude from the Query Suggestions index. - */ - exclude?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts deleted file mode 100644 index cd9ba12854..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { IndexName } from './indexName'; -import type { QuerySuggestionsIndexParam } from './querySuggestionsIndexParam'; - -export type QuerySuggestionsIndexWithIndexParam = IndexName & - QuerySuggestionsIndexParam; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts deleted file mode 100644 index 7a2450b90c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { SourceIndexExternal } from './sourceIndexExternal'; - -export type SourceIndex = { - /** - * Source index name. - */ - indexName: string; - /** - * List of analytics tags to filter the popular searches per tag. - */ - analyticsTags?: string[]; - /** - * List of facets to define as categories for the query suggestions. - */ - facets?: Array>; - /** - * Minimum number of hits (e.g., matching records in the source index) to generate a suggestions. - */ - minHits?: number; - /** - * Minimum number of required letters for a suggestion to remain. - */ - minLetters?: number; - /** - * List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC). - */ - generate?: string[][]; - /** - * List of external indices to use to generate custom Query Suggestions. - */ - external?: SourceIndexExternal[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts deleted file mode 100644 index d334668c52..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type SourceIndexExternal = { - /** - * The suggestion you would like to add. - */ - query: string; - /** - * The measure of the suggestion relative popularity. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts deleted file mode 100644 index 0c3601e84a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { SourceIndexExternal } from './sourceIndexExternal'; - -/** - * Source indice with replicas used to generate a Query Suggestions index. - */ -export type SourceIndiceWithReplicas = { - /** - * True if the Query Suggestions index is a replicas. - */ - replicas: boolean; - /** - * Source index name. - */ - indexName: string; - /** - * List of analytics tags to filter the popular searches per tag. - */ - analyticsTags: string[]; - /** - * List of facets to define as categories for the query suggestions. - */ - facets: Array>; - /** - * Minimum number of hits (e.g., matching records in the source index) to generate a suggestions. - */ - minHits: number; - /** - * Minimum number of required letters for a suggestion to remain. - */ - minLetters: number; - /** - * List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC). - */ - generate: string[][]; - /** - * List of external indices to use to generate custom Query Suggestions. - */ - external: SourceIndexExternal[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts deleted file mode 100644 index 1e2048b9d0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type Status = { - /** - * The targeted index name. - */ - indexName: string; - /** - * True if the Query Suggestions index is running. - */ - isRunning: boolean; - /** - * Date and time of the last build. - */ - lastBuiltAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts deleted file mode 100644 index 841e28fdb3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type SucessResponse = { - /** - * The status code. - */ - status: number; - /** - * Message of the response. - */ - message: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json deleted file mode 100644 index 833bdf09a0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-query-suggestions", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-query-suggestions", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-query-suggestions.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-query-suggestions.umd.browser.js", - "unpkg": "dist/client-query-suggestions.umd.browser.js", - "browser": "dist/client-query-suggestions.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts deleted file mode 100644 index 7b96119a8c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts +++ /dev/null @@ -1,344 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { LogFile } from '../model/logFile'; -import type { QuerySuggestionsIndex } from '../model/querySuggestionsIndex'; -import type { QuerySuggestionsIndexParam } from '../model/querySuggestionsIndexParam'; -import type { QuerySuggestionsIndexWithIndexParam } from '../model/querySuggestionsIndexWithIndexParam'; -import type { Status } from '../model/status'; -import type { SucessResponse } from '../model/sucessResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'eu' | 'us'; - -function getDefaultHosts(region: Region): Host[] { - return [ - { - url: `query-suggestions.${region}.algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createQuerySuggestionsApi( - options: CreateClientOptions & { region: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'QuerySuggestions', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Create a configuration of a Query Suggestions index. There\'s a limit of 100 configurations per application. - * - * @summary Create a configuration of a Query Suggestions index. - * @param querySuggestionsIndexWithIndexParam - The querySuggestionsIndexWithIndexParam object. - */ - function createConfig( - querySuggestionsIndexWithIndexParam: QuerySuggestionsIndexWithIndexParam - ): Promise { - const path = '/1/configs'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!querySuggestionsIndexWithIndexParam) { - throw new Error( - 'Parameter `querySuggestionsIndexWithIndexParam` is required when calling `createConfig`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: querySuggestionsIndexWithIndexParam, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete a configuration of a Query Suggestion\'s index. By deleting a configuraton, you stop all updates to the underlying query suggestion index. Note that when doing this, the underlying index does not change - existing suggestions remain untouched. - * - * @summary Delete a configuration of a Query Suggestion\'s index. - * @param deleteConfig - The deleteConfig object. - * @param deleteConfig.indexName - The index in which to perform the request. - */ - function deleteConfig({ - indexName, - }: DeleteConfigProps): Promise { - const path = '/1/configs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteConfig`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get all the configurations of Query Suggestions. For each index, you get a block of JSON with a list of its configuration settings. - * - * @summary Get all the configurations of Query Suggestions. - */ - function getAllConfigs(): Promise { - const path = '/1/configs'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the configuration of a single Query Suggestions index. - * - * @summary Get the configuration of a single Query Suggestions index. - * @param getConfig - The getConfig object. - * @param getConfig.indexName - The index in which to perform the request. - */ - function getConfig({ - indexName, - }: GetConfigProps): Promise { - const path = '/1/configs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getConfig`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the status of a Query Suggestion\'s index. The status includes whether the Query Suggestions index is currently in the process of being built, and the last build time. - * - * @summary Get the status of a Query Suggestion\'s index. - * @param getConfigStatus - The getConfigStatus object. - * @param getConfigStatus.indexName - The index in which to perform the request. - */ - function getConfigStatus({ - indexName, - }: GetConfigStatusProps): Promise { - const path = '/1/configs/{indexName}/status'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getConfigStatus`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the log file of the last build of a single Query Suggestion index. - * - * @summary Get the log file of the last build of a single Query Suggestion index. - * @param getLogFile - The getLogFile object. - * @param getLogFile.indexName - The index in which to perform the request. - */ - function getLogFile({ indexName }: GetLogFileProps): Promise { - const path = '/1/logs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getLogFile`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Update the configuration of a Query Suggestions index. - * - * @summary Update the configuration of a Query Suggestions index. - * @param updateConfig - The updateConfig object. - * @param updateConfig.indexName - The index in which to perform the request. - * @param updateConfig.querySuggestionsIndexParam - The querySuggestionsIndexParam object. - */ - function updateConfig({ - indexName, - querySuggestionsIndexParam, - }: UpdateConfigProps): Promise { - const path = '/1/configs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `updateConfig`.' - ); - } - - if (!querySuggestionsIndexParam) { - throw new Error( - 'Parameter `querySuggestionsIndexParam` is required when calling `updateConfig`.' - ); - } - - if (!querySuggestionsIndexParam.sourceIndices) { - throw new Error( - 'Parameter `querySuggestionsIndexParam.sourceIndices` is required when calling `updateConfig`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: querySuggestionsIndexParam, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - createConfig, - deleteConfig, - getAllConfigs, - getConfig, - getConfigStatus, - getLogFile, - updateConfig, - }; -} - -export type QuerySuggestionsApi = ReturnType; - -export type DeleteConfigProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetConfigProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetConfigStatusProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetLogFileProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type UpdateConfigProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - querySuggestionsIndexParam: QuerySuggestionsIndexParam; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts deleted file mode 100644 index e1a5131532..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createSearchApi } from '../src/searchApi'; -import type { SearchApi } from '../src/searchApi'; - -export * from '../src/searchApi'; - -export function searchApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): SearchApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createSearchApi({ - appId, - apiKey, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts deleted file mode 100644 index 9f3a39c78f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createSearchApi } from '../src/searchApi'; -import type { SearchApi } from '../src/searchApi'; - -export * from '../src/searchApi'; - -export function searchApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): SearchApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createSearchApi({ - appId, - apiKey, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-search/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/index.js b/clients/algoliasearch-client-javascript/packages/client-search/index.js deleted file mode 100644 index bd9ffc6c0a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-search.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/action.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/action.ts deleted file mode 100644 index 7f1a4fb16b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/action.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Type of operation. - */ - -export type Action = - | 'addObject' - | 'clear' - | 'delete' - | 'deleteObject' - | 'partialUpdateObject' - | 'partialUpdateObjectNoCreate' - | 'updateObject'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts deleted file mode 100644 index 10dfae24e7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type AddApiKeyResponse = { - /** - * Key string. - */ - key: string; - /** - * Date of creation (ISO-8601 format). - */ - createdAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts deleted file mode 100644 index 80d51f78be..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. - */ - -export type Anchoring = 'contains' | 'endsWith' | 'is' | 'startsWith'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts deleted file mode 100644 index 4dff62ed0e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Api Key object. - */ -export type ApiKey = { - /** - * Set of permissions associated with the key. - */ - acl: ApiKeyAcl[]; - /** - * A comment used to identify a key more easily in the dashboard. It is not interpreted by the API. - */ - description?: string; - /** - * Restrict this new API key to a list of indices or index patterns. If the list is empty, all indices are allowed. - */ - indexes?: string[]; - /** - * Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. - */ - maxHitsPerQuery?: number; - /** - * Maximum number of API calls per hour allowed from a given IP address or a user token. - */ - maxQueriesPerIPPerHour?: number; - /** - * URL-encoded query string. Force some query parameters to be applied for each query made with this API key. - */ - queryParameters?: string; - /** - * Restrict this new API key to specific referers. If empty or blank, defaults to all referers. - */ - referers?: string[]; - /** - * Validity limit for this key in seconds. The key will automatically be removed after this period of time. - */ - validity?: number; -}; - -export type ApiKeyAcl = - | 'addObject' - | 'analytics' - | 'browse' - | 'deleteIndex' - | 'deleteObject' - | 'editSettings' - | 'listIndexes' - | 'logs' - | 'personalization' - | 'recommendation' - | 'search' - | 'seeUnretrievableAttributes' - | 'settings' - | 'usage'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts deleted file mode 100644 index 638f8f37d3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Assign userID parameters. - */ -export type AssignUserIdParams = { - /** - * Name of the cluster. - */ - cluster: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts deleted file mode 100644 index ae2749c171..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Automatic facet Filter. - */ -export type AutomaticFacetFilter = { - /** - * Attribute to filter on. This must match a facet placeholder in the Rule\'s pattern. - */ - facet: string; - /** - * Score for the filter. Typically used for optional or disjunctive filters. - */ - score?: number; - /** - * Whether the filter is disjunctive (true) or conjunctive (false). - */ - disjunctive?: boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts deleted file mode 100644 index 206e1dc700..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type BaseBrowseResponse = { - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. - */ - cursor: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts deleted file mode 100644 index 36e8463b2f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts +++ /dev/null @@ -1,50 +0,0 @@ -export type BaseIndexSettings = { - /** - * Creates replicas, exact copies of an index. - */ - replicas?: string[]; - /** - * Set the maximum number of hits accessible via pagination. - */ - paginationLimitedTo?: number; - /** - * A list of words for which you want to turn off typo tolerance. - */ - disableTypoToleranceOnWords?: string[]; - /** - * Specify on which attributes to apply transliteration. - */ - attributesToTransliterate?: string[]; - /** - * List of attributes on which to do a decomposition of camel case words. - */ - camelCaseAttributes?: string[]; - /** - * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. - */ - decompoundedAttributes?: Record; - /** - * Sets the languages at the index level for language-specific processing such as tokenization and normalization. - */ - indexLanguages?: string[]; - /** - * Whether promoted results should match the filters of the current search, except for geographic filters. - */ - filterPromotes?: boolean; - /** - * List of attributes on which you want to disable prefix matching. - */ - disablePrefixOnAttributes?: string[]; - /** - * Enables compression of large integer arrays. - */ - allowCompressionOfIntegerArray?: boolean; - /** - * List of numeric attributes that can be used as numerical filters. - */ - numericAttributesForFiltering?: string[]; - /** - * Lets you store custom data in your indices. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts deleted file mode 100644 index 8bf1730be7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts +++ /dev/null @@ -1,130 +0,0 @@ -export type BaseSearchParams = { - /** - * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. - */ - similarQuery?: string; - /** - * Filter the query with numeric, facet and/or tag filters. - */ - filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; - /** - * Determines how to calculate the total score for filtering. - */ - sumOrFiltersScores?: boolean; - /** - * Retrieve facets and their facet values. - */ - facets?: string[]; - /** - * Maximum number of facet values to return for each facet during a regular search. - */ - maxValuesPerFacet?: number; - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - */ - facetingAfterDistinct?: boolean; - /** - * Controls how facet values are fetched. - */ - sortFacetValuesBy?: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Specify the offset of the first hit to return. - */ - offset?: number; - /** - * Set the number of hits to retrieve (used only with offset). - */ - length?: number; - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - */ - aroundLatLng?: string; - /** - * Search for entries around a given location automatically computed from the requester\'s IP address. - */ - aroundLatLngViaIP?: boolean; - /** - * Define the maximum radius for a geo search (in meters). - */ - aroundRadius?: number | string | null; - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - */ - aroundPrecision?: number; - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. - */ - minimumAroundRadius?: number; - /** - * Search inside a rectangular area (in geo coordinates). - */ - insideBoundingBox?: number[]; - /** - * Search inside a polygon (in geo coordinates). - */ - insidePolygon?: number[]; - /** - * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. - */ - naturalLanguages?: string[]; - /** - * Enables contextual rules. - */ - ruleContexts?: string[]; - /** - * Define the impact of the Personalization feature. - */ - personalizationImpact?: number; - /** - * Associates a certain user token with the current search. - */ - userToken?: string; - /** - * Retrieve detailed ranking information. - */ - getRankingInfo?: boolean; - /** - * Enable the Click Analytics feature. - */ - clickAnalytics?: boolean; - /** - * Whether the current query will be taken into account in the Analytics. - */ - analytics?: boolean; - /** - * List of tags to apply to the query for analytics purposes. - */ - analyticsTags?: string[]; - /** - * Whether to include or exclude a query from the processing-time percentile computation. - */ - percentileComputation?: boolean; - /** - * Whether this search should participate in running AB tests. - */ - enableABTest?: boolean; - /** - * Whether this search should use AI Re-Ranking. - */ - enableReRanking?: boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts deleted file mode 100644 index 358556c692..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type { BaseSearchResponseFacetsStats } from './baseSearchResponseFacetsStats'; - -export type BaseSearchResponse = { - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. - */ - abTestID?: number; - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. - */ - abTestVariantID?: number; - /** - * The computed geo location. - */ - aroundLatLng?: string; - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. - */ - automaticRadius?: string; - /** - * Whether the facet count is exhaustive or approximate. - */ - exhaustiveFacetsCount?: boolean; - /** - * Indicate if the nbHits count was exhaustive or approximate. - */ - exhaustiveNbHits: boolean; - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled). - */ - exhaustiveTypo: boolean; - /** - * A mapping of each facet name to the corresponding facet counts. - */ - facets?: { [key: string]: { [key: string]: string } }; - /** - * Statistics for numerical facets. - */ - facets_stats?: { [key: string]: BaseSearchResponseFacetsStats }; - /** - * Set the number of hits per page. - */ - hitsPerPage: number; - /** - * Index name used for the query. - */ - index?: string; - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn\'t always the index used by the query. - */ - indexUsed?: string; - /** - * Used to return warnings about the query. - */ - message?: string; - /** - * Number of hits that the search query matched. - */ - nbHits: number; - /** - * Number of pages available for the current query. - */ - nbPages: number; - /** - * The number of hits selected and sorted by the relevant sort algorithm. - */ - nbSortedHits?: number; - /** - * Specify the page to retrieve. - */ - page: number; - /** - * A url-encoded string of all search parameters. - */ - params: string; - /** - * The query string that will be searched, after normalization. - */ - parsedQuery?: string; - /** - * Time the server took to process the request, in milliseconds. - */ - processingTimeMS: number; - /** - * The text to search in the index. - */ - query: string; - /** - * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. - */ - queryAfterRemoval?: string; - /** - * Actual host name of the server that processed the request. - */ - serverUsed?: string; - /** - * Lets you store custom data in your indices. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts deleted file mode 100644 index 4c4ceb7bc7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type BaseSearchResponseFacetsStats = { - /** - * The minimum value in the result set. - */ - min?: number; - /** - * The maximum value in the result set. - */ - max?: number; - /** - * The average facet value in the result set. - */ - avg?: number; - /** - * The sum of all values in the result set. - */ - sum?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts deleted file mode 100644 index 96a6c0756a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Assign userID parameters. - */ -export type BatchAssignUserIdsParams = { - /** - * Name of the cluster. - */ - cluster: string; - /** - * UserIDs to assign. Note you cannot move users with this method. - */ - users: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts deleted file mode 100644 index 03a9a91be6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { BatchDictionaryEntriesRequest } from './batchDictionaryEntriesRequest'; - -/** - * The `batchDictionaryEntries` parameters. - */ -export type BatchDictionaryEntriesParams = { - /** - * When `true`, start the batch by removing all the custom entries from the dictionary. - */ - clearExistingDictionaryEntries?: boolean; - /** - * List of operations to batch. Each operation is described by an `action` and a `body`. - */ - requests: BatchDictionaryEntriesRequest[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts deleted file mode 100644 index 49ec3569cd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { DictionaryAction } from './dictionaryAction'; -import type { DictionaryEntry } from './dictionaryEntry'; - -export type BatchDictionaryEntriesRequest = { - action: DictionaryAction; - body: DictionaryEntry; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts deleted file mode 100644 index c0c9a64003..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Operation } from './operation'; - -/** - * The `multipleBatch` parameters. - */ -export type BatchParams = { - requests?: Operation[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts deleted file mode 100644 index 28521ba212..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type BatchResponse = { - /** - * TaskID of the task to wait for. - */ - taskID?: number; - /** - * List of objectID. - */ - objectIDs?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts deleted file mode 100644 index 60cd949a70..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Operation } from './operation'; - -/** - * The `batch` parameters. - */ -export type BatchWriteParams = { - requests?: Operation[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts deleted file mode 100644 index 8296b9eaff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type BrowseRequest = { - /** - * Search parameters as URL-encoded query string. - */ - params?: string; - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. - */ - cursor?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts deleted file mode 100644 index 16cf063b37..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseBrowseResponse } from './baseBrowseResponse'; -import type { BaseSearchResponse } from './baseSearchResponse'; -import type { SearchHits } from './searchHits'; - -export type BrowseResponse = BaseBrowseResponse & - BaseSearchResponse & - SearchHits; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts deleted file mode 100644 index 58bb215b56..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * To update an attribute without pushing the entire record, you can use these built-in operations. - */ -export type BuiltInOperation = { - /** - * The operation to apply on the attribute. - */ - _operation: BuiltInOperationOperation; - /** - * The right-hand side argument to the operation, for example, increment or decrement step, value to add or remove. - */ - value: string; -}; - -export type BuiltInOperationOperation = - | 'Add' - | 'AddUnique' - | 'Decrement' - | 'Increment' - | 'IncrementFrom' - | 'IncrementSet' - | 'Remove'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts deleted file mode 100644 index 41db9a3cc1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Anchoring } from './anchoring'; - -export type Condition = { - /** - * Query pattern syntax. - */ - pattern?: string; - anchoring?: Anchoring; - /** - * Whether the pattern matches on plurals, synonyms, and typos. - */ - alternatives?: boolean; - /** - * Rule context format: [A-Za-z0-9_-]+). - */ - context?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts deleted file mode 100644 index d738256a8e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { ConsequenceHide } from './consequenceHide'; -import type { ConsequenceParams } from './consequenceParams'; -import type { Promote } from './promote'; - -/** - * Consequence of the Rule. - */ -export type Consequence = { - params?: ConsequenceParams; - /** - * Objects to promote as hits. - */ - promote?: Promote[]; - /** - * Only use in combination with the promote consequence. When true, promoted results will be restricted to match the filters of the current search. When false, the promoted results will show up regardless of the filters. - */ - filterPromotes?: boolean; - /** - * Objects to hide from hits. Each object must contain an objectID field. By default, you can hide up to 50 items per rule. - */ - hide?: ConsequenceHide[]; - /** - * Custom JSON object that will be appended to the userData array in the response. This object isn\'t interpreted by the API. It\'s limited to 1kB of minified JSON. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts deleted file mode 100644 index 28f87c9c0c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Unique identifier of the object to hide. - */ -export type ConsequenceHide = { - /** - * Unique identifier of the object. - */ - objectID: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts deleted file mode 100644 index af531bb25a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import type { Params } from './params'; - -export type ConsequenceParams = BaseSearchParams & - IndexSettingsAsSearchParams & - Params; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts deleted file mode 100644 index 186db3e688..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type CreatedAtObject = { - /** - * Date of creation (ISO-8601 format). - */ - createdAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts deleted file mode 100644 index 5338cfa832..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * The response with a createdAt timestamp. - */ -export type CreatedAtResponse = { - /** - * Date of creation (ISO-8601 format). - */ - createdAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts deleted file mode 100644 index 37e9753738..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type DeleteApiKeyResponse = { - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts deleted file mode 100644 index 0777b09e59..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type DeleteSourceResponse = { - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts deleted file mode 100644 index 865074e606..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The response with a taskID and a deletedAt timestamp. - */ -export type DeletedAtResponse = { - /** - * TaskID of the task to wait for. - */ - taskID: number; - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts deleted file mode 100644 index cd9ad65e77..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Actions to perform. - */ - -export type DictionaryAction = 'addEntry' | 'deleteEntry'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts deleted file mode 100644 index 4fd672ddbe..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { DictionaryEntryState } from './dictionaryEntryState'; - -/** - * A dictionary entry. - */ -export type DictionaryEntry = { - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * Language ISO code supported by the dictionary (e.g., \"en\" for English). - */ - language: string; - /** - * The word of the dictionary entry. - */ - word?: string; - /** - * The words of the dictionary entry. - */ - words?: string[]; - /** - * A decomposition of the word of the dictionary entry. - */ - decomposition?: string[]; - state?: DictionaryEntryState; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts deleted file mode 100644 index 676ad575c2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * The state of the dictionary entry. - */ - -export type DictionaryEntryState = 'disabled' | 'enabled'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts deleted file mode 100644 index 1f1ba5ea7e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Custom entries for a dictionary. - */ -export type DictionaryLanguage = { - /** - * When nbCustomEntries is set to 0, the user didn\'t customize the dictionary. The dictionary is still supported with standard, Algolia-provided entries. - */ - nbCustomEntires?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts deleted file mode 100644 index e1a831126e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { StandardEntries } from './standardEntries'; - -/** - * Disable the builtin Algolia entries for a type of dictionary per language. - */ -export type DictionarySettingsParams = { - disableStandardEntries: StandardEntries; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts deleted file mode 100644 index 98419546a7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { StandardEntries } from './standardEntries'; - -export type GetDictionarySettingsResponse = { - disableStandardEntries: StandardEntries; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts deleted file mode 100644 index 40a3d8adf9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { GetLogsResponseLogs } from './getLogsResponseLogs'; - -export type GetLogsResponse = { - logs: GetLogsResponseLogs[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts deleted file mode 100644 index 6afe67dc1d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetLogsResponseInnerQueries = { - /** - * Index targeted by the query. - */ - index_name?: string; - /** - * User identifier. - */ - user_token?: string; - /** - * QueryID for the given query. - */ - query_id?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts deleted file mode 100644 index 67ec3593a7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { GetLogsResponseInnerQueries } from './getLogsResponseInnerQueries'; - -export type GetLogsResponseLogs = { - /** - * Timestamp in ISO-8601 format. - */ - timestamp: string; - /** - * HTTP method of the perfomed request. - */ - method: string; - /** - * HTTP response code. - */ - answer_code: string; - /** - * Request body. Truncated after 1000 characters. - */ - query_body: string; - /** - * Answer body. Truncated after 1000 characters. - */ - answer: string; - /** - * Request URL. - */ - url: string; - /** - * IP of the client which perfomed the request. - */ - ip: string; - /** - * Request Headers (API Key is obfuscated). - */ - query_headers: string; - /** - * SHA1 signature of the log entry. - */ - sha1: string; - /** - * Number of API calls. - */ - nb_api_calls: string; - /** - * Processing time for the query. It doesn\'t include network time. - */ - processing_time_ms: string; - /** - * Index targeted by the query. - */ - index?: string; - /** - * Query parameters sent with the request. - */ - query_params?: string; - /** - * Number of hits returned for the query. - */ - query_nb_hits?: string; - /** - * Array of all performed queries for the given request. - */ - inner_queries?: GetLogsResponseInnerQueries[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts deleted file mode 100644 index 439032130c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { MultipleGetObjectsParams } from './multipleGetObjectsParams'; - -/** - * The `getObjects` parameters. - */ -export type GetObjectsParams = { - requests?: MultipleGetObjectsParams[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts deleted file mode 100644 index 1c33d6608c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type GetObjectsResponse = { - /** - * List of results fetched. - */ - results?: Array>; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts deleted file mode 100644 index a08aabf7a1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type GetTaskResponse = { - status: GetTaskResponseStatus; -}; - -export type GetTaskResponseStatus = 'notPublished' | 'published'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts deleted file mode 100644 index 58171c3bca..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { UserId } from './userId'; - -/** - * Array of userIDs and clusters. - */ -export type GetTopUserIdsResponse = { - /** - * Mapping of cluster names to top users. - */ - topUsers: Array<{ [key: string]: UserId[] }>; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts deleted file mode 100644 index a878792c6d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Highlighted attributes. - */ -export type HighlightResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: HighlightResultMatchLevel; - /** - * List of words from the query that matched the object. - */ - matchedWords?: string[]; - /** - * Whether the entire attribute value is highlighted. - */ - fullyHighlighted?: boolean; -}; - -export type HighlightResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts deleted file mode 100644 index 54c8913308..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { HighlightResult } from './highlightResult'; -import type { RankingInfo } from './rankingInfo'; -import type { SnippetResult } from './snippetResult'; - -/** - * A single hit. - */ -export type Hit = { - /** - * Unique identifier of the object. - */ - objectID: string; - _highlightResult?: HighlightResult; - _snippetResult?: SnippetResult; - _rankingInfo?: RankingInfo; - _distinctSeqID?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts deleted file mode 100644 index 056199bbd2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseIndexSettings } from './baseIndexSettings'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; - -export type IndexSettings = BaseIndexSettings & IndexSettingsAsSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts deleted file mode 100644 index 00a227aa03..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts +++ /dev/null @@ -1,209 +0,0 @@ -export type IndexSettingsAsSearchParams = { - /** - * The complete list of attributes used for searching. - */ - searchableAttributes?: string[]; - /** - * The complete list of attributes that will be used for faceting. - */ - attributesForFaceting?: string[]; - /** - * List of attributes that can\'t be retrieved at query time. - */ - unretrievableAttributes?: string[]; - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - */ - attributesToRetrieve?: string[]; - /** - * Restricts a given query to look in only a subset of your searchable attributes. - */ - restrictSearchableAttributes?: string[]; - /** - * Controls how Algolia should sort your results. - */ - ranking?: string[]; - /** - * Specifies the custom ranking criterion. - */ - customRanking?: string[]; - /** - * Controls the relevancy threshold below which less relevant results aren\'t included in the results. - */ - relevancyStrictness?: number; - /** - * List of attributes to highlight. - */ - attributesToHighlight?: string[]; - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - */ - attributesToSnippet?: string[]; - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - */ - highlightPreTag?: string; - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - */ - highlightPostTag?: string; - /** - * String used as an ellipsis indicator when a snippet is truncated. - */ - snippetEllipsisText?: string; - /** - * Restrict highlighting and snippeting to items that matched the query. - */ - restrictHighlightAndSnippetArrays?: boolean; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. - */ - minWordSizefor1Typo?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. - */ - minWordSizefor2Typos?: number; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ - typoTolerance?: IndexSettingsAsSearchParamsTypoTolerance; - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - */ - allowTyposOnNumericTokens?: boolean; - /** - * List of attributes on which you want to disable typo tolerance. - */ - disableTypoToleranceOnAttributes?: string[]; - /** - * Control which separators are indexed. - */ - separatorsToIndex?: string; - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - */ - ignorePlurals?: string; - /** - * Removes stop (common) words from the query before executing it. - */ - removeStopWords?: string; - /** - * List of characters that the engine shouldn\'t automatically normalize. - */ - keepDiacriticsOnCharacters?: string; - /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. - */ - queryLanguages?: string[]; - /** - * Splits compound words into their composing atoms in the query. - */ - decompoundQuery?: boolean; - /** - * Whether Rules should be globally enabled. - */ - enableRules?: boolean; - /** - * Enable the Personalization feature. - */ - enablePersonalization?: boolean; - /** - * Controls if and how query words are interpreted as prefixes. - */ - queryType?: IndexSettingsAsSearchParamsQueryType; - /** - * Selects a strategy to remove words from the query when it doesn\'t match any hits. - */ - removeWordsIfNoResults?: IndexSettingsAsSearchParamsRemoveWordsIfNoResults; - /** - * Enables the advanced query syntax. - */ - advancedSyntax?: boolean; - /** - * A list of words that should be considered as optional when found in the query. - */ - optionalWords?: string[]; - /** - * List of attributes on which you want to disable the exact ranking criterion. - */ - disableExactOnAttributes?: string[]; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ - exactOnSingleWordQuery?: IndexSettingsAsSearchParamsExactOnSingleWordQuery; - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - */ - alternativesAsExact?: IndexSettingsAsSearchParamsAlternativesAsExact[]; - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled. - */ - advancedSyntaxFeatures?: IndexSettingsAsSearchParamsAdvancedSyntaxFeatures[]; - /** - * Enables de-duplication or grouping of results. - */ - distinct?: number; - /** - * Whether to take into account an index\'s synonyms for a particular search. - */ - synonyms?: boolean; - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. - */ - replaceSynonymsInHighlight?: boolean; - /** - * Precision of the proximity ranking criterion. - */ - minProximity?: number; - /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. - */ - responseFields?: string[]; - /** - * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. - */ - maxFacetHits?: number; - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. - */ - attributeCriteriaComputedByMinProximity?: boolean; - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - */ - renderingContent?: Record; -}; - -export type IndexSettingsAsSearchParamsTypoTolerance = - | 'false' - | 'min' - | 'strict' - | 'true'; - -export type IndexSettingsAsSearchParamsQueryType = - | 'prefixAll' - | 'prefixLast' - | 'prefixNone'; - -export type IndexSettingsAsSearchParamsRemoveWordsIfNoResults = - | 'allOptional' - | 'firstWords' - | 'lastWords' - | 'none'; - -export type IndexSettingsAsSearchParamsExactOnSingleWordQuery = - | 'attribute' - | 'none' - | 'word'; - -export type IndexSettingsAsSearchParamsAlternativesAsExact = - | 'ignorePlurals' - | 'multiWordsSynonym' - | 'singleWordSynonym'; - -export type IndexSettingsAsSearchParamsAdvancedSyntaxFeatures = - | 'exactPhrase' - | 'excludeWords'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts deleted file mode 100644 index b5c963c297..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts +++ /dev/null @@ -1,46 +0,0 @@ -export type Indice = { - /** - * Index name. - */ - name: string; - /** - * Index creation date. An empty string means that the index has no records. - */ - createdAt: string; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; - /** - * Number of records contained in the index. - */ - entries: number; - /** - * Number of bytes of the index in minified format. - */ - dataSize: number; - /** - * Number of bytes of the index binary file. - */ - fileSize: number; - /** - * Last build time. - */ - lastBuildTimeS: number; - /** - * Number of pending indexing operations. This value is deprecated and should not be used. - */ - numberOfPendingTask?: number; - /** - * A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. - */ - pendingTask: boolean; - /** - * Only present if the index is a replica. Contains the name of the related primary index. - */ - primary?: string; - /** - * Only present if the index is a primary index with replicas. Contains the names of all linked replicas. - */ - replicas?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/key.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/key.ts deleted file mode 100644 index d85de7bdd2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/key.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ApiKey } from './apiKey'; -import type { CreatedAtObject } from './createdAtObject'; - -export type Key = ApiKey & CreatedAtObject; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts deleted file mode 100644 index 618cea65a3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { DictionaryLanguage } from './dictionaryLanguage'; - -/** - * A dictionary language. - */ -export type Languages = { - plurals: DictionaryLanguage | null; - stopwords: DictionaryLanguage | null; - compounds: DictionaryLanguage | null; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts deleted file mode 100644 index 4a3b978db4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Key } from './key'; - -export type ListApiKeysResponse = { - /** - * List of api keys. - */ - keys: Key[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts deleted file mode 100644 index 245e8b9d00..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Array of clusters. - */ -export type ListClustersResponse = { - /** - * Mapping of cluster names to top users. - */ - topUsers: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts deleted file mode 100644 index c89d4922ff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Indice } from './indice'; - -export type ListIndicesResponse = { - /** - * List of the fetched indices. - */ - items?: Indice[]; - /** - * Number of pages. - */ - nbPages?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts deleted file mode 100644 index c0d9d9c1a9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { UserId } from './userId'; - -/** - * UserIDs data. - */ -export type ListUserIdsResponse = { - /** - * List of userIDs. - */ - userIDs: UserId[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts deleted file mode 100644 index 09863f02bd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type MultipleBatchResponse = { - /** - * List of tasksIDs per index. - */ - taskID?: Record; - /** - * List of objectID. - */ - objectIDs?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts deleted file mode 100644 index 0779eac6d1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * GetObjects operation on an index. - */ -export type MultipleGetObjectsParams = { - /** - * List of attributes to retrieve. By default, all retrievable attributes are returned. - */ - attributesToRetrieve?: string[]; - /** - * ID of the object within that index. - */ - objectID: string; - /** - * Name of the index containing the object. - */ - indexName: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts deleted file mode 100644 index 1096b0c8fa..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { MultipleQueriesType } from './multipleQueriesType'; - -export type MultipleQueries = { - /** - * The Algolia index name. - */ - indexName: string; - /** - * The text to search in the index. - */ - query?: string; - type?: MultipleQueriesType; - /** - * The `facet` name. - */ - facet?: string; - /** - * A query string of search parameters. - */ - params?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts deleted file mode 100644 index eef22ed29f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { MultipleQueries } from './multipleQueries'; -import type { MultipleQueriesStrategy } from './multipleQueriesStrategy'; - -export type MultipleQueriesParams = { - requests: MultipleQueries[]; - strategy?: MultipleQueriesStrategy; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts deleted file mode 100644 index 7d96feba7b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SearchResponse } from './searchResponse'; - -export type MultipleQueriesResponse = { - results?: SearchResponse[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts deleted file mode 100644 index 5090359e8e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts +++ /dev/null @@ -1 +0,0 @@ -export type MultipleQueriesStrategy = 'none' | 'stopIfEnoughMatches'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts deleted file mode 100644 index cd27b91929..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Perform a search query with `default`, will search for facet values if `facet` is given. - */ - -export type MultipleQueriesType = 'default' | 'facet'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts deleted file mode 100644 index bc80b8fbbd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Action } from './action'; - -export type Operation = { - action?: Action; - /** - * Arguments to the operation (depends on the type of the operation). - */ - body?: Record; - /** - * Index to target for this operation. - */ - indexName?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts deleted file mode 100644 index 90da3e1e22..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { OperationType } from './operationType'; -import type { ScopeType } from './scopeType'; - -export type OperationIndexParams = { - operation: OperationType; - /** - * The Algolia index name. - */ - destination: string; - /** - * Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. - */ - scope?: ScopeType[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts deleted file mode 100644 index 9d7bab7040..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Type of operation to perform (move or copy). - */ - -export type OperationType = 'copy' | 'move'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/params.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/params.ts deleted file mode 100644 index 59c91f2bc1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/params.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { AutomaticFacetFilter } from './automaticFacetFilter'; - -/** - * Additional search parameters. Any valid search parameter is allowed. - */ -export type Params = { - /** - * Query string. - */ - query?: string; - /** - * Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern. - */ - automaticFacetFilters?: AutomaticFacetFilter[]; - /** - * Same syntax as automaticFacetFilters, but the engine treats the filters as optional. - */ - automaticOptionalFacetFilters?: AutomaticFacetFilter[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts deleted file mode 100644 index 915ad295da..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Object to promote as hits. - */ -export type Promote = { - /** - * Unique identifier of the object to promote. - */ - objectID?: string; - /** - * Array of unique identifiers of the objects to promote. - */ - objectIDs?: string[]; - /** - * The position to promote the objects to (zero-based). If you pass objectIDs, the objects are placed at this position as a group. For example, if you pass four objectIDs to position 0, the objects take the first four positions. - */ - position: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts deleted file mode 100644 index c14a767726..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; - -export type RankingInfo = { - /** - * This field is reserved for advanced usage. - */ - filters?: number; - /** - * Position of the most important matched attribute in the attributes to index list. - */ - firstMatchedWord?: number; - /** - * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). - */ - geoDistance?: number; - /** - * Precision used when computing the geo distance, in meters. - */ - geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; - /** - * Number of exactly matched words. - */ - nbExactWords?: number; - /** - * Number of typos encountered when matching the record. - */ - nbTypos?: number; - /** - * Present and set to true if a Rule promoted the hit. - */ - promoted?: boolean; - /** - * When the query contains more than one word, the sum of the distances between matched words (in meters). - */ - proximityDistance?: number; - /** - * Custom ranking for the object, expressed as a single integer value. - */ - userScore?: number; - /** - * Number of matched words, including prefixes and typos. - */ - word?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts deleted file mode 100644 index bc9ce84718..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type RankingInfoMatchedGeoLocation = { - /** - * Latitude of the matched location. - */ - lat?: number; - /** - * Longitude of the matched location. - */ - lng?: number; - /** - * Distance between the matched location and the search location (in meters). - */ - distance?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts deleted file mode 100644 index 8326ce561d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RemoveUserIdResponse = { - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts deleted file mode 100644 index 6800a2a53f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type ReplaceSourceResponse = { - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts deleted file mode 100644 index e65265a403..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { Condition } from './condition'; -import type { Consequence } from './consequence'; -import type { TimeRange } from './timeRange'; - -/** - * Rule object. - */ -export type Rule = { - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule. - */ - conditions?: Condition[]; - consequence: Consequence; - /** - * This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It\'s not interpreted by the API. - */ - description?: string; - /** - * Whether the Rule is enabled. Disabled Rules remain in the index, but aren\'t applied at query time. - */ - enabled?: boolean; - /** - * By default, Rules are permanently valid. When validity periods are specified, the Rule applies only during those periods; it\'s ignored the rest of the time. The list must not be empty. - */ - validity?: TimeRange[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts deleted file mode 100644 index 03a99554e4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type SaveObjectResponse = { - createdAt?: string; - /** - * TaskID of the task to wait for. - */ - taskID?: number; - /** - * Unique identifier of the object. - */ - objectID?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts deleted file mode 100644 index 5c83340b46..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type SaveSynonymResponse = { - /** - * TaskID of the task to wait for. - */ - taskID: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; - /** - * ObjectID of the inserted object. - */ - id: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts deleted file mode 100644 index ea19044f2d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts +++ /dev/null @@ -1 +0,0 @@ -export type ScopeType = 'rules' | 'settings' | 'synonyms'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts deleted file mode 100644 index 4f9b7a158f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * The `searchDictionaryEntries` parameters. - */ -export type SearchDictionaryEntriesParams = { - /** - * The text to search in the index. - */ - query: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; - /** - * Language ISO code supported by the dictionary (e.g., \"en\" for English). - */ - language?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts deleted file mode 100644 index f7147f3d3e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type SearchForFacetValuesRequest = { - /** - * Search parameters as URL-encoded query string. - */ - params?: string; - /** - * Text to search inside the facet\'s values. - */ - facetQuery?: string; - /** - * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. - */ - maxFacetHits?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts deleted file mode 100644 index 971b0f6b56..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SearchForFacetValuesResponseFacetHits } from './searchForFacetValuesResponseFacetHits'; - -export type SearchForFacetValuesResponse = { - facetHits: SearchForFacetValuesResponseFacetHits[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts deleted file mode 100644 index 08b3ae166a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type SearchForFacetValuesResponseFacetHits = { - /** - * Raw value of the facet. - */ - value: string; - /** - * Markup text with occurrences highlighted. - */ - highlighted: string; - /** - * How many objects contain this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the counts may not be exhaustive. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts deleted file mode 100644 index ca99c320ef..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Hit } from './hit'; - -export type SearchHits = { - hits?: Hit[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts deleted file mode 100644 index b1675283bb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { SearchParamsObject } from './searchParamsObject'; -import type { SearchParamsString } from './searchParamsString'; - -export type SearchParams = SearchParamsObject | SearchParamsString; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts deleted file mode 100644 index ad8f80c073..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import type { RequiredSearchParams } from './requiredSearchParams'; - -export type SearchParamsObject = BaseSearchParams & - IndexSettingsAsSearchParams & - RequiredSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts deleted file mode 100644 index 3aff58347d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type SearchParamsString = { - /** - * Search parameters as URL-encoded query string. - */ - params?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts deleted file mode 100644 index 369e1d297c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseSearchResponse } from './baseSearchResponse'; -import type { SearchHits } from './searchHits'; - -export type SearchResponse = BaseSearchResponse & SearchHits; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts deleted file mode 100644 index afa60a07d7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Anchoring } from './anchoring'; - -/** - * Parameters for the search. - */ -export type SearchRulesParams = { - /** - * Full text query. - */ - query?: string; - anchoring?: Anchoring; - /** - * Restricts matches to contextual rules with a specific context (exact match). - */ - context?: string; - /** - * Requested page (zero-based). - */ - page?: number; - /** - * Maximum number of hits in a page. Minimum is 1, maximum is 1000. - */ - hitsPerPage?: number; - /** - * When specified, restricts matches to rules with a specific enabled status. When absent (default), all rules are retrieved, regardless of their enabled status. - */ - enabled?: boolean; - /** - * A mapping of requestOptions to send along with the request. - */ - requestOptions?: Array>; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts deleted file mode 100644 index ce4f100e43..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Rule } from './rule'; - -export type SearchRulesResponse = { - /** - * Fetched rules. - */ - hits: Rule[]; - /** - * Number of fetched rules. - */ - nbHits: number; - /** - * Current page. - */ - page: number; - /** - * Number of pages. - */ - nbPages: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts deleted file mode 100644 index b50c74feac..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { SynonymHit } from './synonymHit'; - -export type SearchSynonymsResponse = { - /** - * Array of synonym objects. - */ - hits: SynonymHit[]; - /** - * Number of hits that the search query matched. - */ - nbHits: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts deleted file mode 100644 index 6611c71619..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * OK. - */ -export type SearchUserIdsParams = { - /** - * Query to search. The search is a prefix search with typoTolerance. Use empty query to retrieve all users. - */ - query: string; - /** - * Name of the cluster. - */ - clusterName?: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts deleted file mode 100644 index 6434c679b6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { SearchUserIdsResponseHits } from './searchUserIdsResponseHits'; - -/** - * UserIDs data. - */ -export type SearchUserIdsResponse = { - /** - * List of user object matching the query. - */ - hits: SearchUserIdsResponseHits[]; - /** - * Number of hits that the search query matched. - */ - nbHits: number; - /** - * Specify the page to retrieve. - */ - page: number; - /** - * Maximum number of hits in a page. Minimum is 1, maximum is 1000. - */ - hitsPerPage: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts deleted file mode 100644 index 6f575186df..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { HighlightResult } from './highlightResult'; - -export type SearchUserIdsResponseHighlightResult = { - userID: HighlightResult; - clusterName: HighlightResult; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts deleted file mode 100644 index cc24f82cf0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { SearchUserIdsResponseHighlightResult } from './searchUserIdsResponseHighlightResult'; - -export type SearchUserIdsResponseHits = { - /** - * UserID of the user. - */ - userID: string; - /** - * Name of the cluster. - */ - clusterName: string; - /** - * Number of records in the cluster. - */ - nbRecords: number; - /** - * Data size taken by all the users assigned to the cluster. - */ - dataSize: number; - /** - * UserID of the requested user. Same as userID. - */ - objectID: string; - _highlightResult: SearchUserIdsResponseHighlightResult; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts deleted file mode 100644 index 0f8d17bc3d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type SnippetResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: SnippetResultMatchLevel; -}; - -export type SnippetResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/source.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/source.ts deleted file mode 100644 index 79813c184a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/source.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The source. - */ -export type Source = { - /** - * The IP range of the source. - */ - source: string; - /** - * The description of the source. - */ - description?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts deleted file mode 100644 index f7b9e505bf..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Map of language ISO code supported by the dictionary (e.g., \"en\" for English) to a boolean value. - */ -export type StandardEntries = { - /** - * Language ISO code. - */ - plurals?: { [key: string]: boolean } | null; - /** - * Language ISO code. - */ - stopwords?: { [key: string]: boolean } | null; - /** - * Language ISO code. - */ - compounds?: { [key: string]: boolean } | null; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts deleted file mode 100644 index 2bbe5dbe11..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { SynonymHitHighlightResult } from './synonymHitHighlightResult'; -import type { SynonymType } from './synonymType'; - -/** - * Synonym object. - */ -export type SynonymHit = { - /** - * Unique identifier of the synonym object to be created or updated. - */ - objectID: string; - type: SynonymType; - /** - * Words or phrases to be considered equivalent. - */ - synonyms?: string[]; - /** - * Word or phrase to appear in query strings (for onewaysynonym). - */ - input?: string; - /** - * Word or phrase to appear in query strings (for altcorrection1 and altcorrection2). - */ - word?: string; - /** - * Words to be matched in records. - */ - corrections?: string[]; - /** - * Token to be put inside records. - */ - placeholder?: string; - /** - * List of query words that will match the token. - */ - replacements?: string[]; - _highlightResult?: SynonymHitHighlightResult; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts deleted file mode 100644 index 6d47548143..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { HighlightResult } from './highlightResult'; - -/** - * Highlighted results. - */ -export type SynonymHitHighlightResult = { - type?: HighlightResult; - synonyms?: HighlightResult[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts deleted file mode 100644 index f7a6b44452..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Type of the synonym object. - */ - -export type SynonymType = - | 'altcorrection1' - | 'altcorrection2' - | 'onewaysynonym' - | 'placeholder' - | 'synonym'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts deleted file mode 100644 index 2c0a2444fd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type TimeRange = { - /** - * Lower bound of the time range (Unix timestamp). - */ - from: number; - /** - * Upper bound of the time range (Unix timestamp). - */ - until: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts deleted file mode 100644 index 5bf38cb912..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type UpdateApiKeyResponse = { - /** - * Key string. - */ - key: string; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts deleted file mode 100644 index 90755a3379..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The response with a taskID and an updatedAt timestamp. - */ -export type UpdatedAtResponse = { - /** - * TaskID of the task to wait for. - */ - taskID: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts deleted file mode 100644 index 5ace1ab507..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * The response with a taskID, an objectID and an updatedAt timestamp. - */ -export type UpdatedAtWithObjectIdResponse = { - /** - * TaskID of the task to wait for. - */ - taskID?: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt?: string; - /** - * Unique identifier of the object. - */ - objectID?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts deleted file mode 100644 index b47eae6e23..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type UpdatedRuleResponse = { - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; - /** - * TaskID of the task to wait for. - */ - taskID: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts deleted file mode 100644 index a79a52f2bd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A userID. - */ -export type UserId = { - /** - * UserID of the user. - */ - userID: string; - /** - * Cluster on which the user is assigned. - */ - clusterName: string; - /** - * Number of records belonging to the user. - */ - nbRecords: number; - /** - * Data size used by the user. - */ - dataSize: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/package.json b/clients/algoliasearch-client-javascript/packages/client-search/package.json deleted file mode 100644 index e21f555cd7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-search", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-search", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-search.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-search.umd.browser.js", - "unpkg": "dist/client-search.umd.browser.js", - "browser": "dist/client-search.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts deleted file mode 100644 index b99e6a7f89..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts +++ /dev/null @@ -1,2932 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, - shuffle, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { AddApiKeyResponse } from '../model/addApiKeyResponse'; -import type { ApiKey } from '../model/apiKey'; -import type { AssignUserIdParams } from '../model/assignUserIdParams'; -import type { BatchAssignUserIdsParams } from '../model/batchAssignUserIdsParams'; -import type { BatchDictionaryEntriesParams } from '../model/batchDictionaryEntriesParams'; -import type { BatchParams } from '../model/batchParams'; -import type { BatchResponse } from '../model/batchResponse'; -import type { BatchWriteParams } from '../model/batchWriteParams'; -import type { BrowseRequest } from '../model/browseRequest'; -import type { BrowseResponse } from '../model/browseResponse'; -import type { BuiltInOperation } from '../model/builtInOperation'; -import type { CreatedAtResponse } from '../model/createdAtResponse'; -import type { DeleteApiKeyResponse } from '../model/deleteApiKeyResponse'; -import type { DeleteSourceResponse } from '../model/deleteSourceResponse'; -import type { DeletedAtResponse } from '../model/deletedAtResponse'; -import type { DictionarySettingsParams } from '../model/dictionarySettingsParams'; -import type { GetDictionarySettingsResponse } from '../model/getDictionarySettingsResponse'; -import type { GetLogsResponse } from '../model/getLogsResponse'; -import type { GetObjectsParams } from '../model/getObjectsParams'; -import type { GetObjectsResponse } from '../model/getObjectsResponse'; -import type { GetTaskResponse } from '../model/getTaskResponse'; -import type { GetTopUserIdsResponse } from '../model/getTopUserIdsResponse'; -import type { IndexSettings } from '../model/indexSettings'; -import type { Key } from '../model/key'; -import type { Languages } from '../model/languages'; -import type { ListApiKeysResponse } from '../model/listApiKeysResponse'; -import type { ListClustersResponse } from '../model/listClustersResponse'; -import type { ListIndicesResponse } from '../model/listIndicesResponse'; -import type { ListUserIdsResponse } from '../model/listUserIdsResponse'; -import type { MultipleBatchResponse } from '../model/multipleBatchResponse'; -import type { MultipleQueriesParams } from '../model/multipleQueriesParams'; -import type { MultipleQueriesResponse } from '../model/multipleQueriesResponse'; -import type { OperationIndexParams } from '../model/operationIndexParams'; -import type { RemoveUserIdResponse } from '../model/removeUserIdResponse'; -import type { ReplaceSourceResponse } from '../model/replaceSourceResponse'; -import type { Rule } from '../model/rule'; -import type { SaveObjectResponse } from '../model/saveObjectResponse'; -import type { SaveSynonymResponse } from '../model/saveSynonymResponse'; -import type { SearchDictionaryEntriesParams } from '../model/searchDictionaryEntriesParams'; -import type { SearchForFacetValuesRequest } from '../model/searchForFacetValuesRequest'; -import type { SearchForFacetValuesResponse } from '../model/searchForFacetValuesResponse'; -import type { SearchParams } from '../model/searchParams'; -import type { SearchResponse } from '../model/searchResponse'; -import type { SearchRulesParams } from '../model/searchRulesParams'; -import type { SearchRulesResponse } from '../model/searchRulesResponse'; -import type { SearchSynonymsResponse } from '../model/searchSynonymsResponse'; -import type { SearchUserIdsParams } from '../model/searchUserIdsParams'; -import type { SearchUserIdsResponse } from '../model/searchUserIdsResponse'; -import type { Source } from '../model/source'; -import type { SynonymHit } from '../model/synonymHit'; -import type { SynonymType } from '../model/synonymType'; -import type { UpdateApiKeyResponse } from '../model/updateApiKeyResponse'; -import type { UpdatedAtResponse } from '../model/updatedAtResponse'; -import type { UpdatedAtWithObjectIdResponse } from '../model/updatedAtWithObjectIdResponse'; -import type { UpdatedRuleResponse } from '../model/updatedRuleResponse'; -import type { UserId } from '../model/userId'; - -export const apiClientVersion = '5.0.0'; - -function getDefaultHosts(appId: string): Host[] { - return ( - [ - { - url: `${appId}-dsn.algolia.net`, - accept: 'read', - protocol: 'https', - }, - { - url: `${appId}.algolia.net`, - accept: 'write', - protocol: 'https', - }, - ] as Host[] - ).concat( - shuffle([ - { - url: `${appId}-1.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-2.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-3.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]) - ); -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createSearchApi(options: CreateClientOptions) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.appId), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Search', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Add a new API Key with specific permissions/restrictions. - * - * @summary Create a new API key. - * @param apiKey - The apiKey object. - */ - function addApiKey(apiKey: ApiKey): Promise { - const path = '/1/keys'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!apiKey) { - throw new Error( - 'Parameter `apiKey` is required when calling `addApiKey`.' - ); - } - - if (!apiKey.acl) { - throw new Error( - 'Parameter `apiKey.acl` is required when calling `addApiKey`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: apiKey, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Add or replace an object with a given object ID. If the object does not exist, it will be created. If it already exists, it will be replaced. - * - * @summary Add or replace an object with a given object ID. - * @param addOrUpdateObject - The addOrUpdateObject object. - * @param addOrUpdateObject.indexName - The index in which to perform the request. - * @param addOrUpdateObject.objectID - Unique identifier of an object. - * @param addOrUpdateObject.body - The Algolia object. - */ - function addOrUpdateObject({ - indexName, - objectID, - body, - }: AddOrUpdateObjectProps): Promise { - const path = '/1/indexes/{indexName}/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `addOrUpdateObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `addOrUpdateObject`.' - ); - } - - if (!body) { - throw new Error( - 'Parameter `body` is required when calling `addOrUpdateObject`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: body, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Add a single source to the list of allowed sources. - * - * @summary Add a single source. - * @param source - The source to add. - */ - function appendSource(source: Source): Promise { - const path = '/1/security/sources/append'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!source) { - throw new Error( - 'Parameter `source` is required when calling `appendSource`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: source, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Assign or Move a userID to a cluster. The time it takes to migrate (move) a user is proportional to the amount of data linked to the userID. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userID is directly usable. - * - * @summary Assign or Move userID. - * @param assignUserId - The assignUserId object. - * @param assignUserId.xAlgoliaUserID - UserID to assign. - * @param assignUserId.assignUserIdParams - The assignUserIdParams object. - */ - function assignUserId({ - xAlgoliaUserID, - assignUserIdParams, - }: AssignUserIdProps): Promise { - const path = '/1/clusters/mapping'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!xAlgoliaUserID) { - throw new Error( - 'Parameter `xAlgoliaUserID` is required when calling `assignUserId`.' - ); - } - - if (!assignUserIdParams) { - throw new Error( - 'Parameter `assignUserIdParams` is required when calling `assignUserId`.' - ); - } - - if (!assignUserIdParams.cluster) { - throw new Error( - 'Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.' - ); - } - - if (xAlgoliaUserID !== undefined) { - queryParameters['X-Algolia-User-ID'] = xAlgoliaUserID.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: assignUserIdParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Performs multiple write operations in a single API call. - * - * @summary Performs multiple write operations in a single API call. - * @param batch - The batch object. - * @param batch.indexName - The index in which to perform the request. - * @param batch.batchWriteParams - The batchWriteParams object. - */ - function batch({ - indexName, - batchWriteParams, - }: BatchProps): Promise { - const path = '/1/indexes/{indexName}/batch'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `batch`.' - ); - } - - if (!batchWriteParams) { - throw new Error( - 'Parameter `batchWriteParams` is required when calling `batch`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: batchWriteParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Assign multiple userIDs to a cluster. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable. - * - * @summary Batch assign userIDs. - * @param batchAssignUserIds - The batchAssignUserIds object. - * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign. - * @param batchAssignUserIds.batchAssignUserIdsParams - The batchAssignUserIdsParams object. - */ - function batchAssignUserIds({ - xAlgoliaUserID, - batchAssignUserIdsParams, - }: BatchAssignUserIdsProps): Promise { - const path = '/1/clusters/mapping/batch'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!xAlgoliaUserID) { - throw new Error( - 'Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.' - ); - } - - if (!batchAssignUserIdsParams) { - throw new Error( - 'Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.' - ); - } - - if (!batchAssignUserIdsParams.cluster) { - throw new Error( - 'Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.' - ); - } - if (!batchAssignUserIdsParams.users) { - throw new Error( - 'Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.' - ); - } - - if (xAlgoliaUserID !== undefined) { - queryParameters['X-Algolia-User-ID'] = xAlgoliaUserID.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: batchAssignUserIdsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Send a batch of dictionary entries. - * - * @summary Send a batch of dictionary entries. - * @param batchDictionaryEntries - The batchDictionaryEntries object. - * @param batchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param batchDictionaryEntries.batchDictionaryEntriesParams - The batchDictionaryEntriesParams object. - */ - function batchDictionaryEntries({ - dictionaryName, - batchDictionaryEntriesParams, - }: BatchDictionaryEntriesProps): Promise { - const path = '/1/dictionaries/{dictionaryName}/batch'.replace( - '{dictionaryName}', - encodeURIComponent(String(dictionaryName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!dictionaryName) { - throw new Error( - 'Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.' - ); - } - - if (!batchDictionaryEntriesParams) { - throw new Error( - 'Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.' - ); - } - - if (!batchDictionaryEntriesParams.requests) { - throw new Error( - 'Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: batchDictionaryEntriesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create or update a batch of Rules. - * - * @summary Batch Rules. - * @param batchRules - The batchRules object. - * @param batchRules.indexName - The index in which to perform the request. - * @param batchRules.rule - The rule object. - * @param batchRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - * @param batchRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. - */ - function batchRules({ - indexName, - rule, - forwardToReplicas, - clearExistingRules, - }: BatchRulesProps): Promise { - const path = '/1/indexes/{indexName}/rules/batch'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `batchRules`.' - ); - } - - if (!rule) { - throw new Error( - 'Parameter `rule` is required when calling `batchRules`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - if (clearExistingRules !== undefined) { - queryParameters.clearExistingRules = clearExistingRules.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: rule, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * This method allows you to retrieve all index content. It can retrieve up to 1,000 records per call and supports full text search and filters. For performance reasons, some features are not supported, including `distinct`, sorting by `typos`, `words` or `geo distance`. When there is more content to be browsed, the response contains a cursor field. This cursor has to be passed to the subsequent call to browse in order to get the next page of results. When the end of the index has been reached, the cursor field is absent from the response. - * - * @summary Retrieve all index content. - * @param browse - The browse object. - * @param browse.indexName - The index in which to perform the request. - * @param browse.browseRequest - The browseRequest object. - */ - function browse({ - indexName, - browseRequest, - }: BrowseProps): Promise { - const path = '/1/indexes/{indexName}/browse'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `browse`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: browseRequest, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove all synonyms from an index. - * - * @summary Clear all synonyms. - * @param clearAllSynonyms - The clearAllSynonyms object. - * @param clearAllSynonyms.indexName - The index in which to perform the request. - * @param clearAllSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function clearAllSynonyms({ - indexName, - forwardToReplicas, - }: ClearAllSynonymsProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/clear'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `clearAllSynonyms`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an index\'s content, but leave settings and index-specific API keys untouched. - * - * @summary Clear all objects from an index. - * @param clearObjects - The clearObjects object. - * @param clearObjects.indexName - The index in which to perform the request. - */ - function clearObjects({ - indexName, - }: ClearObjectsProps): Promise { - const path = '/1/indexes/{indexName}/clear'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `clearObjects`.' - ); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete all Rules in the index. - * - * @summary Clear Rules. - * @param clearRules - The clearRules object. - * @param clearRules.indexName - The index in which to perform the request. - * @param clearRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function clearRules({ - indexName, - forwardToReplicas, - }: ClearRulesProps): Promise { - const path = '/1/indexes/{indexName}/rules/clear'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `clearRules`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an existing API Key. - * - * @summary Delete an API key. - * @param deleteApiKey - The deleteApiKey object. - * @param deleteApiKey.key - API Key string. - */ - function deleteApiKey({ - key, - }: DeleteApiKeyProps): Promise { - const path = '/1/keys/{key}'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error( - 'Parameter `key` is required when calling `deleteApiKey`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove all objects matching a filter (including geo filters). This method enables you to delete one or more objects based on filters (numeric, facet, tag or geo queries). It doesn\'t accept empty filters or a query. - * - * @summary Delete all records matching the query. - * @param deleteBy - The deleteBy object. - * @param deleteBy.indexName - The index in which to perform the request. - * @param deleteBy.searchParams - The searchParams object. - */ - function deleteBy({ - indexName, - searchParams, - }: DeleteByProps): Promise { - const path = '/1/indexes/{indexName}/deleteByQuery'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteBy`.' - ); - } - - if (!searchParams) { - throw new Error( - 'Parameter `searchParams` is required when calling `deleteBy`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an existing index. - * - * @summary Delete index. - * @param deleteIndex - The deleteIndex object. - * @param deleteIndex.indexName - The index in which to perform the request. - */ - function deleteIndex({ - indexName, - }: DeleteIndexProps): Promise { - const path = '/1/indexes/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteIndex`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an existing object. - * - * @summary Delete object. - * @param deleteObject - The deleteObject object. - * @param deleteObject.indexName - The index in which to perform the request. - * @param deleteObject.objectID - Unique identifier of an object. - */ - function deleteObject({ - indexName, - objectID, - }: DeleteObjectProps): Promise { - const path = '/1/indexes/{indexName}/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `deleteObject`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete the Rule with the specified objectID. - * - * @summary Delete a rule. - * @param deleteRule - The deleteRule object. - * @param deleteRule.indexName - The index in which to perform the request. - * @param deleteRule.objectID - Unique identifier of an object. - * @param deleteRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function deleteRule({ - indexName, - objectID, - forwardToReplicas, - }: DeleteRuleProps): Promise { - const path = '/1/indexes/{indexName}/rules/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteRule`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `deleteRule`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove a single source from the list of allowed sources. - * - * @summary Remove a single source. - * @param deleteSource - The deleteSource object. - * @param deleteSource.source - The IP range of the source. - */ - function deleteSource({ - source, - }: DeleteSourceProps): Promise { - const path = '/1/security/sources/{source}'.replace( - '{source}', - encodeURIComponent(String(source)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!source) { - throw new Error( - 'Parameter `source` is required when calling `deleteSource`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete a single synonyms set, identified by the given objectID. - * - * @summary Delete synonym. - * @param deleteSynonym - The deleteSynonym object. - * @param deleteSynonym.indexName - The index in which to perform the request. - * @param deleteSynonym.objectID - Unique identifier of an object. - * @param deleteSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function deleteSynonym({ - indexName, - objectID, - forwardToReplicas, - }: DeleteSynonymProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteSynonym`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `deleteSynonym`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the permissions of an API key. - * - * @summary Get an API key. - * @param getApiKey - The getApiKey object. - * @param getApiKey.key - API Key string. - */ - function getApiKey({ key }: GetApiKeyProps): Promise { - const path = '/1/keys/{key}'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error('Parameter `key` is required when calling `getApiKey`.'); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List dictionaries supported per language. - * - * @summary List dictionaries supported per language. - */ - function getDictionaryLanguages(): Promise<{ [key: string]: Languages }> { - const path = '/1/dictionaries/*/languages'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve dictionaries settings. - * - * @summary Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. - */ - function getDictionarySettings(): Promise { - const path = '/1/dictionaries/*/settings'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Return the lastest log entries. - * - * @summary Return the lastest log entries. - * @param getLogs - The getLogs object. - * @param getLogs.offset - First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. - * @param getLogs.length - Maximum number of entries to retrieve. The maximum allowed value is 1000. - * @param getLogs.indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. - * @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved. - */ - function getLogs({ - offset, - length, - indexName, - type, - }: GetLogsProps): Promise { - const path = '/1/logs'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (length !== undefined) { - queryParameters.length = length.toString(); - } - - if (indexName !== undefined) { - queryParameters.indexName = indexName.toString(); - } - - if (type !== undefined) { - queryParameters.type = type.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve one object from the index. - * - * @summary Retrieve one object from the index. - * @param getObject - The getObject object. - * @param getObject.indexName - The index in which to perform the request. - * @param getObject.objectID - Unique identifier of an object. - * @param getObject.attributesToRetrieve - List of attributes to retrieve. If not specified, all retrievable attributes are returned. - */ - function getObject({ - indexName, - objectID, - attributesToRetrieve, - }: GetObjectProps): Promise<{ [key: string]: string }> { - const path = '/1/indexes/{indexName}/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `getObject`.' - ); - } - - if (attributesToRetrieve !== undefined) { - queryParameters.attributesToRetrieve = attributesToRetrieve.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve one or more objects, potentially from different indices, in a single API call. - * - * @summary Retrieve one or more objects. - * @param getObjectsParams - The getObjectsParams object. - */ - function getObjects( - getObjectsParams: GetObjectsParams - ): Promise { - const path = '/1/indexes/*/objects'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!getObjectsParams) { - throw new Error( - 'Parameter `getObjectsParams` is required when calling `getObjects`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: getObjectsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve the Rule with the specified objectID. - * - * @summary Get a rule. - * @param getRule - The getRule object. - * @param getRule.indexName - The index in which to perform the request. - * @param getRule.objectID - Unique identifier of an object. - */ - function getRule({ indexName, objectID }: GetRuleProps): Promise { - const path = '/1/indexes/{indexName}/rules/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getRule`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `getRule`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve settings of a given indexName. - * - * @summary Retrieve settings of a given indexName. - * @param getSettings - The getSettings object. - * @param getSettings.indexName - The index in which to perform the request. - */ - function getSettings({ - indexName, - }: GetSettingsProps): Promise { - const path = '/1/indexes/{indexName}/settings'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getSettings`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List all allowed sources. - * - * @summary List all allowed sources. - */ - function getSources(): Promise { - const path = '/1/security/sources'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Fetch a synonym object identified by its objectID. - * - * @summary Get synonym. - * @param getSynonym - The getSynonym object. - * @param getSynonym.indexName - The index in which to perform the request. - * @param getSynonym.objectID - Unique identifier of an object. - */ - function getSynonym({ - indexName, - objectID, - }: GetSynonymProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getSynonym`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `getSynonym`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Check the current status of a given task. - * - * @summary Check the current status of a given task. - * @param getTask - The getTask object. - * @param getTask.indexName - The index in which to perform the request. - * @param getTask.taskID - Unique identifier of an task. Numeric value (up to 64bits). - */ - function getTask({ - indexName, - taskID, - }: GetTaskProps): Promise { - const path = '/1/indexes/{indexName}/task/{taskID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{taskID}', encodeURIComponent(String(taskID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getTask`.' - ); - } - - if (!taskID) { - throw new Error('Parameter `taskID` is required when calling `getTask`.'); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the top 10 userIDs with the highest number of records per cluster. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following array of userIDs and clusters. - * - * @summary Get top userID. - */ - function getTopUserIds(): Promise { - const path = '/1/clusters/mapping/top'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the userID data stored in the mapping. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userID data. - * - * @summary Get userID. - * @param getUserId - The getUserId object. - * @param getUserId.userID - UserID to assign. - */ - function getUserId({ userID }: GetUserIdProps): Promise { - const path = '/1/clusters/mapping/{userID}'.replace( - '{userID}', - encodeURIComponent(String(userID)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userID) { - throw new Error( - 'Parameter `userID` is required when calling `getUserId`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the status of your clusters\' migrations or user creations. Creating a large batch of users or migrating your multi-cluster may take quite some time. This method lets you retrieve the status of the migration, so you can know when it\'s done. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable. - * - * @summary Has pending mappings. - * @param hasPendingMappings - The hasPendingMappings object. - * @param hasPendingMappings.getClusters - Whether to get clusters or not. - */ - function hasPendingMappings({ - getClusters, - }: HasPendingMappingsProps): Promise { - const path = '/1/clusters/mapping/pending'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (getClusters !== undefined) { - queryParameters.getClusters = getClusters.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List API keys, along with their associated rights. - * - * @summary Get the full list of API Keys. - */ - function listApiKeys(): Promise { - const path = '/1/keys'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List the clusters available in a multi-clusters setup for a single appID. Upon success, the response is 200 OK and contains the following clusters. - * - * @summary List clusters. - */ - function listClusters(): Promise { - const path = '/1/clusters'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List existing indexes from an application. - * - * @summary List existing indexes. - * @param listIndices - The listIndices object. - * @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - function listIndices({ - page, - }: ListIndicesProps): Promise { - const path = '/1/indexes'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List the userIDs assigned to a multi-clusters appID. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userIDs data. - * - * @summary List userIDs. - * @param listUserIds - The listUserIds object. - * @param listUserIds.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * @param listUserIds.hitsPerPage - Maximum number of objects to retrieve. - */ - function listUserIds({ - page, - hitsPerPage, - }: ListUserIdsProps): Promise { - const path = '/1/clusters/mapping'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - if (hitsPerPage !== undefined) { - queryParameters.hitsPerPage = hitsPerPage.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Perform multiple write operations, potentially targeting multiple indices, in a single API call. - * - * @summary Perform multiple write operations. - * @param batchParams - The batchParams object. - */ - function multipleBatch( - batchParams: BatchParams - ): Promise { - const path = '/1/indexes/*/batch'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!batchParams) { - throw new Error( - 'Parameter `batchParams` is required when calling `multipleBatch`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: batchParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get search results for the given requests. - * - * @summary Get search results for the given requests. - * @param multipleQueriesParams - The multipleQueriesParams object. - */ - function multipleQueries( - multipleQueriesParams: MultipleQueriesParams - ): Promise { - const path = '/1/indexes/*/queries'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!multipleQueriesParams) { - throw new Error( - 'Parameter `multipleQueriesParams` is required when calling `multipleQueries`.' - ); - } - - if (!multipleQueriesParams.requests) { - throw new Error( - 'Parameter `multipleQueriesParams.requests` is required when calling `multipleQueries`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: multipleQueriesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Peforms a copy or a move operation on a index. - * - * @summary Copy/move index. - * @param operationIndex - The operationIndex object. - * @param operationIndex.indexName - The index in which to perform the request. - * @param operationIndex.operationIndexParams - The operationIndexParams object. - */ - function operationIndex({ - indexName, - operationIndexParams, - }: OperationIndexProps): Promise { - const path = '/1/indexes/{indexName}/operation'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `operationIndex`.' - ); - } - - if (!operationIndexParams) { - throw new Error( - 'Parameter `operationIndexParams` is required when calling `operationIndex`.' - ); - } - - if (!operationIndexParams.operation) { - throw new Error( - 'Parameter `operationIndexParams.operation` is required when calling `operationIndex`.' - ); - } - if (!operationIndexParams.destination) { - throw new Error( - 'Parameter `operationIndexParams.destination` is required when calling `operationIndex`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: operationIndexParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Update one or more attributes of an existing object. This method lets you update only a part of an existing object, either by adding new attributes or updating existing ones. You can partially update several objects in a single method call. If the index targeted by this operation doesn\'t exist yet, it\'s automatically created. - * - * @summary Partially update an object. - * @param partialUpdateObject - The partialUpdateObject object. - * @param partialUpdateObject.indexName - The index in which to perform the request. - * @param partialUpdateObject.objectID - Unique identifier of an object. - * @param partialUpdateObject.stringBuiltInOperation - List of attributes to update. - * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet. - */ - function partialUpdateObject({ - indexName, - objectID, - stringBuiltInOperation, - createIfNotExists, - }: PartialUpdateObjectProps): Promise { - const path = '/1/indexes/{indexName}/{objectID}/partial' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `partialUpdateObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `partialUpdateObject`.' - ); - } - - if (!stringBuiltInOperation) { - throw new Error( - 'Parameter `stringBuiltInOperation` is required when calling `partialUpdateObject`.' - ); - } - - if (createIfNotExists !== undefined) { - queryParameters.createIfNotExists = createIfNotExists.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: stringBuiltInOperation, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove a userID and its associated data from the multi-clusters. Upon success, the response is 200 OK and a task is created to remove the userID data and mapping. - * - * @summary Remove userID. - * @param removeUserId - The removeUserId object. - * @param removeUserId.userID - UserID to assign. - */ - function removeUserId({ - userID, - }: RemoveUserIdProps): Promise { - const path = '/1/clusters/mapping/{userID}'.replace( - '{userID}', - encodeURIComponent(String(userID)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userID) { - throw new Error( - 'Parameter `userID` is required when calling `removeUserId`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Replace all allowed sources. - * - * @summary Replace all allowed sources. - * @param replaceSources - The replaceSources object. - * @param replaceSources.source - The sources to allow. - */ - function replaceSources({ - source, - }: ReplaceSourcesProps): Promise { - const path = '/1/security/sources'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!source) { - throw new Error( - 'Parameter `source` is required when calling `replaceSources`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: source, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Restore a deleted API key, along with its associated rights. - * - * @summary Restore an API key. - * @param restoreApiKey - The restoreApiKey object. - * @param restoreApiKey.key - API Key string. - */ - function restoreApiKey({ - key, - }: RestoreApiKeyProps): Promise { - const path = '/1/keys/{key}/restore'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error( - 'Parameter `key` is required when calling `restoreApiKey`.' - ); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Add an object to the index, automatically assigning it an object ID. - * - * @summary Add an object to the index. - * @param saveObject - The saveObject object. - * @param saveObject.indexName - The index in which to perform the request. - * @param saveObject.body - The Algolia record. - */ - function saveObject({ - indexName, - body, - }: SaveObjectProps): Promise { - const path = '/1/indexes/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveObject`.' - ); - } - - if (!body) { - throw new Error( - 'Parameter `body` is required when calling `saveObject`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: body, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create or update the Rule with the specified objectID. - * - * @summary Save/Update a rule. - * @param saveRule - The saveRule object. - * @param saveRule.indexName - The index in which to perform the request. - * @param saveRule.objectID - Unique identifier of an object. - * @param saveRule.rule - The rule object. - * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function saveRule({ - indexName, - objectID, - rule, - forwardToReplicas, - }: SaveRuleProps): Promise { - const path = '/1/indexes/{indexName}/rules/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveRule`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `saveRule`.' - ); - } - - if (!rule) { - throw new Error('Parameter `rule` is required when calling `saveRule`.'); - } - - if (!rule.objectID) { - throw new Error( - 'Parameter `rule.objectID` is required when calling `saveRule`.' - ); - } - if (!rule.consequence) { - throw new Error( - 'Parameter `rule.consequence` is required when calling `saveRule`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'PUT', - path, - data: rule, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create a new synonym object or update the existing synonym object with the given object ID. - * - * @summary Save synonym. - * @param saveSynonym - The saveSynonym object. - * @param saveSynonym.indexName - The index in which to perform the request. - * @param saveSynonym.objectID - Unique identifier of an object. - * @param saveSynonym.synonymHit - The synonymHit object. - * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function saveSynonym({ - indexName, - objectID, - synonymHit, - forwardToReplicas, - }: SaveSynonymProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveSynonym`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `saveSynonym`.' - ); - } - - if (!synonymHit) { - throw new Error( - 'Parameter `synonymHit` is required when calling `saveSynonym`.' - ); - } - - if (!synonymHit.objectID) { - throw new Error( - 'Parameter `synonymHit.objectID` is required when calling `saveSynonym`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'PUT', - path, - data: synonymHit, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create/update multiple synonym objects at once, potentially replacing the entire list of synonyms if replaceExistingSynonyms is true. - * - * @summary Save a batch of synonyms. - * @param saveSynonyms - The saveSynonyms object. - * @param saveSynonyms.indexName - The index in which to perform the request. - * @param saveSynonyms.synonymHit - The synonymHit object. - * @param saveSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - * @param saveSynonyms.replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request. - */ - function saveSynonyms({ - indexName, - synonymHit, - forwardToReplicas, - replaceExistingSynonyms, - }: SaveSynonymsProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/batch'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveSynonyms`.' - ); - } - - if (!synonymHit) { - throw new Error( - 'Parameter `synonymHit` is required when calling `saveSynonyms`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - if (replaceExistingSynonyms !== undefined) { - queryParameters.replaceExistingSynonyms = - replaceExistingSynonyms.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: synonymHit, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get search results. - * - * @summary Get search results. - * @param search - The search object. - * @param search.indexName - The index in which to perform the request. - * @param search.searchParams - The searchParams object. - */ - function search({ - indexName, - searchParams, - }: SearchProps): Promise { - const path = '/1/indexes/{indexName}/query'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `search`.' - ); - } - - if (!searchParams) { - throw new Error( - 'Parameter `searchParams` is required when calling `search`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search the dictionary entries. - * - * @summary Search the dictionary entries. - * @param searchDictionaryEntries - The searchDictionaryEntries object. - * @param searchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param searchDictionaryEntries.searchDictionaryEntriesParams - The searchDictionaryEntriesParams object. - */ - function searchDictionaryEntries({ - dictionaryName, - searchDictionaryEntriesParams, - }: SearchDictionaryEntriesProps): Promise { - const path = '/1/dictionaries/{dictionaryName}/search'.replace( - '{dictionaryName}', - encodeURIComponent(String(dictionaryName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!dictionaryName) { - throw new Error( - 'Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.' - ); - } - - if (!searchDictionaryEntriesParams) { - throw new Error( - 'Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.' - ); - } - - if (!searchDictionaryEntriesParams.query) { - throw new Error( - 'Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchDictionaryEntriesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search for values of a given facet, optionally restricting the returned values to those contained in objects matching other search criteria. - * - * @summary Search for values of a given facet. - * @param searchForFacetValues - The searchForFacetValues object. - * @param searchForFacetValues.indexName - The index in which to perform the request. - * @param searchForFacetValues.facetName - The facet name. - * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object. - */ - function searchForFacetValues({ - indexName, - facetName, - searchForFacetValuesRequest, - }: SearchForFacetValuesProps): Promise { - const path = '/1/indexes/{indexName}/facets/{facetName}/query' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{facetName}', encodeURIComponent(String(facetName))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `searchForFacetValues`.' - ); - } - - if (!facetName) { - throw new Error( - 'Parameter `facetName` is required when calling `searchForFacetValues`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchForFacetValuesRequest, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search for rules matching various criteria. - * - * @summary Search for rules. - * @param searchRules - The searchRules object. - * @param searchRules.indexName - The index in which to perform the request. - * @param searchRules.searchRulesParams - The searchRulesParams object. - */ - function searchRules({ - indexName, - searchRulesParams, - }: SearchRulesProps): Promise { - const path = '/1/indexes/{indexName}/rules/search'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `searchRules`.' - ); - } - - if (!searchRulesParams) { - throw new Error( - 'Parameter `searchRulesParams` is required when calling `searchRules`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchRulesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search or browse all synonyms, optionally filtering them by type. - * - * @summary Get all synonyms that match a query. - * @param searchSynonyms - The searchSynonyms object. - * @param searchSynonyms.indexName - The index in which to perform the request. - * @param searchSynonyms.query - Search for specific synonyms matching this string. - * @param searchSynonyms.type - Only search for specific types of synonyms. - * @param searchSynonyms.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * @param searchSynonyms.hitsPerPage - Maximum number of objects to retrieve. - */ - function searchSynonyms({ - indexName, - query, - type, - page, - hitsPerPage, - }: SearchSynonymsProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/search'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `searchSynonyms`.' - ); - } - - if (query !== undefined) { - queryParameters.query = query.toString(); - } - - if (type !== undefined) { - queryParameters.type = type.toString(); - } - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - if (hitsPerPage !== undefined) { - queryParameters.hitsPerPage = hitsPerPage.toString(); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search for userIDs. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds propagate to the different clusters. To keep updates moving quickly, the index of userIDs isn\'t built synchronously with the mapping. Instead, the index is built once every 12h, at the same time as the update of userID usage. For example, when you perform a modification like adding or moving a userID, the search will report an outdated value until the next rebuild of the mapping, which takes place every 12h. Upon success, the response is 200 OK and contains the following userIDs data. - * - * @summary Search userID. - * @param searchUserIdsParams - The searchUserIdsParams object. - */ - function searchUserIds( - searchUserIdsParams: SearchUserIdsParams - ): Promise { - const path = '/1/clusters/mapping/search'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!searchUserIdsParams) { - throw new Error( - 'Parameter `searchUserIdsParams` is required when calling `searchUserIds`.' - ); - } - - if (!searchUserIdsParams.query) { - throw new Error( - 'Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchUserIdsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Set dictionary settings. - * - * @summary Set dictionary settings. - * @param dictionarySettingsParams - The dictionarySettingsParams object. - */ - function setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams - ): Promise { - const path = '/1/dictionaries/*/settings'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!dictionarySettingsParams) { - throw new Error( - 'Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.' - ); - } - - if (!dictionarySettingsParams.disableStandardEntries) { - throw new Error( - 'Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: dictionarySettingsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * - * @summary Update settings of a given indexName. - * @param setSettings - The setSettings object. - * @param setSettings.indexName - The index in which to perform the request. - * @param setSettings.indexSettings - The indexSettings object. - * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function setSettings({ - indexName, - indexSettings, - forwardToReplicas, - }: SetSettingsProps): Promise { - const path = '/1/indexes/{indexName}/settings'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `setSettings`.' - ); - } - - if (!indexSettings) { - throw new Error( - 'Parameter `indexSettings` is required when calling `setSettings`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'PUT', - path, - data: indexSettings, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Replace every permission of an existing API key. - * - * @summary Update an API key. - * @param updateApiKey - The updateApiKey object. - * @param updateApiKey.key - API Key string. - * @param updateApiKey.apiKey - The apiKey object. - */ - function updateApiKey({ - key, - apiKey, - }: UpdateApiKeyProps): Promise { - const path = '/1/keys/{key}'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error( - 'Parameter `key` is required when calling `updateApiKey`.' - ); - } - - if (!apiKey) { - throw new Error( - 'Parameter `apiKey` is required when calling `updateApiKey`.' - ); - } - - if (!apiKey.acl) { - throw new Error( - 'Parameter `apiKey.acl` is required when calling `updateApiKey`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: apiKey, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - addApiKey, - addOrUpdateObject, - appendSource, - assignUserId, - batch, - batchAssignUserIds, - batchDictionaryEntries, - batchRules, - browse, - clearAllSynonyms, - clearObjects, - clearRules, - deleteApiKey, - deleteBy, - deleteIndex, - deleteObject, - deleteRule, - deleteSource, - deleteSynonym, - getApiKey, - getDictionaryLanguages, - getDictionarySettings, - getLogs, - getObject, - getObjects, - getRule, - getSettings, - getSources, - getSynonym, - getTask, - getTopUserIds, - getUserId, - hasPendingMappings, - listApiKeys, - listClusters, - listIndices, - listUserIds, - multipleBatch, - multipleQueries, - operationIndex, - partialUpdateObject, - removeUserId, - replaceSources, - restoreApiKey, - saveObject, - saveRule, - saveSynonym, - saveSynonyms, - search, - searchDictionaryEntries, - searchForFacetValues, - searchRules, - searchSynonyms, - searchUserIds, - setDictionarySettings, - setSettings, - updateApiKey, - }; -} - -export type SearchApi = ReturnType; - -export type AddOrUpdateObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * The Algolia object. - */ - body: Record; -}; - -export type AssignUserIdProps = { - /** - * UserID to assign. - */ - xAlgoliaUserID: string; - assignUserIdParams: AssignUserIdParams; -}; - -export type BatchProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - batchWriteParams: BatchWriteParams; -}; - -export type BatchAssignUserIdsProps = { - /** - * UserID to assign. - */ - xAlgoliaUserID: string; - batchAssignUserIdsParams: BatchAssignUserIdsParams; -}; - -export type BatchDictionaryEntriesProps = { - /** - * The dictionary to search in. - */ - dictionaryName: 'compounds' | 'plurals' | 'stopwords'; - batchDictionaryEntriesParams: BatchDictionaryEntriesParams; -}; - -export type BatchRulesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - rule: Rule[]; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; - /** - * When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. - */ - clearExistingRules?: boolean; -}; - -export type BrowseProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - browseRequest?: BrowseRequest; -}; - -export type ClearAllSynonymsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type ClearObjectsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type ClearRulesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type DeleteApiKeyProps = { - /** - * API Key string. - */ - key: string; -}; - -export type DeleteByProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - searchParams: SearchParams; -}; - -export type DeleteIndexProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type DeleteObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; -}; - -export type DeleteRuleProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type DeleteSourceProps = { - /** - * The IP range of the source. - */ - source: string; -}; - -export type DeleteSynonymProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type GetApiKeyProps = { - /** - * API Key string. - */ - key: string; -}; - -export type GetLogsProps = { - /** - * First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. - */ - offset?: number; - /** - * Maximum number of entries to retrieve. The maximum allowed value is 1000. - */ - length?: number; - /** - * Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. - */ - indexName?: string; - /** - * Type of log entries to retrieve. When omitted, all log entries are retrieved. - */ - type?: 'all' | 'build' | 'error' | 'query'; -}; - -export type GetObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * List of attributes to retrieve. If not specified, all retrievable attributes are returned. - */ - attributesToRetrieve?: string[]; -}; - -export type GetRuleProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; -}; - -export type GetSettingsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetSynonymProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; -}; - -export type GetTaskProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an task. Numeric value (up to 64bits). - */ - taskID: number; -}; - -export type GetUserIdProps = { - /** - * UserID to assign. - */ - userID: string; -}; - -export type HasPendingMappingsProps = { - /** - * Whether to get clusters or not. - */ - getClusters?: boolean; -}; - -export type ListIndicesProps = { - /** - * Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - page?: number; -}; - -export type ListUserIdsProps = { - /** - * Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - page?: number; - /** - * Maximum number of objects to retrieve. - */ - hitsPerPage?: number; -}; - -export type OperationIndexProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - operationIndexParams: OperationIndexParams; -}; - -export type PartialUpdateObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * List of attributes to update. - */ - stringBuiltInOperation: Array<{ [key: string]: BuiltInOperation | string }>; - /** - * Creates the record if it does not exist yet. - */ - createIfNotExists?: boolean; -}; - -export type RemoveUserIdProps = { - /** - * UserID to assign. - */ - userID: string; -}; - -export type ReplaceSourcesProps = { - /** - * The sources to allow. - */ - source: Source[]; -}; - -export type RestoreApiKeyProps = { - /** - * API Key string. - */ - key: string; -}; - -export type SaveObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * The Algolia record. - */ - body: Record; -}; - -export type SaveRuleProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - rule: Rule; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type SaveSynonymProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - synonymHit: SynonymHit; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type SaveSynonymsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - synonymHit: SynonymHit[]; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; - /** - * Replace all synonyms of the index with the ones sent with this request. - */ - replaceExistingSynonyms?: boolean; -}; - -export type SearchProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - searchParams: SearchParams; -}; - -export type SearchDictionaryEntriesProps = { - /** - * The dictionary to search in. - */ - dictionaryName: 'compounds' | 'plurals' | 'stopwords'; - searchDictionaryEntriesParams: SearchDictionaryEntriesParams; -}; - -export type SearchForFacetValuesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * The facet name. - */ - facetName: string; - searchForFacetValuesRequest?: SearchForFacetValuesRequest; -}; - -export type SearchRulesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - searchRulesParams: SearchRulesParams; -}; - -export type SearchSynonymsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Search for specific synonyms matching this string. - */ - query?: string; - /** - * Only search for specific types of synonyms. - */ - type?: SynonymType; - /** - * Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - page?: number; - /** - * Maximum number of objects to retrieve. - */ - hitsPerPage?: number; -}; - -export type SetSettingsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - indexSettings: IndexSettings; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type UpdateApiKeyProps = { - /** - * API Key string. - */ - key: string; - apiKey: ApiKey; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts deleted file mode 100644 index bcb97284f6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createSourcesApi } from '../src/sourcesApi'; -import type { SourcesApi, Region } from '../src/sourcesApi'; - -export * from '../src/sourcesApi'; - -export function sourcesApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): SourcesApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createSourcesApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts deleted file mode 100644 index ec0d2c7b87..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createSourcesApi } from '../src/sourcesApi'; -import type { SourcesApi, Region } from '../src/sourcesApi'; - -export * from '../src/sourcesApi'; - -export function sourcesApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): SourcesApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createSourcesApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/index.js b/clients/algoliasearch-client-javascript/packages/client-sources/index.js deleted file mode 100644 index 220e589629..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-sources.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts deleted file mode 100644 index 98a0c3c1ba..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Task } from './task'; - -export type PostIngestUrlResponse = { - task: Task; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts deleted file mode 100644 index cb99c27493..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { PostURLJobInput } from './postURLJobInput'; -import type { PostURLJobTarget } from './postURLJobTarget'; - -/** - * Object containing a URL job. - */ -export type PostURLJob = { - /** - * The type of the file to ingest. - */ - type: PostURLJobType; - /** - * The name of the column that hold the unique identifier. - */ - uniqueIDColumn?: string; - input: PostURLJobInput; - target: PostURLJobTarget; -}; - -export type PostURLJobType = 'csv'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts deleted file mode 100644 index b28e166959..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * The authentication scheme for the URL that will be fetched. - */ -export type PostURLJobAuth = { - /** - * The type of authentication to use. - */ - type: PostURLJobAuthType; - /** - * The login to use for Basic Auth. - */ - login: string; - /** - * The password to use for Basic Auth. - */ - password: string; -}; - -export type PostURLJobAuthType = 'basic'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts deleted file mode 100644 index 7a51e0dfc5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { PostURLJobAuth } from './postURLJobAuth'; - -/** - * The input of the job. - */ -export type PostURLJobInput = { - /** - * The URL of the file to ingest. - */ - url: string; - /** - * The HTTP method that will be used to fetch the URL. - */ - method?: PostURLJobInputMethod; - auth?: PostURLJobAuth; -}; - -export type PostURLJobInputMethod = 'GET' | 'POST'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts deleted file mode 100644 index c9a3aae9c9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * The target of the job. - */ -export type PostURLJobTarget = { - /** - * The product to target. - */ - type: PostURLJobTargetType; - /** - * The index name of the product. - */ - indexName: string; - /** - * The type of operation to execute. - */ - operation: PostURLJobTargetOperation; -}; - -export type PostURLJobTargetType = 'search'; - -export type PostURLJobTargetOperation = 'replace'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts deleted file mode 100644 index 8c07b1a8dc..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * A task object. - */ -export type Task = { - /** - * The id of the task. - */ - id: string; - /** - * The type of the task executed. - */ - type: TaskType; -}; - -export type TaskType = 'csv'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/package.json b/clients/algoliasearch-client-javascript/packages/client-sources/package.json deleted file mode 100644 index 8e805ae6d2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-sources", - "version": "0.0.1", - "description": "JavaScript client for @algolia/client-sources", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-sources.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-sources.umd.browser.js", - "unpkg": "dist/client-sources.umd.browser.js", - "browser": "dist/client-sources.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts b/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts deleted file mode 100644 index 2f2b15887f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { PostIngestUrlResponse } from '../model/postIngestUrlResponse'; -import type { PostURLJob } from '../model/postURLJob'; - -export const apiClientVersion = '0.0.1'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region: Region): Host[] { - return [ - { - url: `data.${region}.algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createSourcesApi( - options: CreateClientOptions & { region: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Sources', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Add an ingestion job that will fetch data from an URL. - * - * @summary Create a new ingestion job via URL. - * @param postURLJob - The postURLJob object. - */ - function postIngestUrl( - postURLJob: PostURLJob - ): Promise { - const path = '/1/ingest/url'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!postURLJob) { - throw new Error( - 'Parameter `postURLJob` is required when calling `postIngestUrl`.' - ); - } - - if (!postURLJob.type) { - throw new Error( - 'Parameter `postURLJob.type` is required when calling `postIngestUrl`.' - ); - } - if (!postURLJob.input) { - throw new Error( - 'Parameter `postURLJob.input` is required when calling `postIngestUrl`.' - ); - } - if (!postURLJob.target) { - throw new Error( - 'Parameter `postURLJob.target` is required when calling `postIngestUrl`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: postURLJob, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, postIngestUrl }; -} - -export type SourcesApi = ReturnType; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore deleted file mode 100644 index 29b08dc3a5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore +++ /dev/null @@ -1,9 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -git_push.sh -model/models.ts -.gitignore diff --git a/clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts deleted file mode 100644 index 290c99347f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createRecommendApi } from '../src/recommendApi'; -import type { RecommendApi } from '../src/recommendApi'; - -export * from '../src/recommendApi'; - -export function recommendApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): RecommendApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createRecommendApi({ - appId, - apiKey, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts b/clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts deleted file mode 100644 index c193589bed..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createRecommendApi } from '../src/recommendApi'; -import type { RecommendApi } from '../src/recommendApi'; - -export * from '../src/recommendApi'; - -export function recommendApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): RecommendApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createRecommendApi({ - appId, - apiKey, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/index.d.ts b/clients/algoliasearch-client-javascript/packages/recommend/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/index.js b/clients/algoliasearch-client-javascript/packages/recommend/index.js deleted file mode 100644 index 6ea904117a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/recommend.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts deleted file mode 100644 index 8bf1730be7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts +++ /dev/null @@ -1,130 +0,0 @@ -export type BaseSearchParams = { - /** - * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. - */ - similarQuery?: string; - /** - * Filter the query with numeric, facet and/or tag filters. - */ - filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; - /** - * Determines how to calculate the total score for filtering. - */ - sumOrFiltersScores?: boolean; - /** - * Retrieve facets and their facet values. - */ - facets?: string[]; - /** - * Maximum number of facet values to return for each facet during a regular search. - */ - maxValuesPerFacet?: number; - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - */ - facetingAfterDistinct?: boolean; - /** - * Controls how facet values are fetched. - */ - sortFacetValuesBy?: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Specify the offset of the first hit to return. - */ - offset?: number; - /** - * Set the number of hits to retrieve (used only with offset). - */ - length?: number; - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - */ - aroundLatLng?: string; - /** - * Search for entries around a given location automatically computed from the requester\'s IP address. - */ - aroundLatLngViaIP?: boolean; - /** - * Define the maximum radius for a geo search (in meters). - */ - aroundRadius?: number | string | null; - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - */ - aroundPrecision?: number; - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. - */ - minimumAroundRadius?: number; - /** - * Search inside a rectangular area (in geo coordinates). - */ - insideBoundingBox?: number[]; - /** - * Search inside a polygon (in geo coordinates). - */ - insidePolygon?: number[]; - /** - * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. - */ - naturalLanguages?: string[]; - /** - * Enables contextual rules. - */ - ruleContexts?: string[]; - /** - * Define the impact of the Personalization feature. - */ - personalizationImpact?: number; - /** - * Associates a certain user token with the current search. - */ - userToken?: string; - /** - * Retrieve detailed ranking information. - */ - getRankingInfo?: boolean; - /** - * Enable the Click Analytics feature. - */ - clickAnalytics?: boolean; - /** - * Whether the current query will be taken into account in the Analytics. - */ - analytics?: boolean; - /** - * List of tags to apply to the query for analytics purposes. - */ - analyticsTags?: string[]; - /** - * Whether to include or exclude a query from the processing-time percentile computation. - */ - percentileComputation?: boolean; - /** - * Whether this search should participate in running AB tests. - */ - enableABTest?: boolean; - /** - * Whether this search should use AI Re-Ranking. - */ - enableReRanking?: boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts deleted file mode 100644 index 358556c692..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type { BaseSearchResponseFacetsStats } from './baseSearchResponseFacetsStats'; - -export type BaseSearchResponse = { - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. - */ - abTestID?: number; - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. - */ - abTestVariantID?: number; - /** - * The computed geo location. - */ - aroundLatLng?: string; - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. - */ - automaticRadius?: string; - /** - * Whether the facet count is exhaustive or approximate. - */ - exhaustiveFacetsCount?: boolean; - /** - * Indicate if the nbHits count was exhaustive or approximate. - */ - exhaustiveNbHits: boolean; - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled). - */ - exhaustiveTypo: boolean; - /** - * A mapping of each facet name to the corresponding facet counts. - */ - facets?: { [key: string]: { [key: string]: string } }; - /** - * Statistics for numerical facets. - */ - facets_stats?: { [key: string]: BaseSearchResponseFacetsStats }; - /** - * Set the number of hits per page. - */ - hitsPerPage: number; - /** - * Index name used for the query. - */ - index?: string; - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn\'t always the index used by the query. - */ - indexUsed?: string; - /** - * Used to return warnings about the query. - */ - message?: string; - /** - * Number of hits that the search query matched. - */ - nbHits: number; - /** - * Number of pages available for the current query. - */ - nbPages: number; - /** - * The number of hits selected and sorted by the relevant sort algorithm. - */ - nbSortedHits?: number; - /** - * Specify the page to retrieve. - */ - page: number; - /** - * A url-encoded string of all search parameters. - */ - params: string; - /** - * The query string that will be searched, after normalization. - */ - parsedQuery?: string; - /** - * Time the server took to process the request, in milliseconds. - */ - processingTimeMS: number; - /** - * The text to search in the index. - */ - query: string; - /** - * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. - */ - queryAfterRemoval?: string; - /** - * Actual host name of the server that processed the request. - */ - serverUsed?: string; - /** - * Lets you store custom data in your indices. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts deleted file mode 100644 index 4c4ceb7bc7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type BaseSearchResponseFacetsStats = { - /** - * The minimum value in the result set. - */ - min?: number; - /** - * The maximum value in the result set. - */ - max?: number; - /** - * The average facet value in the result set. - */ - avg?: number; - /** - * The sum of all values in the result set. - */ - sum?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts deleted file mode 100644 index 4eb8d5fb8d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { RecommendationRequest } from './recommendationRequest'; - -/** - * The `getRecommendations` parameters. - */ -export type GetRecommendationsParams = { - /** - * The `getRecommendations` requests. - */ - requests: RecommendationRequest[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts deleted file mode 100644 index 79de43ccff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RecommendationsResponse } from './recommendationsResponse'; - -export type GetRecommendationsResponse = { - results?: RecommendationsResponse[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts deleted file mode 100644 index a878792c6d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Highlighted attributes. - */ -export type HighlightResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: HighlightResultMatchLevel; - /** - * List of words from the query that matched the object. - */ - matchedWords?: string[]; - /** - * Whether the entire attribute value is highlighted. - */ - fullyHighlighted?: boolean; -}; - -export type HighlightResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts deleted file mode 100644 index 00a227aa03..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts +++ /dev/null @@ -1,209 +0,0 @@ -export type IndexSettingsAsSearchParams = { - /** - * The complete list of attributes used for searching. - */ - searchableAttributes?: string[]; - /** - * The complete list of attributes that will be used for faceting. - */ - attributesForFaceting?: string[]; - /** - * List of attributes that can\'t be retrieved at query time. - */ - unretrievableAttributes?: string[]; - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - */ - attributesToRetrieve?: string[]; - /** - * Restricts a given query to look in only a subset of your searchable attributes. - */ - restrictSearchableAttributes?: string[]; - /** - * Controls how Algolia should sort your results. - */ - ranking?: string[]; - /** - * Specifies the custom ranking criterion. - */ - customRanking?: string[]; - /** - * Controls the relevancy threshold below which less relevant results aren\'t included in the results. - */ - relevancyStrictness?: number; - /** - * List of attributes to highlight. - */ - attributesToHighlight?: string[]; - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - */ - attributesToSnippet?: string[]; - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - */ - highlightPreTag?: string; - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - */ - highlightPostTag?: string; - /** - * String used as an ellipsis indicator when a snippet is truncated. - */ - snippetEllipsisText?: string; - /** - * Restrict highlighting and snippeting to items that matched the query. - */ - restrictHighlightAndSnippetArrays?: boolean; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. - */ - minWordSizefor1Typo?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. - */ - minWordSizefor2Typos?: number; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ - typoTolerance?: IndexSettingsAsSearchParamsTypoTolerance; - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - */ - allowTyposOnNumericTokens?: boolean; - /** - * List of attributes on which you want to disable typo tolerance. - */ - disableTypoToleranceOnAttributes?: string[]; - /** - * Control which separators are indexed. - */ - separatorsToIndex?: string; - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - */ - ignorePlurals?: string; - /** - * Removes stop (common) words from the query before executing it. - */ - removeStopWords?: string; - /** - * List of characters that the engine shouldn\'t automatically normalize. - */ - keepDiacriticsOnCharacters?: string; - /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. - */ - queryLanguages?: string[]; - /** - * Splits compound words into their composing atoms in the query. - */ - decompoundQuery?: boolean; - /** - * Whether Rules should be globally enabled. - */ - enableRules?: boolean; - /** - * Enable the Personalization feature. - */ - enablePersonalization?: boolean; - /** - * Controls if and how query words are interpreted as prefixes. - */ - queryType?: IndexSettingsAsSearchParamsQueryType; - /** - * Selects a strategy to remove words from the query when it doesn\'t match any hits. - */ - removeWordsIfNoResults?: IndexSettingsAsSearchParamsRemoveWordsIfNoResults; - /** - * Enables the advanced query syntax. - */ - advancedSyntax?: boolean; - /** - * A list of words that should be considered as optional when found in the query. - */ - optionalWords?: string[]; - /** - * List of attributes on which you want to disable the exact ranking criterion. - */ - disableExactOnAttributes?: string[]; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ - exactOnSingleWordQuery?: IndexSettingsAsSearchParamsExactOnSingleWordQuery; - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - */ - alternativesAsExact?: IndexSettingsAsSearchParamsAlternativesAsExact[]; - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled. - */ - advancedSyntaxFeatures?: IndexSettingsAsSearchParamsAdvancedSyntaxFeatures[]; - /** - * Enables de-duplication or grouping of results. - */ - distinct?: number; - /** - * Whether to take into account an index\'s synonyms for a particular search. - */ - synonyms?: boolean; - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. - */ - replaceSynonymsInHighlight?: boolean; - /** - * Precision of the proximity ranking criterion. - */ - minProximity?: number; - /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. - */ - responseFields?: string[]; - /** - * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. - */ - maxFacetHits?: number; - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. - */ - attributeCriteriaComputedByMinProximity?: boolean; - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - */ - renderingContent?: Record; -}; - -export type IndexSettingsAsSearchParamsTypoTolerance = - | 'false' - | 'min' - | 'strict' - | 'true'; - -export type IndexSettingsAsSearchParamsQueryType = - | 'prefixAll' - | 'prefixLast' - | 'prefixNone'; - -export type IndexSettingsAsSearchParamsRemoveWordsIfNoResults = - | 'allOptional' - | 'firstWords' - | 'lastWords' - | 'none'; - -export type IndexSettingsAsSearchParamsExactOnSingleWordQuery = - | 'attribute' - | 'none' - | 'word'; - -export type IndexSettingsAsSearchParamsAlternativesAsExact = - | 'ignorePlurals' - | 'multiWordsSynonym' - | 'singleWordSynonym'; - -export type IndexSettingsAsSearchParamsAdvancedSyntaxFeatures = - | 'exactPhrase' - | 'excludeWords'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts deleted file mode 100644 index c14a767726..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; - -export type RankingInfo = { - /** - * This field is reserved for advanced usage. - */ - filters?: number; - /** - * Position of the most important matched attribute in the attributes to index list. - */ - firstMatchedWord?: number; - /** - * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). - */ - geoDistance?: number; - /** - * Precision used when computing the geo distance, in meters. - */ - geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; - /** - * Number of exactly matched words. - */ - nbExactWords?: number; - /** - * Number of typos encountered when matching the record. - */ - nbTypos?: number; - /** - * Present and set to true if a Rule promoted the hit. - */ - promoted?: boolean; - /** - * When the query contains more than one word, the sum of the distances between matched words (in meters). - */ - proximityDistance?: number; - /** - * Custom ranking for the object, expressed as a single integer value. - */ - userScore?: number; - /** - * Number of matched words, including prefixes and typos. - */ - word?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts deleted file mode 100644 index bc9ce84718..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type RankingInfoMatchedGeoLocation = { - /** - * Latitude of the matched location. - */ - lat?: number; - /** - * Longitude of the matched location. - */ - lng?: number; - /** - * Distance between the matched location and the search location (in meters). - */ - distance?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts deleted file mode 100644 index 188522c9c5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { HighlightResult } from './highlightResult'; -import type { RankingInfo } from './rankingInfo'; -import type { SnippetResult } from './snippetResult'; - -/** - * A Recommend hit. - */ -export type RecommendHit = { - /** - * Unique identifier of the object. - */ - objectID: string; - _highlightResult?: HighlightResult; - _snippetResult?: SnippetResult; - _rankingInfo?: RankingInfo; - _distinctSeqID?: number; - /** - * The recommendation score. - */ - _score: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts deleted file mode 100644 index e584f40fc0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RecommendHit } from './recommendHit'; - -export type RecommendHits = { - hits?: RecommendHit[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts deleted file mode 100644 index 9faca27372..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { SearchParams } from './searchParams'; - -export type RecommendationRequest = { - /** - * The Algolia index name. - */ - indexName: string; - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * The recommendation model to use. - */ - model: RecommendationRequestModel; - /** - * The threshold to use when filtering recommendations by their score. - */ - threshold: number; - /** - * The max number of recommendations to retrieve. If it\'s set to 0, all the recommendations of the objectID may be returned. - */ - maxRecommendations?: number; - queryParameters?: SearchParams; - fallbackParameters?: SearchParams; -}; - -export type RecommendationRequestModel = 'bought-together' | 'related-products'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts deleted file mode 100644 index 1c6fc9ee21..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseSearchResponse } from './baseSearchResponse'; -import type { RecommendHits } from './recommendHits'; - -export type RecommendationsResponse = BaseSearchResponse & RecommendHits; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts deleted file mode 100644 index 127265c98f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import type { RequiredSearchParams } from './requiredSearchParams'; - -export type SearchParams = BaseSearchParams & - IndexSettingsAsSearchParams & - RequiredSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts deleted file mode 100644 index 0f8d17bc3d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type SnippetResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: SnippetResultMatchLevel; -}; - -export type SnippetResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/package.json b/clients/algoliasearch-client-javascript/packages/recommend/package.json deleted file mode 100644 index 773966aec5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/recommend", - "version": "5.0.0", - "description": "JavaScript client for @algolia/recommend", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/recommend.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/recommend.umd.browser.js", - "unpkg": "dist/recommend.umd.browser.js", - "browser": "dist/recommend.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts b/clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts deleted file mode 100644 index 8d1b336333..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, - shuffle, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { GetRecommendationsParams } from '../model/getRecommendationsParams'; -import type { GetRecommendationsResponse } from '../model/getRecommendationsResponse'; - -export const apiClientVersion = '5.0.0'; - -function getDefaultHosts(appId: string): Host[] { - return ( - [ - { - url: `${appId}-dsn.algolia.net`, - accept: 'read', - protocol: 'https', - }, - { - url: `${appId}.algolia.net`, - accept: 'write', - protocol: 'https', - }, - ] as Host[] - ).concat( - shuffle([ - { - url: `${appId}-1.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-2.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-3.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]) - ); -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createRecommendApi(options: CreateClientOptions) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.appId), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Recommend', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Returns recommendations for a specific model and objectID. - * - * @summary Returns recommendations for a specific model and objectID. - * @param getRecommendationsParams - The getRecommendationsParams object. - */ - function getRecommendations( - getRecommendationsParams: GetRecommendationsParams - ): Promise { - const path = '/1/indexes/*/recommendations'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!getRecommendationsParams) { - throw new Error( - 'Parameter `getRecommendationsParams` is required when calling `getRecommendations`.' - ); - } - - if (!getRecommendationsParams.requests) { - throw new Error( - 'Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: getRecommendationsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, getRecommendations }; -} - -export type RecommendApi = ReturnType; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json b/clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts deleted file mode 100644 index 073e14e3d3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './src/createXhrRequester'; -export * from './src/echoRequester'; diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json deleted file mode 100644 index d9b4584cc5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@algolia/requester-browser-xhr", - "version": "5.0.0", - "description": "Promise-based request library for browser using xhr.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "dist/requester-browser-xhr.cjs.node.js", - "module": "dist/requester-browser-xhr.esm.node.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc", - "clean": "rm -rf dist/" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts deleted file mode 100644 index 3177907444..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { EndRequest, Requester, Response } from '@algolia/client-common'; - -export function createXhrRequester(): Requester { - function send(request: EndRequest): Promise { - return new Promise((resolve) => { - const baseRequester = new XMLHttpRequest(); - baseRequester.open(request.method, request.url, true); - - Object.keys(request.headers).forEach((key) => - baseRequester.setRequestHeader(key, request.headers[key]) - ); - - const createTimeout = ( - timeout: number, - content: string - ): NodeJS.Timeout => { - return setTimeout(() => { - baseRequester.abort(); - - resolve({ - status: 0, - content, - isTimedOut: true, - }); - }, timeout * 1000); - }; - - const connectTimeout = createTimeout( - request.connectTimeout, - 'Connection timeout' - ); - - let responseTimeout: NodeJS.Timeout | undefined; - - baseRequester.onreadystatechange = (): void => { - if ( - baseRequester.readyState > baseRequester.OPENED && - responseTimeout === undefined - ) { - clearTimeout(connectTimeout); - - responseTimeout = createTimeout( - request.responseTimeout, - 'Socket timeout' - ); - } - }; - - baseRequester.onerror = (): void => { - // istanbul ignore next - if (baseRequester.status === 0) { - clearTimeout(connectTimeout); - clearTimeout(responseTimeout as NodeJS.Timeout); - - resolve({ - content: baseRequester.responseText || 'Network request failed', - status: baseRequester.status, - isTimedOut: false, - }); - } - }; - - baseRequester.onload = (): void => { - clearTimeout(connectTimeout); - clearTimeout(responseTimeout as NodeJS.Timeout); - - resolve({ - content: baseRequester.responseText, - status: baseRequester.status, - isTimedOut: false, - }); - }; - - baseRequester.send(request.data); - }); - } - - return { send }; -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts deleted file mode 100644 index e6f91baaff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { createEchoRequester } from '@algolia/client-common'; -import type { UrlParams } from '@algolia/client-common'; - -function getUrlParams(url: string): UrlParams { - const { host, searchParams: urlSearchParams } = new URL(url); - const userAgent = urlSearchParams.get('x-algolia-agent') || ''; - const searchParams = {}; - - for (const [k, v] of urlSearchParams) { - if (k === 'x-algolia-agent') { - continue; - } - - searchParams[k] = v; - } - - return { - host, - userAgent, - searchParams: - Object.entries(searchParams).length === 0 ? undefined : searchParams, - }; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function echoRequester(status: number = 200) { - return createEchoRequester({ getUrlParams, status }); -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json deleted file mode 100644 index e14af78d72..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src", "index.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts b/clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts deleted file mode 100644 index d43eff3c7f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './src/echoRequester'; -export * from './src/createHttpRequester'; diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/package.json b/clients/algoliasearch-client-javascript/packages/requester-node-http/package.json deleted file mode 100644 index 22b62eafa8..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@algolia/requester-node-http", - "version": "5.0.0", - "description": "Promise-based request library for node using the native http module.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "dist/requester-node-http.cjs.node.js", - "module": "dist/requester-node-http.esm.node.js", - "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist/" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts deleted file mode 100644 index fc8b12818b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts +++ /dev/null @@ -1,95 +0,0 @@ -import http from 'http'; -import https from 'https'; -import { URL } from 'url'; - -import type { EndRequest, Requester, Response } from '@algolia/client-common'; - -// Global agents allow us to reuse the TCP protocol with multiple clients -const agentOptions = { keepAlive: true }; -const httpAgent = new http.Agent(agentOptions); -const httpsAgent = new https.Agent(agentOptions); - -export function createHttpRequester(): Requester { - function send(request: EndRequest): Promise { - return new Promise((resolve) => { - let responseTimeout: NodeJS.Timeout | undefined; - // eslint-disable-next-line prefer-const -- linter thinks this is not reassigned - let connectTimeout: NodeJS.Timeout | undefined; - const url = new URL(request.url); - const path = - url.search === null ? url.pathname : `${url.pathname}${url.search}`; - const options: https.RequestOptions = { - agent: url.protocol === 'https:' ? httpsAgent : httpAgent, - hostname: url.hostname, - path, - method: request.method, - headers: request.headers, - ...(url.port !== undefined ? { port: url.port || '' } : {}), - }; - - const req = (url.protocol === 'https:' ? https : http).request( - options, - (response) => { - let contentBuffers: Buffer[] = []; - - response.on('data', (chunk) => { - contentBuffers = contentBuffers.concat(chunk); - }); - - response.on('end', () => { - clearTimeout(connectTimeout as NodeJS.Timeout); - clearTimeout(responseTimeout as NodeJS.Timeout); - - resolve({ - status: response.statusCode || 0, - content: Buffer.concat(contentBuffers).toString(), - isTimedOut: false, - }); - }); - } - ); - - const createTimeout = ( - timeout: number, - content: string - ): NodeJS.Timeout => { - return setTimeout(() => { - req.destroy(); - - resolve({ - status: 0, - content, - isTimedOut: true, - }); - }, timeout * 1000); - }; - - connectTimeout = createTimeout( - request.connectTimeout, - 'Connection timeout' - ); - - req.on('error', (error) => { - clearTimeout(connectTimeout as NodeJS.Timeout); - clearTimeout(responseTimeout!); - resolve({ status: 0, content: error.message, isTimedOut: false }); - }); - - req.once('response', () => { - clearTimeout(connectTimeout as NodeJS.Timeout); - responseTimeout = createTimeout( - request.responseTimeout, - 'Socket timeout' - ); - }); - - if (request.data !== undefined) { - req.write(request.data); - } - - req.end(); - }); - } - - return { send }; -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts deleted file mode 100644 index 34b37584bb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { URL } from 'url'; - -import { createEchoRequester } from '@algolia/client-common'; -import type { UrlParams } from '@algolia/client-common'; - -function getUrlParams(url: string): UrlParams { - const { host, searchParams: urlSearchParams } = new URL(url); - const userAgent = urlSearchParams.get('x-algolia-agent') || ''; - const searchParams = {}; - - for (const [k, v] of urlSearchParams) { - if (k === 'x-algolia-agent') { - continue; - } - - searchParams[k] = v; - } - - return { - host, - userAgent, - searchParams: - Object.entries(searchParams).length === 0 ? undefined : searchParams, - }; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function echoRequester(status: number = 200) { - return createEchoRequester({ getUrlParams, status }); -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json b/clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json deleted file mode 100644 index e14af78d72..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src", "index.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/rollup.config.js b/clients/algoliasearch-client-javascript/rollup.config.js deleted file mode 100644 index c76ceccb03..0000000000 --- a/clients/algoliasearch-client-javascript/rollup.config.js +++ /dev/null @@ -1,249 +0,0 @@ -import path from 'path'; - -import babel from '@rollup/plugin-babel'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import filesize from 'rollup-plugin-filesize'; -import globals from 'rollup-plugin-node-globals'; -import { terser } from 'rollup-plugin-terser'; -import ts from 'rollup-plugin-typescript2'; - -import generatorConfig from '../../openapitools.json'; - -import { version } from './version'; - -// Retrieve package to build -const client = process.env.CLIENT?.replace('@algolia/', ''); -const utils = process.env.UTILS; - -function createLicence(name) { - return `/*! ${name}.umd.js | ${version} | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */`; -} - -function createBundlers({ output, clientPath }) { - return { - 'esm-node': { - file: `${clientPath}/dist/${output}.esm.node.js`, - format: 'es', - }, - 'esm-browser': { - file: `${clientPath}/dist/${output}.esm.browser.js`, - format: 'es', - }, - 'umd-browser': { - file: `${clientPath}/dist/${output}.umd.browser.js`, - format: 'umd', - }, - 'cjs-node': { - file: `${clientPath}/dist/${output}.cjs.node.js`, - format: 'cjs', - }, - 'cjs-browser': { - file: `${clientPath}/dist/${output}.cjs.browser.js`, - format: 'cjs', - }, - }; -} - -function getAvailableClients() { - // We default `algoliasearch` as it's not a generated client, but an aggregation of - // multiple clients. - const availableClients = ['algoliasearch']; - const generators = Object.entries( - generatorConfig['generator-cli'].generators - ); - - for (const [name, options] of generators) { - if (name.startsWith('javascript')) { - availableClients.push(options.additionalProperties.buildFile); - } - } - - return client === 'all' - ? availableClients - : availableClients.filter((availableClient) => availableClient === client); -} - -function initPackagesConfig() { - if (utils) { - const commonOptions = { - input: 'index.ts', - formats: ['cjs-node', 'esm-node'], - external: [], - dependencies: [], - }; - - const availableUtils = [ - // Common - { - ...commonOptions, - output: 'client-common', - package: 'client-common', - name: '@algolia/client-common', - }, - // Browser requester - { - ...commonOptions, - output: 'requester-browser-xhr', - package: 'requester-browser-xhr', - name: '@algolia/requester-browser-xhr', - external: ['dom'], - dependencies: ['@algolia/client-common'], - }, - // Node requester - { - ...commonOptions, - output: 'requester-node-http', - package: 'requester-node-http', - name: '@algolia/requester-node-http', - external: ['https', 'http', 'url'], - dependencies: ['@algolia/client-common'], - }, - ]; - - return utils === 'all' - ? availableUtils - : availableUtils.filter( - (availableUtil) => availableUtil.package === utils - ); - } - - const availableClients = getAvailableClients(); - - if (availableClients.length === 0) { - throw new Error(`No clients matching ${client}.`); - } - - return availableClients.flatMap((packageName) => { - const isAlgoliasearchClient = packageName.startsWith('algoliasearch'); - const commonConfig = { - package: packageName, - name: isAlgoliasearchClient ? packageName : `@algolia/${packageName}`, - output: packageName, - dependencies: isAlgoliasearchClient - ? [ - '@algolia/client-analytics', - '@algolia/client-common', - '@algolia/client-personalization', - '@algolia/client-search', - ] - : ['@algolia/client-common'], - external: [], - }; - const browserFormats = ['umd-browser', 'esm-browser', 'cjs-browser']; - const nodeFormats = ['cjs-node', 'esm-node']; - - return [ - { - ...commonConfig, - input: 'builds/browser.ts', - formats: browserFormats, - external: ['dom'], - dependencies: [ - ...commonConfig.dependencies, - '@algolia/requester-browser-xhr', - ], - globals: { - [packageName]: packageName, - }, - }, - { - ...commonConfig, - input: 'builds/node.ts', - dependencies: [ - ...commonConfig.dependencies, - '@algolia/requester-node-http', - ], - formats: nodeFormats, - }, - ]; - }); -} - -const packagesConfig = initPackagesConfig(); -const rollupConfig = []; - -packagesConfig.forEach((packageConfig) => { - const clientPath = path.resolve('packages', packageConfig.package); - const bundlers = createBundlers({ - output: packageConfig.output, - clientPath, - }); - - packageConfig.formats.forEach((format) => { - // Avoid generating types multiple times. - let isTypesGenerated = false; - const output = bundlers[format]; - const isUmdBuild = format === 'umd-browser'; - const isEsmBrowserBuild = format === 'esm-browser'; - - if (isUmdBuild) { - output.name = packageConfig.name; - output.banner = createLicence(packageConfig.package); - } - - const compressorPlugins = isUmdBuild ? [terser()] : []; - const transpilerPlugins = isUmdBuild - ? [ - babel({ - babelrc: false, - babelHelpers: 'runtime', - extensions: ['.ts'], - exclude: 'node_modules/**', - presets: [ - [ - '@babel/preset-env', - { - targets: { - browsers: ['> .5%', 'ie >= 11'], - }, - }, - ], - ], - plugins: ['@babel/plugin-transform-runtime'], - }), - ] - : []; - - if (isUmdBuild || isEsmBrowserBuild) { - // eslint-disable-next-line no-param-reassign - packageConfig.dependencies = []; - } - - rollupConfig.push({ - input: path.resolve(clientPath, packageConfig.input), - external: [...packageConfig.dependencies, ...packageConfig.external], - plugins: [ - globals({ - global: true, - }), - nodeResolve(), - ts({ - check: !isTypesGenerated, - tsconfig: path.resolve(clientPath, 'tsconfig.json'), - tsconfigOverride: { - compilerOptions: { - declaration: !isTypesGenerated, - declarationMap: !isTypesGenerated, - }, - }, - }), - ...transpilerPlugins, - ...compressorPlugins, - filesize({ - showMinifiedSize: false, - showGzippedSize: true, - }), - ], - output, - onwarn(msg, warn) { - if (!/Circular/.test(msg)) { - warn(msg); - } - }, - }); - - isTypesGenerated = true; - }); -}); - -export default rollupConfig; diff --git a/clients/algoliasearch-client-javascript/tsconfig.json b/clients/algoliasearch-client-javascript/tsconfig.json deleted file mode 100644 index 08473f19f4..0000000000 --- a/clients/algoliasearch-client-javascript/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "allowJs": false, - "allowSyntheticDefaultImports": true, - "declaration": true, - "esModuleInterop": true, - "lib": ["dom", "esnext", "dom.iterable", "scripthost"], - "module": "esnext", - "moduleResolution": "node", - "noImplicitAny": false, - "noImplicitThis": true, - "noLib": false, - "noUnusedLocals": true, - "outDir": "dist", - "removeComments": true, - "sourceMap": true, - "strict": true, - "suppressImplicitAnyIndexErrors": true, - "target": "esnext", - "typeRoots": ["node_modules/@types"], - "types": ["node"] - }, - "include": ["packages/**/*.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/version.js b/clients/algoliasearch-client-javascript/version.js deleted file mode 100644 index 56b7f45436..0000000000 --- a/clients/algoliasearch-client-javascript/version.js +++ /dev/null @@ -1 +0,0 @@ -export const version = '5.0.0'; diff --git a/clients/algoliasearch-client-php/.gitignore b/clients/algoliasearch-client-php/.gitignore deleted file mode 100644 index aa44c17b5e..0000000000 --- a/clients/algoliasearch-client-php/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore - -composer.phar -/vendor/ - -# php-cs-fixer cache -.php_cs.cache - -# PHPUnit cache -.phpunit.result.cache - -.openapi-generator/ -composer.lock diff --git a/clients/algoliasearch-client-php/.openapi-generator-ignore b/clients/algoliasearch-client-php/.openapi-generator-ignore deleted file mode 100644 index afab6b370b..0000000000 --- a/clients/algoliasearch-client-php/.openapi-generator-ignore +++ /dev/null @@ -1,17 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -docs/** -test/** -lib/Model/** -lib/Model/ - -.travis.yml -README.md -git_push.sh -.php_cs - -lib/HeaderSelector.php diff --git a/clients/algoliasearch-client-php/.php-cs-fixer.php b/clients/algoliasearch-client-php/.php-cs-fixer.php deleted file mode 100644 index 90c95dcf68..0000000000 --- a/clients/algoliasearch-client-php/.php-cs-fixer.php +++ /dev/null @@ -1,63 +0,0 @@ -setUsingCache(true) - ->setRules([ - 'array_syntax' => [ 'syntax' => 'short' ], - 'blank_line_after_namespace' => false, - 'blank_line_after_opening_tag' => true, - 'blank_line_before_statement' => true, - 'braces' => false, - 'cast_spaces' => true, - 'combine_consecutive_unsets' => true, - 'echo_tag_syntax' => true, - 'general_phpdoc_tag_rename' => true, - 'mb_str_functions' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => true, - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_short_bool_cast' => true, - 'no_trailing_whitespace' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unreachable_default_argument_value' => true, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'normalize_index_brace' => true, - 'not_operator_with_space' => false, - 'object_operator_without_whitespace' => true, - 'ordered_imports' => true, - 'phpdoc_annotation_without_dot' => true, - 'phpdoc_inline_tag_normalizer' => true, - 'phpdoc_order' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_tag_type' => true, - 'protected_to_private' => true, - '@PSR2' => true, - 'short_scalar_cast' => true, - 'single_blank_line_at_eof' => false, - 'single_blank_line_before_namespace' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'strict_comparison' => true, - 'strict_param' => true, - 'ternary_operator_spaces' => true, - 'trailing_comma_in_multiline' => true, - 'trim_array_spaces' => true, - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->exclude('test') - ->exclude('tests') - ->in(__DIR__) - ); diff --git a/clients/algoliasearch-client-php/composer.json b/clients/algoliasearch-client-php/composer.json deleted file mode 100644 index 2b05cd1e41..0000000000 --- a/clients/algoliasearch-client-php/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "algolia/algoliasearch-client-php", - "description": "API powering the features of Algolia.", - "keywords": [ - "openapitools", - "openapi-generator", - "openapi", - "php", - "sdk", - "rest", - "api" - ], - "homepage": "https://openapi-generator.tech", - "license": "unlicense", - "authors": [ - { - "name": "OpenAPI-Generator contributors", - "homepage": "https://openapi-generator.tech" - } - ], - "require": { - "php": "^7.3 || ^8.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^7.3", - "guzzlehttp/psr7": "^2.0", - "psr/http-message": "^1.0", - "psr/log": "^1.0 || ^2.0 || ^3.0", - "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.5.0", - "phpunit/phpunit": "^9.3" - }, - "autoload": { - "psr-4": { "Algolia\\AlgoliaSearch\\" : "lib/" }, - "files": [ - "lib/Http/Psr7/functions.php" - ] - }, - "autoload-dev": { - "psr-4": { "Algolia\\AlgoliaSearch\\Test\\" : "test/" } - } -} diff --git a/clients/algoliasearch-client-php/lib/Algolia.php b/clients/algoliasearch-client-php/lib/Algolia.php deleted file mode 100644 index c9aede0df0..0000000000 --- a/clients/algoliasearch-client-php/lib/Algolia.php +++ /dev/null @@ -1,105 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials and region - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - * @param string $region Region - */ - public static function create($appId = null, $apiKey = null, $region = null) - { - $allowedRegions = explode('-', 'us-de'); - $config = AbTestingConfig::create($appId, $apiKey, $region, $allowedRegions); - - return static::createWithConfig($config); - } - - /** - * Instantiate the client with congiguration - * - * @param AbTestingConfig $config Configuration - */ - public static function createWithConfig(AbTestingConfig $config) - { - $config = clone $config; - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } else { - $clusterHosts = ClusterHosts::create('analytics.'.$config->getRegion().'.algolia.com'); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return AbTestingConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Creates a new A/B test with provided configuration. - * - * @param array $addABTestsRequest addABTestsRequest (required) - * - * @return array - */ - public function addABTests($addABTestsRequest) - { - // verify the required parameter 'addABTestsRequest' is set - if ($addABTestsRequest === null || (is_array($addABTestsRequest) && count($addABTestsRequest) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $addABTestsRequest when calling addABTests' - ); - } - - $resourcePath = '/2/abtests'; - $queryParams = []; - $httpBody = []; - - if (isset($addABTestsRequest)) { - $httpBody = $addABTestsRequest; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Deletes the A/B Test. - * - * @param int $id The A/B test ID. (required) - * - * @return array - */ - public function deleteABTest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteABTest' - ); - } - - $resourcePath = '/2/abtests/{id}'; - $queryParams = []; - $httpBody = []; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns metadata and metrics for A/B test id. - * - * @param int $id The A/B test ID. (required) - * - * @return array - */ - public function getABTest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getABTest' - ); - } - - $resourcePath = '/2/abtests/{id}'; - $queryParams = []; - $httpBody = []; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Fetch all existing A/B tests for App that are available for the current API Key. - * - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * - * @return array - */ - public function listABTests($offset = 0, $limit = 10) - { - $resourcePath = '/2/abtests'; - $queryParams = []; - $httpBody = []; - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Marks the A/B test as stopped. - * - * @param int $id The A/B test ID. (required) - * - * @return array - */ - public function stopABTest($id) - { - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling stopABTest' - ); - } - - $resourcePath = '/2/abtests/{id}/stop'; - $queryParams = []; - $httpBody = []; - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php b/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php deleted file mode 100644 index 34f47931aa..0000000000 --- a/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php +++ /dev/null @@ -1,1588 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials and region - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - * @param string $region Region - */ - public static function create($appId = null, $apiKey = null, $region = null) - { - $allowedRegions = explode('-', 'us-de'); - $config = AnalyticsConfig::create($appId, $apiKey, $region, $allowedRegions); - - return static::createWithConfig($config); - } - - /** - * Instantiate the client with congiguration - * - * @param AnalyticsConfig $config Configuration - */ - public static function createWithConfig(AnalyticsConfig $config) - { - $config = clone $config; - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } else { - $clusterHosts = ClusterHosts::create('analytics.'.$config->getRegion().'.algolia.com'); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return AnalyticsConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Returns the average click position. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getAverageClickPosition($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getAverageClickPosition' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getAverageClickPosition, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getAverageClickPosition, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/clicks/averageClickPosition'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns the distribution of clicks per range of positions. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getClickPositions($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getClickPositions' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getClickPositions, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getClickPositions, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/clicks/positions'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns a click-through rate (CTR). - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getClickThroughRate($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getClickThroughRate' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getClickThroughRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getClickThroughRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/clicks/clickThroughRate'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns a conversion rate (CR). - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getConversationRate($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getConversationRate' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getConversationRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getConversationRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/conversions/conversionRate'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns the rate at which searches didn't lead to any clicks. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getNoClickRate($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getNoClickRate' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getNoClickRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getNoClickRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/searches/noClickRate'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns the rate at which searches didn't return any results. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getNoResultsRate($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getNoResultsRate' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getNoResultsRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getNoResultsRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/searches/noResultRate'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns the number of searches across the given time range. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getSearchesCount($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getSearchesCount' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getSearchesCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getSearchesCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/searches/count'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top searches that didn't lead to any clicks. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getSearchesNoClicks($index, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getSearchesNoClicks' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getSearchesNoClicks, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getSearchesNoClicks, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/searches/noClicks'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top searches that didn't return any results. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getSearchesNoResults($index, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getSearchesNoResults' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getSearchesNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getSearchesNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/searches/noResults'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get latest update time of the analytics API. - * - * @param string $index The index name to target. (required) - * - * @return array - */ - public function getStatus($index) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getStatus' - ); - } - - $resourcePath = '/2/status'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top countries. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getTopCountries($index, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getTopCountries' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopCountries, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopCountries, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/countries'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top filter attributes. - * - * @param string $index The index name to target. (required) - * @param string $search The query term to search for. Must match the exact user input. (optional) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getTopFilterAttributes($index, $search = null, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getTopFilterAttributes' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopFilterAttributes, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopFilterAttributes, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/filters'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($search !== null) { - if ('form' === 'form' && is_array($search)) { - foreach ($search as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['search'] = $search; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top filters for the given attribute. - * - * @param string $attribute The exact name of the attribute. (required) - * @param string $index The index name to target. (required) - * @param string $search The query term to search for. Must match the exact user input. (optional) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getTopFilterForAttribute($attribute, $index, $search = null, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'attribute' is set - if ($attribute === null || (is_array($attribute) && count($attribute) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $attribute when calling getTopFilterForAttribute' - ); - } - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getTopFilterForAttribute' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopFilterForAttribute, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopFilterForAttribute, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/filters/{attribute}'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($search !== null) { - if ('form' === 'form' && is_array($search)) { - foreach ($search as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['search'] = $search; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - // path params - if ($attribute !== null) { - $resourcePath = str_replace( - '{' . 'attribute' . '}', - ObjectSerializer::toPathValue($attribute), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top filters with no results. - * - * @param string $index The index name to target. (required) - * @param string $search The query term to search for. Must match the exact user input. (optional) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getTopFiltersNoResults($index, $search = null, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getTopFiltersNoResults' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopFiltersNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopFiltersNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/filters/noResults'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($search !== null) { - if ('form' === 'form' && is_array($search)) { - foreach ($search as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['search'] = $search; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top hits. - * - * @param string $index The index name to target. (required) - * @param string $search The query term to search for. Must match the exact user input. (optional) - * @param array $clickAnalytics Whether to include the click-through and conversion rates for a search. (optional, default to false) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getTopHits($index, $search = null, $clickAnalytics = false, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getTopHits' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopHits, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopHits, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/hits'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($search !== null) { - if ('form' === 'form' && is_array($search)) { - foreach ($search as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['search'] = $search; - } - } - - if ($clickAnalytics !== null) { - if ('form' === 'form' && is_array($clickAnalytics)) { - foreach ($clickAnalytics as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['clickAnalytics'] = $clickAnalytics; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns top searches. - * - * @param string $index The index name to target. (required) - * @param array $clickAnalytics Whether to include the click-through and conversion rates for a search. (optional, default to false) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $orderBy Reorder the results. (optional, default to 'searchCount') - * @param string $direction The sorting of the result. (optional, default to 'asc') - * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) - * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getTopSearches($index, $clickAnalytics = false, $startDate = null, $endDate = null, $orderBy = 'searchCount', $direction = 'asc', $limit = 10, $offset = 0, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getTopSearches' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopSearches, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopSearches, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/searches'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($clickAnalytics !== null) { - if ('form' === 'form' && is_array($clickAnalytics)) { - foreach ($clickAnalytics as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['clickAnalytics'] = $clickAnalytics; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($orderBy !== null) { - if ('form' === 'form' && is_array($orderBy)) { - foreach ($orderBy as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['orderBy'] = $orderBy; - } - } - - if ($direction !== null) { - if ('form' === 'form' && is_array($direction)) { - foreach ($direction as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['direction'] = $direction; - } - } - - if ($limit !== null) { - if ('form' === 'form' && is_array($limit)) { - foreach ($limit as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['limit'] = $limit; - } - } - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Returns the distinct count of users across the given time range. - * - * @param string $index The index name to target. (required) - * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) - * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) - * - * @return array - */ - public function getUsersCount($index, $startDate = null, $endDate = null, $tags = null) - { - // verify the required parameter 'index' is set - if ($index === null || (is_array($index) && count($index) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $index when calling getUsersCount' - ); - } - if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { - throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getUsersCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { - throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getUsersCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); - } - - $resourcePath = '/2/users/count'; - $queryParams = []; - $httpBody = []; - - if ($index !== null) { - if ('form' === 'form' && is_array($index)) { - foreach ($index as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['index'] = $index; - } - } - - if ($startDate !== null) { - if ('form' === 'form' && is_array($startDate)) { - foreach ($startDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['startDate'] = $startDate; - } - } - - if ($endDate !== null) { - if ('form' === 'form' && is_array($endDate)) { - foreach ($endDate as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['endDate'] = $endDate; - } - } - - if ($tags !== null) { - if ('form' === 'form' && is_array($tags)) { - foreach ($tags as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['tags'] = $tags; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Api/InsightsApi.php b/clients/algoliasearch-client-php/lib/Api/InsightsApi.php deleted file mode 100644 index b58c61bd54..0000000000 --- a/clients/algoliasearch-client-php/lib/Api/InsightsApi.php +++ /dev/null @@ -1,134 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials and region - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - * @param string $region Region - */ - public static function create($appId = null, $apiKey = null, $region = null) - { - $allowedRegions = explode('-', 'us-de'); - $config = InsightsConfig::create($appId, $apiKey, $region, $allowedRegions); - - return static::createWithConfig($config); - } - - /** - * Instantiate the client with congiguration - * - * @param InsightsConfig $config Configuration - */ - public static function createWithConfig(InsightsConfig $config) - { - $config = clone $config; - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } else { - $clusterHosts = ClusterHosts::create('insights.'.$config->getRegion().'.algolia.io'); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return InsightsConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Pushes an array of events. - * - * @param array $insightEvents insightEvents (required) - * - * @return array - */ - public function pushEvents($insightEvents) - { - // verify the required parameter 'insightEvents' is set - if ($insightEvents === null || (is_array($insightEvents) && count($insightEvents) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $insightEvents when calling pushEvents' - ); - } - - $resourcePath = '/1/events'; - $queryParams = []; - $httpBody = []; - - if (isset($insightEvents)) { - $httpBody = $insightEvents; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php b/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php deleted file mode 100644 index 55712ad1bb..0000000000 --- a/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php +++ /dev/null @@ -1,212 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials and region - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - * @param string $region Region - */ - public static function create($appId = null, $apiKey = null, $region = null) - { - $allowedRegions = explode('-', 'us-eu'); - $config = PersonalizationConfig::create($appId, $apiKey, $region, $allowedRegions); - - return static::createWithConfig($config); - } - - /** - * Instantiate the client with congiguration - * - * @param PersonalizationConfig $config Configuration - */ - public static function createWithConfig(PersonalizationConfig $config) - { - $config = clone $config; - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } else { - $clusterHosts = ClusterHosts::create('personalization.'.$config->getRegion().'.algolia.com'); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return PersonalizationConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Delete the user profile and all its associated data. - * - * @param string $userToken userToken representing the user for which to fetch the Personalization profile. (required) - * - * @return array - */ - public function deleteUserProfile($userToken) - { - // verify the required parameter 'userToken' is set - if ($userToken === null || (is_array($userToken) && count($userToken) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $userToken when calling deleteUserProfile' - ); - } - - $resourcePath = '/1/profiles/{userToken}'; - $queryParams = []; - $httpBody = []; - // path params - if ($userToken !== null) { - $resourcePath = str_replace( - '{' . 'userToken' . '}', - ObjectSerializer::toPathValue($userToken), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get the current personalization strategy. - * - * - * @return array - */ - public function getPersonalizationStrategy() - { - $resourcePath = '/1/strategies/personalization'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get the user profile built from Personalization strategy. - * - * @param string $userToken userToken representing the user for which to fetch the Personalization profile. (required) - * - * @return array - */ - public function getUserTokenProfile($userToken) - { - // verify the required parameter 'userToken' is set - if ($userToken === null || (is_array($userToken) && count($userToken) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $userToken when calling getUserTokenProfile' - ); - } - - $resourcePath = '/1/profiles/personalization/{userToken}'; - $queryParams = []; - $httpBody = []; - // path params - if ($userToken !== null) { - $resourcePath = str_replace( - '{' . 'userToken' . '}', - ObjectSerializer::toPathValue($userToken), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Set a new personalization strategy. - * - * @param array $personalizationStrategyParams personalizationStrategyParams (required) - * - * @return array - */ - public function setPersonalizationStrategy($personalizationStrategyParams) - { - // verify the required parameter 'personalizationStrategyParams' is set - if ($personalizationStrategyParams === null || (is_array($personalizationStrategyParams) && count($personalizationStrategyParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $personalizationStrategyParams when calling setPersonalizationStrategy' - ); - } - - $resourcePath = '/1/strategies/personalization'; - $queryParams = []; - $httpBody = []; - - if (isset($personalizationStrategyParams)) { - $httpBody = $personalizationStrategyParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php deleted file mode 100644 index 79e81c1d70..0000000000 --- a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php +++ /dev/null @@ -1,316 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials and region - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - * @param string $region Region - */ - public static function create($appId = null, $apiKey = null, $region = null) - { - $allowedRegions = explode('-', 'us-eu'); - $config = QuerySuggestionsConfig::create($appId, $apiKey, $region, $allowedRegions); - - return static::createWithConfig($config); - } - - /** - * Instantiate the client with congiguration - * - * @param QuerySuggestionsConfig $config Configuration - */ - public static function createWithConfig(QuerySuggestionsConfig $config) - { - $config = clone $config; - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } else { - $clusterHosts = ClusterHosts::create('query-suggestions.'.$config->getRegion().'.algolia.com'); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return QuerySuggestionsConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Create a configuration of a Query Suggestions index. - * - * @param array $querySuggestionsIndexWithIndexParam querySuggestionsIndexWithIndexParam (required) - * - * @return array - */ - public function createConfig($querySuggestionsIndexWithIndexParam) - { - // verify the required parameter 'querySuggestionsIndexWithIndexParam' is set - if ($querySuggestionsIndexWithIndexParam === null || (is_array($querySuggestionsIndexWithIndexParam) && count($querySuggestionsIndexWithIndexParam) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $querySuggestionsIndexWithIndexParam when calling createConfig' - ); - } - - $resourcePath = '/1/configs'; - $queryParams = []; - $httpBody = []; - - if (isset($querySuggestionsIndexWithIndexParam)) { - $httpBody = $querySuggestionsIndexWithIndexParam; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete a configuration of a Query Suggestion's index. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function deleteConfig($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling deleteConfig' - ); - } - - $resourcePath = '/1/configs/{indexName}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get all the configurations of Query Suggestions. - * - * - * @return array - */ - public function getAllConfigs() - { - $resourcePath = '/1/configs'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get the configuration of a single Query Suggestions index. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function getConfig($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getConfig' - ); - } - - $resourcePath = '/1/configs/{indexName}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get the status of a Query Suggestion's index. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function getConfigStatus($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getConfigStatus' - ); - } - - $resourcePath = '/1/configs/{indexName}/status'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get the log file of the last build of a single Query Suggestion index. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function getLogFile($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getLogFile' - ); - } - - $resourcePath = '/1/logs/{indexName}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Update the configuration of a Query Suggestions index. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $querySuggestionsIndexParam querySuggestionsIndexParam (required) - * - * @return array - */ - public function updateConfig($indexName, $querySuggestionsIndexParam) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling updateConfig' - ); - } - // verify the required parameter 'querySuggestionsIndexParam' is set - if ($querySuggestionsIndexParam === null || (is_array($querySuggestionsIndexParam) && count($querySuggestionsIndexParam) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $querySuggestionsIndexParam when calling updateConfig' - ); - } - - $resourcePath = '/1/configs/{indexName}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($querySuggestionsIndexParam)) { - $httpBody = $querySuggestionsIndexParam; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Api/RecommendApi.php b/clients/algoliasearch-client-php/lib/Api/RecommendApi.php deleted file mode 100644 index 0297bbbaf8..0000000000 --- a/clients/algoliasearch-client-php/lib/Api/RecommendApi.php +++ /dev/null @@ -1,135 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - */ - public static function create($appId = null, $apiKey = null) - { - return static::createWithConfig(RecommendConfig::create($appId, $apiKey)); - } - - /** - * Instantiate the client with congiguration - * - * @param RecommendConfig $config Configuration - */ - public static function createWithConfig(RecommendConfig $config) - { - $config = clone $config; - - $cacheKey = sprintf('%s-clusterHosts-%s', __CLASS__, $config->getAppId()); - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } elseif (false === ($clusterHosts = ClusterHosts::createFromCache($cacheKey))) { - // We'll try to restore the ClusterHost from cache, if we cannot - // we create a new instance and set the cache key - $clusterHosts = ClusterHosts::createFromAppId($config->getAppId()) - ->setCacheKey($cacheKey); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return RecommendConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Returns recommendations for a specific model and objectID. - * - * @param array $getRecommendationsParams getRecommendationsParams (required) - * - * @return array - */ - public function getRecommendations($getRecommendationsParams) - { - // verify the required parameter 'getRecommendationsParams' is set - if ($getRecommendationsParams === null || (is_array($getRecommendationsParams) && count($getRecommendationsParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $getRecommendationsParams when calling getRecommendations' - ); - } - - $resourcePath = '/1/indexes/*/recommendations'; - $queryParams = []; - $httpBody = []; - - if (isset($getRecommendationsParams)) { - $httpBody = $getRecommendationsParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Api/SearchApi.php b/clients/algoliasearch-client-php/lib/Api/SearchApi.php deleted file mode 100644 index 4049e0dbef..0000000000 --- a/clients/algoliasearch-client-php/lib/Api/SearchApi.php +++ /dev/null @@ -1,2369 +0,0 @@ -config = $config; - - $this->api = $apiWrapper; - } - - /** - * Instantiate the client with basic credentials - * - * @param string $appId Application ID - * @param string $apiKey Algolia API Key - */ - public static function create($appId = null, $apiKey = null) - { - return static::createWithConfig(SearchConfig::create($appId, $apiKey)); - } - - /** - * Instantiate the client with congiguration - * - * @param SearchConfig $config Configuration - */ - public static function createWithConfig(SearchConfig $config) - { - $config = clone $config; - - $cacheKey = sprintf('%s-clusterHosts-%s', __CLASS__, $config->getAppId()); - - if ($hosts = $config->getHosts()) { - // If a list of hosts was passed, we ignore the cache - $clusterHosts = ClusterHosts::create($hosts); - } elseif (false === ($clusterHosts = ClusterHosts::createFromCache($cacheKey))) { - // We'll try to restore the ClusterHost from cache, if we cannot - // we create a new instance and set the cache key - $clusterHosts = ClusterHosts::createFromAppId($config->getAppId()) - ->setCacheKey($cacheKey); - } - - $apiWrapper = new ApiWrapper( - Algolia::getHttpClient(), - $config, - $clusterHosts - ); - - return new static($apiWrapper, $config); - } - - /** - * @return SearchConfig - */ - public function getClientConfig() - { - return $this->config; - } - - /** - * Create a new API key. - * - * @param array $apiKey apiKey (required) - * - * @return array - */ - public function addApiKey($apiKey) - { - // verify the required parameter 'apiKey' is set - if ($apiKey === null || (is_array($apiKey) && count($apiKey) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $apiKey when calling addApiKey' - ); - } - - $resourcePath = '/1/keys'; - $queryParams = []; - $httpBody = []; - - if (isset($apiKey)) { - $httpBody = $apiKey; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Add or replace an object with a given object ID. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $body The Algolia object. (required) - * - * @return array - */ - public function addOrUpdateObject($indexName, $objectID, $body) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling addOrUpdateObject' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling addOrUpdateObject' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling addOrUpdateObject' - ); - } - - $resourcePath = '/1/indexes/{indexName}/{objectID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - if (isset($body)) { - $httpBody = $body; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - /** - * Add a single source. - * - * @param array $source The source to add. (required) - * - * @return array - */ - public function appendSource($source) - { - // verify the required parameter 'source' is set - if ($source === null || (is_array($source) && count($source) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $source when calling appendSource' - ); - } - - $resourcePath = '/1/security/sources/append'; - $queryParams = []; - $httpBody = []; - - if (isset($source)) { - $httpBody = $source; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Assign or Move userID - * - * @param string $xAlgoliaUserID userID to assign. (required) - * @param array $assignUserIdParams assignUserIdParams (required) - * - * @return array - */ - public function assignUserId($xAlgoliaUserID, $assignUserIdParams) - { - // verify the required parameter 'xAlgoliaUserID' is set - if ($xAlgoliaUserID === null || (is_array($xAlgoliaUserID) && count($xAlgoliaUserID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $xAlgoliaUserID when calling assignUserId' - ); - } - if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $xAlgoliaUserID)) { - throw new \InvalidArgumentException('invalid value for "xAlgoliaUserID" when calling SearchApi.assignUserId, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); - } - - // verify the required parameter 'assignUserIdParams' is set - if ($assignUserIdParams === null || (is_array($assignUserIdParams) && count($assignUserIdParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $assignUserIdParams when calling assignUserId' - ); - } - - $resourcePath = '/1/clusters/mapping'; - $queryParams = []; - $httpBody = []; - - if ($xAlgoliaUserID !== null) { - if ('form' === 'form' && is_array($xAlgoliaUserID)) { - foreach ($xAlgoliaUserID as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['X-Algolia-User-ID'] = $xAlgoliaUserID; - } - } - - if (isset($assignUserIdParams)) { - $httpBody = $assignUserIdParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Performs multiple write operations in a single API call. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $batchWriteParams batchWriteParams (required) - * - * @return array - */ - public function batch($indexName, $batchWriteParams) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling batch' - ); - } - // verify the required parameter 'batchWriteParams' is set - if ($batchWriteParams === null || (is_array($batchWriteParams) && count($batchWriteParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batchWriteParams when calling batch' - ); - } - - $resourcePath = '/1/indexes/{indexName}/batch'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($batchWriteParams)) { - $httpBody = $batchWriteParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Batch assign userIDs - * - * @param string $xAlgoliaUserID userID to assign. (required) - * @param array $batchAssignUserIdsParams batchAssignUserIdsParams (required) - * - * @return array - */ - public function batchAssignUserIds($xAlgoliaUserID, $batchAssignUserIdsParams) - { - // verify the required parameter 'xAlgoliaUserID' is set - if ($xAlgoliaUserID === null || (is_array($xAlgoliaUserID) && count($xAlgoliaUserID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $xAlgoliaUserID when calling batchAssignUserIds' - ); - } - if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $xAlgoliaUserID)) { - throw new \InvalidArgumentException('invalid value for "xAlgoliaUserID" when calling SearchApi.batchAssignUserIds, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); - } - - // verify the required parameter 'batchAssignUserIdsParams' is set - if ($batchAssignUserIdsParams === null || (is_array($batchAssignUserIdsParams) && count($batchAssignUserIdsParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batchAssignUserIdsParams when calling batchAssignUserIds' - ); - } - - $resourcePath = '/1/clusters/mapping/batch'; - $queryParams = []; - $httpBody = []; - - if ($xAlgoliaUserID !== null) { - if ('form' === 'form' && is_array($xAlgoliaUserID)) { - foreach ($xAlgoliaUserID as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['X-Algolia-User-ID'] = $xAlgoliaUserID; - } - } - - if (isset($batchAssignUserIdsParams)) { - $httpBody = $batchAssignUserIdsParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Send a batch of dictionary entries. - * - * @param string $dictionaryName The dictionary to search in. (required) - * @param array $batchDictionaryEntriesParams batchDictionaryEntriesParams (required) - * - * @return array - */ - public function batchDictionaryEntries($dictionaryName, $batchDictionaryEntriesParams) - { - // verify the required parameter 'dictionaryName' is set - if ($dictionaryName === null || (is_array($dictionaryName) && count($dictionaryName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dictionaryName when calling batchDictionaryEntries' - ); - } - // verify the required parameter 'batchDictionaryEntriesParams' is set - if ($batchDictionaryEntriesParams === null || (is_array($batchDictionaryEntriesParams) && count($batchDictionaryEntriesParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batchDictionaryEntriesParams when calling batchDictionaryEntries' - ); - } - - $resourcePath = '/1/dictionaries/{dictionaryName}/batch'; - $queryParams = []; - $httpBody = []; - // path params - if ($dictionaryName !== null) { - $resourcePath = str_replace( - '{' . 'dictionaryName' . '}', - ObjectSerializer::toPathValue($dictionaryName), - $resourcePath - ); - } - - if (isset($batchDictionaryEntriesParams)) { - $httpBody = $batchDictionaryEntriesParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Batch Rules. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $rule rule (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * @param array $clearExistingRules When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. (optional) - * - * @return array - */ - public function batchRules($indexName, $rule, $forwardToReplicas = null, $clearExistingRules = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling batchRules' - ); - } - // verify the required parameter 'rule' is set - if ($rule === null || (is_array($rule) && count($rule) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $rule when calling batchRules' - ); - } - - $resourcePath = '/1/indexes/{indexName}/rules/batch'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - - if ($clearExistingRules !== null) { - if ('form' === 'form' && is_array($clearExistingRules)) { - foreach ($clearExistingRules as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['clearExistingRules'] = $clearExistingRules; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($rule)) { - $httpBody = $rule; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Retrieve all index content. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $browseRequest browseRequest (optional) - * - * @return array - */ - public function browse($indexName, $browseRequest = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling browse' - ); - } - - $resourcePath = '/1/indexes/{indexName}/browse'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($browseRequest)) { - $httpBody = $browseRequest; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Clear all synonyms. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function clearAllSynonyms($indexName, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling clearAllSynonyms' - ); - } - - $resourcePath = '/1/indexes/{indexName}/synonyms/clear'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * clear all objects from an index. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function clearObjects($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling clearObjects' - ); - } - - $resourcePath = '/1/indexes/{indexName}/clear'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Clear Rules. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function clearRules($indexName, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling clearRules' - ); - } - - $resourcePath = '/1/indexes/{indexName}/rules/clear'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete an API key. - * - * @param string $key API Key string. (required) - * - * @return array - */ - public function deleteApiKey($key) - { - // verify the required parameter 'key' is set - if ($key === null || (is_array($key) && count($key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling deleteApiKey' - ); - } - - $resourcePath = '/1/keys/{key}'; - $queryParams = []; - $httpBody = []; - // path params - if ($key !== null) { - $resourcePath = str_replace( - '{' . 'key' . '}', - ObjectSerializer::toPathValue($key), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete all records matching the query. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $searchParams searchParams (required) - * - * @return array - */ - public function deleteBy($indexName, $searchParams) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling deleteBy' - ); - } - // verify the required parameter 'searchParams' is set - if ($searchParams === null || (is_array($searchParams) && count($searchParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $searchParams when calling deleteBy' - ); - } - - $resourcePath = '/1/indexes/{indexName}/deleteByQuery'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($searchParams)) { - $httpBody = $searchParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete index. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function deleteIndex($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling deleteIndex' - ); - } - - $resourcePath = '/1/indexes/{indexName}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete object. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * - * @return array - */ - public function deleteObject($indexName, $objectID) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling deleteObject' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling deleteObject' - ); - } - - $resourcePath = '/1/indexes/{indexName}/{objectID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete a rule. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function deleteRule($indexName, $objectID, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling deleteRule' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling deleteRule' - ); - } - - $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Remove a single source. - * - * @param string $source The IP range of the source. (required) - * - * @return array - */ - public function deleteSource($source) - { - // verify the required parameter 'source' is set - if ($source === null || (is_array($source) && count($source) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $source when calling deleteSource' - ); - } - - $resourcePath = '/1/security/sources/{source}'; - $queryParams = []; - $httpBody = []; - // path params - if ($source !== null) { - $resourcePath = str_replace( - '{' . 'source' . '}', - ObjectSerializer::toPathValue($source), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Delete synonym. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function deleteSynonym($indexName, $objectID, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling deleteSynonym' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling deleteSynonym' - ); - } - - $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get an API key. - * - * @param string $key API Key string. (required) - * - * @return array - */ - public function getApiKey($key) - { - // verify the required parameter 'key' is set - if ($key === null || (is_array($key) && count($key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling getApiKey' - ); - } - - $resourcePath = '/1/keys/{key}'; - $queryParams = []; - $httpBody = []; - // path params - if ($key !== null) { - $resourcePath = str_replace( - '{' . 'key' . '}', - ObjectSerializer::toPathValue($key), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * List dictionaries supported per language. - * - * - * @return array - */ - public function getDictionaryLanguages() - { - $resourcePath = '/1/dictionaries/*/languages'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. - * - * - * @return array - */ - public function getDictionarySettings() - { - $resourcePath = '/1/dictionaries/*/settings'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Return the lastest log entries. - * - * @param int $offset First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. (optional, default to 0) - * @param int $length Maximum number of entries to retrieve. The maximum allowed value is 1000. (optional, default to 10) - * @param string $indexName Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. (optional, default to 'null') - * @param string $type Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional, default to 'all') - * - * @return array - */ - public function getLogs($offset = 0, $length = 10, $indexName = 'null', $type = 'all') - { - if ($length !== null && $length > 1000) { - throw new \InvalidArgumentException('invalid value for "$length" when calling SearchApi.getLogs, must be smaller than or equal to 1000.'); - } - - $resourcePath = '/1/logs'; - $queryParams = []; - $httpBody = []; - - if ($offset !== null) { - if ('form' === 'form' && is_array($offset)) { - foreach ($offset as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['offset'] = $offset; - } - } - - if ($length !== null) { - if ('form' === 'form' && is_array($length)) { - foreach ($length as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['length'] = $length; - } - } - - if ($indexName !== null) { - if ('form' === 'form' && is_array($indexName)) { - foreach ($indexName as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['indexName'] = $indexName; - } - } - - if ($type !== null) { - if ('form' === 'form' && is_array($type)) { - foreach ($type as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['type'] = $type; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Retrieve one object from the index. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable attributes are returned. (optional) - * - * @return array - */ - public function getObject($indexName, $objectID, $attributesToRetrieve = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getObject' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling getObject' - ); - } - - $resourcePath = '/1/indexes/{indexName}/{objectID}'; - $queryParams = []; - $httpBody = []; - - if ($attributesToRetrieve !== null) { - if ('form' === 'form' && is_array($attributesToRetrieve)) { - foreach ($attributesToRetrieve as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['attributesToRetrieve'] = $attributesToRetrieve; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Retrieve one or more objects. - * - * @param array $getObjectsParams getObjectsParams (required) - * - * @return array - */ - public function getObjects($getObjectsParams) - { - // verify the required parameter 'getObjectsParams' is set - if ($getObjectsParams === null || (is_array($getObjectsParams) && count($getObjectsParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $getObjectsParams when calling getObjects' - ); - } - - $resourcePath = '/1/indexes/*/objects'; - $queryParams = []; - $httpBody = []; - - if (isset($getObjectsParams)) { - $httpBody = $getObjectsParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get a rule. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * - * @return array - */ - public function getRule($indexName, $objectID) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getRule' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling getRule' - ); - } - - $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Retrieve settings of a given indexName. - * - * @param string $indexName The index in which to perform the request. (required) - * - * @return array - */ - public function getSettings($indexName) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getSettings' - ); - } - - $resourcePath = '/1/indexes/{indexName}/settings'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * List all allowed sources. - * - * - * @return array - */ - public function getSources() - { - $resourcePath = '/1/security/sources'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get synonym. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * - * @return array - */ - public function getSynonym($indexName, $objectID) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getSynonym' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling getSynonym' - ); - } - - $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Check the current status of a given task. - * - * @param string $indexName The index in which to perform the request. (required) - * @param int $taskID Unique identifier of an task. Numeric value (up to 64bits) (required) - * - * @return array - */ - public function getTask($indexName, $taskID) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling getTask' - ); - } - // verify the required parameter 'taskID' is set - if ($taskID === null || (is_array($taskID) && count($taskID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $taskID when calling getTask' - ); - } - - $resourcePath = '/1/indexes/{indexName}/task/{taskID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($taskID !== null) { - $resourcePath = str_replace( - '{' . 'taskID' . '}', - ObjectSerializer::toPathValue($taskID), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get top userID - * - * - * @return array - */ - public function getTopUserIds() - { - $resourcePath = '/1/clusters/mapping/top'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get userID - * - * @param string $userID userID to assign. (required) - * - * @return array - */ - public function getUserId($userID) - { - // verify the required parameter 'userID' is set - if ($userID === null || (is_array($userID) && count($userID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $userID when calling getUserId' - ); - } - if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $userID)) { - throw new \InvalidArgumentException('invalid value for "userID" when calling SearchApi.getUserId, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); - } - - $resourcePath = '/1/clusters/mapping/{userID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($userID !== null) { - $resourcePath = str_replace( - '{' . 'userID' . '}', - ObjectSerializer::toPathValue($userID), - $resourcePath - ); - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Has pending mappings - * - * @param array $getClusters Whether to get clusters or not. (optional) - * - * @return array - */ - public function hasPendingMappings($getClusters = null) - { - $resourcePath = '/1/clusters/mapping/pending'; - $queryParams = []; - $httpBody = []; - - if ($getClusters !== null) { - if ('form' === 'form' && is_array($getClusters)) { - foreach ($getClusters as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['getClusters'] = $getClusters; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get the full list of API Keys. - * - * - * @return array - */ - public function listApiKeys() - { - $resourcePath = '/1/keys'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * List clusters - * - * - * @return array - */ - public function listClusters() - { - $resourcePath = '/1/clusters'; - $queryParams = []; - $httpBody = []; - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * List existing indexes. - * - * @param int $page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) - * - * @return array - */ - public function listIndices($page = null) - { - $resourcePath = '/1/indexes'; - $queryParams = []; - $httpBody = []; - - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * List userIDs - * - * @param int $page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) - * @param int $hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) - * - * @return array - */ - public function listUserIds($page = null, $hitsPerPage = 100) - { - $resourcePath = '/1/clusters/mapping'; - $queryParams = []; - $httpBody = []; - - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } - - if ($hitsPerPage !== null) { - if ('form' === 'form' && is_array($hitsPerPage)) { - foreach ($hitsPerPage as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['hitsPerPage'] = $hitsPerPage; - } - } - - return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); - } - - /** - * Perform multiple write operations. - * - * @param array $batchParams batchParams (required) - * - * @return array - */ - public function multipleBatch($batchParams) - { - // verify the required parameter 'batchParams' is set - if ($batchParams === null || (is_array($batchParams) && count($batchParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batchParams when calling multipleBatch' - ); - } - - $resourcePath = '/1/indexes/*/batch'; - $queryParams = []; - $httpBody = []; - - if (isset($batchParams)) { - $httpBody = $batchParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get search results for the given requests. - * - * @param array $multipleQueriesParams multipleQueriesParams (required) - * - * @return array - */ - public function multipleQueries($multipleQueriesParams) - { - // verify the required parameter 'multipleQueriesParams' is set - if ($multipleQueriesParams === null || (is_array($multipleQueriesParams) && count($multipleQueriesParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $multipleQueriesParams when calling multipleQueries' - ); - } - - $resourcePath = '/1/indexes/*/queries'; - $queryParams = []; - $httpBody = []; - - if (isset($multipleQueriesParams)) { - $httpBody = $multipleQueriesParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Copy/move index. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $operationIndexParams operationIndexParams (required) - * - * @return array - */ - public function operationIndex($indexName, $operationIndexParams) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling operationIndex' - ); - } - // verify the required parameter 'operationIndexParams' is set - if ($operationIndexParams === null || (is_array($operationIndexParams) && count($operationIndexParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $operationIndexParams when calling operationIndex' - ); - } - - $resourcePath = '/1/indexes/{indexName}/operation'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($operationIndexParams)) { - $httpBody = $operationIndexParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Partially update an object. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $oneOfStringBuiltInOperation List of attributes to update. (required) - * @param array $createIfNotExists Creates the record if it does not exist yet. (optional, default to true) - * - * @return array - */ - public function partialUpdateObject($indexName, $objectID, $oneOfStringBuiltInOperation, $createIfNotExists = true) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling partialUpdateObject' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling partialUpdateObject' - ); - } - // verify the required parameter 'oneOfStringBuiltInOperation' is set - if ($oneOfStringBuiltInOperation === null || (is_array($oneOfStringBuiltInOperation) && count($oneOfStringBuiltInOperation) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $oneOfStringBuiltInOperation when calling partialUpdateObject' - ); - } - - $resourcePath = '/1/indexes/{indexName}/{objectID}/partial'; - $queryParams = []; - $httpBody = []; - - if ($createIfNotExists !== null) { - if ('form' === 'form' && is_array($createIfNotExists)) { - foreach ($createIfNotExists as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['createIfNotExists'] = $createIfNotExists; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - if (isset($oneOfStringBuiltInOperation)) { - $httpBody = $oneOfStringBuiltInOperation; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Remove userID - * - * @param string $userID userID to assign. (required) - * - * @return array - */ - public function removeUserId($userID) - { - // verify the required parameter 'userID' is set - if ($userID === null || (is_array($userID) && count($userID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $userID when calling removeUserId' - ); - } - if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $userID)) { - throw new \InvalidArgumentException('invalid value for "userID" when calling SearchApi.removeUserId, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); - } - - $resourcePath = '/1/clusters/mapping/{userID}'; - $queryParams = []; - $httpBody = []; - // path params - if ($userID !== null) { - $resourcePath = str_replace( - '{' . 'userID' . '}', - ObjectSerializer::toPathValue($userID), - $resourcePath - ); - } - - return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); - } - - /** - * Replace all allowed sources. - * - * @param array $source The sources to allow. (required) - * - * @return array - */ - public function replaceSources($source) - { - // verify the required parameter 'source' is set - if ($source === null || (is_array($source) && count($source) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $source when calling replaceSources' - ); - } - - $resourcePath = '/1/security/sources'; - $queryParams = []; - $httpBody = []; - - if (isset($source)) { - $httpBody = $source; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - /** - * Restore an API key. - * - * @param string $key API Key string. (required) - * - * @return array - */ - public function restoreApiKey($key) - { - // verify the required parameter 'key' is set - if ($key === null || (is_array($key) && count($key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling restoreApiKey' - ); - } - - $resourcePath = '/1/keys/{key}/restore'; - $queryParams = []; - $httpBody = []; - // path params - if ($key !== null) { - $resourcePath = str_replace( - '{' . 'key' . '}', - ObjectSerializer::toPathValue($key), - $resourcePath - ); - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Add an object to the index. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $body The Algolia record. (required) - * - * @return array - */ - public function saveObject($indexName, $body) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling saveObject' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling saveObject' - ); - } - - $resourcePath = '/1/indexes/{indexName}'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($body)) { - $httpBody = $body; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Save/Update a rule. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $rule rule (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function saveRule($indexName, $objectID, $rule, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling saveRule' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling saveRule' - ); - } - // verify the required parameter 'rule' is set - if ($rule === null || (is_array($rule) && count($rule) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $rule when calling saveRule' - ); - } - - $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - if (isset($rule)) { - $httpBody = $rule; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - /** - * Save synonym. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $objectID Unique identifier of an object. (required) - * @param array $synonymHit synonymHit (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function saveSynonym($indexName, $objectID, $synonymHit, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling saveSynonym' - ); - } - // verify the required parameter 'objectID' is set - if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $objectID when calling saveSynonym' - ); - } - // verify the required parameter 'synonymHit' is set - if ($synonymHit === null || (is_array($synonymHit) && count($synonymHit) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $synonymHit when calling saveSynonym' - ); - } - - $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($objectID !== null) { - $resourcePath = str_replace( - '{' . 'objectID' . '}', - ObjectSerializer::toPathValue($objectID), - $resourcePath - ); - } - - if (isset($synonymHit)) { - $httpBody = $synonymHit; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - /** - * Save a batch of synonyms. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $synonymHit synonymHit (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * @param array $replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this request. (optional) - * - * @return array - */ - public function saveSynonyms($indexName, $synonymHit, $forwardToReplicas = null, $replaceExistingSynonyms = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling saveSynonyms' - ); - } - // verify the required parameter 'synonymHit' is set - if ($synonymHit === null || (is_array($synonymHit) && count($synonymHit) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $synonymHit when calling saveSynonyms' - ); - } - - $resourcePath = '/1/indexes/{indexName}/synonyms/batch'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - - if ($replaceExistingSynonyms !== null) { - if ('form' === 'form' && is_array($replaceExistingSynonyms)) { - foreach ($replaceExistingSynonyms as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['replaceExistingSynonyms'] = $replaceExistingSynonyms; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($synonymHit)) { - $httpBody = $synonymHit; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get search results. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $searchParams searchParams (required) - * - * @return array - */ - public function search($indexName, $searchParams) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling search' - ); - } - // verify the required parameter 'searchParams' is set - if ($searchParams === null || (is_array($searchParams) && count($searchParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $searchParams when calling search' - ); - } - - $resourcePath = '/1/indexes/{indexName}/query'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($searchParams)) { - $httpBody = $searchParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Search the dictionary entries. - * - * @param string $dictionaryName The dictionary to search in. (required) - * @param array $searchDictionaryEntriesParams searchDictionaryEntriesParams (required) - * - * @return array - */ - public function searchDictionaryEntries($dictionaryName, $searchDictionaryEntriesParams) - { - // verify the required parameter 'dictionaryName' is set - if ($dictionaryName === null || (is_array($dictionaryName) && count($dictionaryName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dictionaryName when calling searchDictionaryEntries' - ); - } - // verify the required parameter 'searchDictionaryEntriesParams' is set - if ($searchDictionaryEntriesParams === null || (is_array($searchDictionaryEntriesParams) && count($searchDictionaryEntriesParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $searchDictionaryEntriesParams when calling searchDictionaryEntries' - ); - } - - $resourcePath = '/1/dictionaries/{dictionaryName}/search'; - $queryParams = []; - $httpBody = []; - // path params - if ($dictionaryName !== null) { - $resourcePath = str_replace( - '{' . 'dictionaryName' . '}', - ObjectSerializer::toPathValue($dictionaryName), - $resourcePath - ); - } - - if (isset($searchDictionaryEntriesParams)) { - $httpBody = $searchDictionaryEntriesParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Search for values of a given facet - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $facetName The facet name. (required) - * @param array $searchForFacetValuesRequest searchForFacetValuesRequest (optional) - * - * @return array - */ - public function searchForFacetValues($indexName, $facetName, $searchForFacetValuesRequest = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling searchForFacetValues' - ); - } - // verify the required parameter 'facetName' is set - if ($facetName === null || (is_array($facetName) && count($facetName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $facetName when calling searchForFacetValues' - ); - } - - $resourcePath = '/1/indexes/{indexName}/facets/{facetName}/query'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - // path params - if ($facetName !== null) { - $resourcePath = str_replace( - '{' . 'facetName' . '}', - ObjectSerializer::toPathValue($facetName), - $resourcePath - ); - } - - if (isset($searchForFacetValuesRequest)) { - $httpBody = $searchForFacetValuesRequest; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Search for rules. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $searchRulesParams searchRulesParams (required) - * - * @return array - */ - public function searchRules($indexName, $searchRulesParams) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling searchRules' - ); - } - // verify the required parameter 'searchRulesParams' is set - if ($searchRulesParams === null || (is_array($searchRulesParams) && count($searchRulesParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $searchRulesParams when calling searchRules' - ); - } - - $resourcePath = '/1/indexes/{indexName}/rules/search'; - $queryParams = []; - $httpBody = []; - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($searchRulesParams)) { - $httpBody = $searchRulesParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Get all synonyms that match a query. - * - * @param string $indexName The index in which to perform the request. (required) - * @param string $query Search for specific synonyms matching this string. (optional, default to '') - * @param array $type Only search for specific types of synonyms. (optional) - * @param int $page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional, default to 0) - * @param int $hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) - * - * @return array - */ - public function searchSynonyms($indexName, $query = '', $type = null, $page = 0, $hitsPerPage = 100) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling searchSynonyms' - ); - } - - $resourcePath = '/1/indexes/{indexName}/synonyms/search'; - $queryParams = []; - $httpBody = []; - - if ($query !== null) { - if ('form' === 'form' && is_array($query)) { - foreach ($query as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['query'] = $query; - } - } - - if ($type !== null) { - if ('form' === 'form' && is_array($type)) { - foreach ($type as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['type'] = $type; - } - } - - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } - - if ($hitsPerPage !== null) { - if ('form' === 'form' && is_array($hitsPerPage)) { - foreach ($hitsPerPage as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['hitsPerPage'] = $hitsPerPage; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Search userID - * - * @param array $searchUserIdsParams searchUserIdsParams (required) - * - * @return array - */ - public function searchUserIds($searchUserIdsParams) - { - // verify the required parameter 'searchUserIdsParams' is set - if ($searchUserIdsParams === null || (is_array($searchUserIdsParams) && count($searchUserIdsParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $searchUserIdsParams when calling searchUserIds' - ); - } - - $resourcePath = '/1/clusters/mapping/search'; - $queryParams = []; - $httpBody = []; - - if (isset($searchUserIdsParams)) { - $httpBody = $searchUserIdsParams; - } - - return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); - } - - /** - * Set dictionary settings. - * - * @param array $dictionarySettingsParams dictionarySettingsParams (required) - * - * @return array - */ - public function setDictionarySettings($dictionarySettingsParams) - { - // verify the required parameter 'dictionarySettingsParams' is set - if ($dictionarySettingsParams === null || (is_array($dictionarySettingsParams) && count($dictionarySettingsParams) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dictionarySettingsParams when calling setDictionarySettings' - ); - } - - $resourcePath = '/1/dictionaries/*/settings'; - $queryParams = []; - $httpBody = []; - - if (isset($dictionarySettingsParams)) { - $httpBody = $dictionarySettingsParams; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - /** - * Update settings of a given indexName. - * - * @param string $indexName The index in which to perform the request. (required) - * @param array $indexSettings indexSettings (required) - * @param array $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * - * @return array - */ - public function setSettings($indexName, $indexSettings, $forwardToReplicas = null) - { - // verify the required parameter 'indexName' is set - if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexName when calling setSettings' - ); - } - // verify the required parameter 'indexSettings' is set - if ($indexSettings === null || (is_array($indexSettings) && count($indexSettings) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $indexSettings when calling setSettings' - ); - } - - $resourcePath = '/1/indexes/{indexName}/settings'; - $queryParams = []; - $httpBody = []; - - if ($forwardToReplicas !== null) { - if ('form' === 'form' && is_array($forwardToReplicas)) { - foreach ($forwardToReplicas as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['forwardToReplicas'] = $forwardToReplicas; - } - } - // path params - if ($indexName !== null) { - $resourcePath = str_replace( - '{' . 'indexName' . '}', - ObjectSerializer::toPathValue($indexName), - $resourcePath - ); - } - - if (isset($indexSettings)) { - $httpBody = $indexSettings; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - /** - * Update an API key. - * - * @param string $key API Key string. (required) - * @param array $apiKey apiKey (required) - * - * @return array - */ - public function updateApiKey($key, $apiKey) - { - // verify the required parameter 'key' is set - if ($key === null || (is_array($key) && count($key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling updateApiKey' - ); - } - // verify the required parameter 'apiKey' is set - if ($apiKey === null || (is_array($apiKey) && count($apiKey) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $apiKey when calling updateApiKey' - ); - } - - $resourcePath = '/1/keys/{key}'; - $queryParams = []; - $httpBody = []; - // path params - if ($key !== null) { - $resourcePath = str_replace( - '{' . 'key' . '}', - ObjectSerializer::toPathValue($key), - $resourcePath - ); - } - - if (isset($apiKey)) { - $httpBody = $apiKey; - } - - return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); - } - - private function sendRequest($method, $resourcePath, $queryParams, $httpBody) - { - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : '') - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody - ); - } - - return $request; - } -} diff --git a/clients/algoliasearch-client-php/lib/ApiException.php b/clients/algoliasearch-client-php/lib/ApiException.php deleted file mode 100644 index d484a88eb5..0000000000 --- a/clients/algoliasearch-client-php/lib/ApiException.php +++ /dev/null @@ -1,92 +0,0 @@ -responseHeaders = $responseHeaders; - $this->responseBody = $responseBody; - } - - /** - * Gets the HTTP response header - * - * @return string[]|null HTTP response header - */ - public function getResponseHeaders() - { - return $this->responseHeaders; - } - - /** - * Gets the HTTP body of the server response either as Json or string - * - * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string - */ - public function getResponseBody() - { - return $this->responseBody; - } - - /** - * Sets the deserialized response object (during deserialization) - * - * @param mixed $obj Deserialized response object - * - * @return void - */ - public function setResponseObject($obj) - { - $this->responseObject = $obj; - } - - /** - * Gets the deserialized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() - { - return $this->responseObject; - } -} diff --git a/clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php b/clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php deleted file mode 100644 index 86bcba64c9..0000000000 --- a/clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php +++ /dev/null @@ -1,117 +0,0 @@ -directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; - } - - /** - * @inheritdoc - */ - public function get($key, $default = null) - { - if (!$this->has($key)) { - return $default; - } - - return file_get_contents($this->getFilenameFromKey($key)); - } - - /** - * @inheritdoc - */ - public function set($key, $value, $ttl = null) - { - return file_put_contents($this->getFilenameFromKey($key), $value); - } - - /** - * @inheritdoc - */ - public function delete($key) - { - return @unlink($this->getFilenameFromKey($key)); - } - - /** - * @inheritdoc - */ - public function clear() - { - $result = true; - foreach (glob($this->directory.self::PREFIX.'*') as $file) { - $result &= @unlink($file); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function getMultiple($keys, $default = null) - { - $result = []; - foreach ($keys as $key) { - $result[$key] = $this->get($key, $default); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function setMultiple($values, $ttl = null) - { - $result = true; - foreach ($values as $key => $value) { - $result &= $this->set($key, $value, $ttl); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function deleteMultiple($keys) - { - $result = true; - foreach ($keys as $key) { - $result &= $this->delete($key); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function has($key) - { - return file_exists($this->getFilenameFromKey($key)); - } - - /** - * @param string $key - * - * @return string - */ - private function getFilenameFromKey($key) - { - $name = $this->directory.self::PREFIX.$key; - - return str_replace('\\', '-', $name); - } -} diff --git a/clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php b/clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php deleted file mode 100644 index ffb8dc6a5a..0000000000 --- a/clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php +++ /dev/null @@ -1,78 +0,0 @@ - null !== $appId ? $appId : getenv('ALGOLIA_APP_ID'), - 'apiKey' => null !== $apiKey ? $apiKey : getenv('ALGOLIA_API_KEY'), - 'region' => null !== $region ? $region : 'us', - ]; - - return new static($config); - } - - public function getRegion() - { - return $this->config['region']; - } -} diff --git a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php deleted file mode 100644 index 44c1de0eb7..0000000000 --- a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php +++ /dev/null @@ -1,274 +0,0 @@ -setAlgoliaApiKey($config['apiKey']); - $this->setApiKey('X-Algolia-API-Key', $config['apiKey']); - } - - if (isset($config['appId'])) { - $this->setAppId($config['appId']); - $this->setApiKey('X-Algolia-Application-Id', $config['appId']); - } - - $config += $this->getDefaultConfiguration(); - $this->config = $config; - } - - /** - * Sets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setApiKey($apiKeyIdentifier, $key) - { - $this->apiKeys[$apiKeyIdentifier] = $key; - - return $this; - } - - /** - * Gets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string API key or token - */ - public function getApiKey($apiKeyIdentifier) - { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - public function getDefaultConfiguration() - { - return [ - 'appId' => '', - 'apiKey' => '', - 'hosts' => null, - 'readTimeout' => $this->defaultReadTimeout, - 'writeTimeout' => $this->defaultWriteTimeout, - 'connectTimeout' => $this->defaultConnectTimeout, - 'defaultHeaders' => [], - ]; - } - - public function getAppId() - { - return $this->config['appId']; - } - - public function setAppId($appId) - { - $this->config['appId'] = $appId; - - return $this; - } - - public function getAlgoliaApiKey() - { - return $this->config['apiKey']; - } - - public function setAlgoliaApiKey($apiKey) - { - $this->config['apiKey'] = $apiKey; - - return $this; - } - - public function getHosts() - { - return $this->config['hosts']; - } - - public function setHosts($hosts) - { - $this->config['hosts'] = $hosts; - - return $this; - } - - public function getReadTimeout() - { - return $this->config['readTimeout']; - } - - public function setReadTimeout($readTimeout) - { - $this->config['readTimeout'] = $readTimeout; - - return $this; - } - - public function getWriteTimeout() - { - return $this->config['writeTimeout']; - } - - public function setWriteTimeout($writeTimeout) - { - $this->config['writeTimeout'] = $writeTimeout; - - return $this; - } - - public function getConnectTimeout() - { - return $this->config['connectTimeout']; - } - - public function setConnectTimeout($connectTimeout) - { - $this->config['connectTimeout'] = $connectTimeout; - - return $this; - } - - public function getDefaultHeaders() - { - return $this->config['defaultHeaders']; - } - - public function setDefaultHeaders(array $defaultHeaders) - { - $this->config['defaultHeaders'] = $defaultHeaders; - - return $this; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } -} diff --git a/clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php b/clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php deleted file mode 100644 index 6cbba26b83..0000000000 --- a/clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php +++ /dev/null @@ -1,7 +0,0 @@ - null !== $appId ? $appId : getenv('ALGOLIA_APP_ID'), - 'apiKey' => null !== $apiKey ? $apiKey : getenv('ALGOLIA_API_KEY'), - ]; - - return new static($config); - } - - public function getDefaultConfiguration() - { - return [ - 'appId' => '', - 'apiKey' => '', - 'hosts' => null, - 'readTimeout' => $this->defaultReadTimeout, - 'writeTimeout' => $this->defaultWriteTimeout, - 'connectTimeout' => $this->defaultConnectTimeout, - 'waitTaskTimeBeforeRetry' => $this->defaultWaitTaskTimeBeforeRetry, - 'defaultHeaders' => [], - 'defaultForwardToReplicas' => null, - 'batchSize' => 1000, - ]; - } -} diff --git a/clients/algoliasearch-client-php/lib/Exceptions/AlgoliaException.php b/clients/algoliasearch-client-php/lib/Exceptions/AlgoliaException.php deleted file mode 100644 index 0334990688..0000000000 --- a/clients/algoliasearch-client-php/lib/Exceptions/AlgoliaException.php +++ /dev/null @@ -1,7 +0,0 @@ -request = $request; - - return $this; - } - - public function getRequest() - { - return $this->request; - } -} diff --git a/clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php b/clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php deleted file mode 100644 index 71ff5d4b09..0000000000 --- a/clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php +++ /dev/null @@ -1,7 +0,0 @@ -client = $client ?: static::buildClient(); - } - - public function sendRequest(RequestInterface $request, $timeout, $connectTimeout) - { - try { - $response = $this->client->send($request, [ - 'timeout' => $timeout, - 'connect_timeout' => $connectTimeout, - ]); - } catch (RequestException $e) { - if ($e->hasResponse()) { - return $e->getResponse(); - } - - return new Response( - 0, - [], - null, - '1.1', - $e->getMessage() - ); - } catch (ConnectException $e) { - return new Response( - 0, - [], - null, - '1.1', - $e->getMessage() - ); - } - - return $response; - } - - private static function buildClient(array $config = []) - { - $handlerStack = new HandlerStack(\GuzzleHttp\choose_handler()); - $handlerStack->push(Middleware::prepareBody(), 'prepare_body'); - $config = array_merge(['handler' => $handlerStack], $config); - - return new GuzzleClient($config); - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php b/clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php deleted file mode 100644 index 1e4985365d..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -hwm = $hwm; - } - - public function __toString() - { - return $this->getContents(); - } - - public function getContents() - { - $buffer = $this->buffer; - $this->buffer = ''; - - return $buffer; - } - - public function close() - { - $this->buffer = ''; - } - - public function detach() - { - $this->close(); - } - - public function getSize() - { - return mb_strlen($this->buffer); - } - - public function isReadable() - { - return true; - } - - public function isWritable() - { - return true; - } - - public function isSeekable() - { - return false; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - throw new \RuntimeException('Cannot seek a BufferStream'); - } - - public function eof() - { - return 0 === mb_strlen($this->buffer); - } - - public function tell() - { - throw new \RuntimeException('Cannot determine the position of a BufferStream'); - } - - /** - * Reads data from the buffer. - */ - public function read($length) - { - $currentLength = mb_strlen($this->buffer); - - if ($length >= $currentLength) { - // No need to slice the buffer because we don't have enough data. - $result = $this->buffer; - $this->buffer = ''; - } else { - // Slice up the result to provide a subset of the buffer. - $result = mb_substr($this->buffer, 0, $length); - $this->buffer = mb_substr($this->buffer, $length); - } - - return $result; - } - - /** - * Writes data to the buffer. - */ - public function write($string) - { - $this->buffer .= $string; - - // TODO: What should happen here? - if (mb_strlen($this->buffer) >= $this->hwm) { - return false; - } - - return mb_strlen($string); - } - - public function getMetadata($key = null) - { - if ('hwm' === $key) { - return $this->hwm; - } - - return $key ? null : []; - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php b/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php deleted file mode 100644 index 86786edb6f..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php +++ /dev/null @@ -1,169 +0,0 @@ -source = $source; - $this->size = isset($options['size']) ? $options['size'] : null; - $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; - $this->buffer = new BufferStream(); - } - - public function __toString() - { - try { - return copy_to_string($this); - } catch (\Exception $e) { - return ''; - } - } - - public function close() - { - $this->detach(); - } - - public function detach() - { - $this->tellPos = false; - $this->source = null; - } - - public function getSize() - { - return $this->size; - } - - public function tell() - { - return $this->tellPos; - } - - public function eof() - { - return !$this->source; - } - - public function isSeekable() - { - return false; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - throw new \RuntimeException('Cannot seek a PumpStream'); - } - - public function isWritable() - { - return false; - } - - public function write($string) - { - throw new \RuntimeException('Cannot write to a PumpStream'); - } - - public function isReadable() - { - return true; - } - - public function read($length) - { - $data = $this->buffer->read($length); - $readLen = mb_strlen($data); - $this->tellPos += $readLen; - $remaining = $length - $readLen; - - if ($remaining) { - $this->pump($remaining); - $data .= $this->buffer->read($remaining); - $this->tellPos += mb_strlen($data) - $readLen; - } - - return $data; - } - - public function getContents() - { - $result = ''; - while (!$this->eof()) { - $result .= $this->read(1000000); - } - - return $result; - } - - public function getMetadata($key = null) - { - if (!$key) { - return $this->metadata; - } - - return isset($this->metadata[$key]) ? $this->metadata[$key] : null; - } - - private function pump($length) - { - if ($this->source) { - do { - $data = call_user_func($this->source, $length); - if (false === $data || null === $data) { - $this->source = null; - - return; - } - $this->buffer->write($data); - $length -= mb_strlen($data); - } while ($length > 0); - } - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Request.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Request.php deleted file mode 100644 index 43a6ba024c..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/Request.php +++ /dev/null @@ -1,308 +0,0 @@ - array of values */ - private $headers = []; - - /** @var array Map of lowercase header name => original name at registration */ - private $headerNames = []; - - /** @var string */ - private $protocol = '1.1'; - - /** @var StreamInterface */ - private $stream; - - /** - * @param string $method HTTP method - * @param string|UriInterface $uri URI - * @param array $headers Request headers - * @param string|resource|StreamInterface|null $body Request body - * @param string $version Protocol version - */ - public function __construct( - $method, - $uri, - array $headers = [], - $body = null, - $version = '1.1' - ) { - if (!($uri instanceof UriInterface)) { - $uri = new Uri($uri); - } - - $this->method = mb_strtoupper($method); - $this->uri = $uri; - $this->setHeaders($headers); - $this->protocol = $version; - - if (!$this->hasHeader('Host')) { - $this->updateHostFromUri(); - } - - if ('' !== $body && null !== $body) { - $this->stream = stream_for($body); - } - } - - public function getRequestTarget() - { - if (null !== $this->requestTarget) { - return $this->requestTarget; - } - - $target = $this->uri->getPath(); - if ('' === $target) { - $target = '/'; - } - if ('' !== $this->uri->getQuery()) { - $target .= '?'.$this->uri->getQuery(); - } - - return $target; - } - - public function withRequestTarget($requestTarget) - { - if (preg_match('#\s#', $requestTarget)) { - throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); - } - - $new = clone $this; - $new->requestTarget = $requestTarget; - - return $new; - } - - public function getMethod() - { - return $this->method; - } - - public function withMethod($method) - { - $new = clone $this; - $new->method = mb_strtoupper($method); - - return $new; - } - - public function getUri() - { - return $this->uri; - } - - public function withUri(UriInterface $uri, $preserveHost = false) - { - if ($uri === $this->uri) { - return $this; - } - - $new = clone $this; - $new->uri = $uri; - - if (!$preserveHost) { - $new->updateHostFromUri(); - } - - return $new; - } - - private function updateHostFromUri() - { - $host = $this->uri->getHost(); - - if ('' === $host) { - return; - } - - if (null !== ($port = $this->uri->getPort())) { - $host .= ':'.$port; - } - - if (isset($this->headerNames['host'])) { - $header = $this->headerNames['host']; - } else { - $header = 'Host'; - $this->headerNames['host'] = 'Host'; - } - // Ensure Host is the first header. - // See: http://tools.ietf.org/html/rfc7230#section-5.4 - $this->headers = [$header => [$host]] + $this->headers; - } - - public function getProtocolVersion() - { - return $this->protocol; - } - - public function withProtocolVersion($version) - { - if ($this->protocol === $version) { - return $this; - } - $new = clone $this; - $new->protocol = $version; - - return $new; - } - - public function getHeaders() - { - return $this->headers; - } - - public function hasHeader($header) - { - return isset($this->headerNames[mb_strtolower($header)]); - } - - public function getHeader($header) - { - $header = mb_strtolower($header); - if (!isset($this->headerNames[$header])) { - return []; - } - $header = $this->headerNames[$header]; - - return $this->headers[$header]; - } - - public function getHeaderLine($header) - { - return implode(', ', $this->getHeader($header)); - } - - public function withHeader($header, $value) - { - if (!is_array($value)) { - $value = [$value]; - } - $value = $this->trimHeaderValues($value); - $normalized = mb_strtolower($header); - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - unset($new->headers[$new->headerNames[$normalized]]); - } - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - - return $new; - } - - public function withAddedHeader($header, $value) - { - if (!is_array($value)) { - $value = [$value]; - } - $value = $this->trimHeaderValues($value); - $normalized = mb_strtolower($header); - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $new->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - } - - return $new; - } - - public function withoutHeader($header) - { - $normalized = mb_strtolower($header); - if (!isset($this->headerNames[$normalized])) { - return $this; - } - $header = $this->headerNames[$normalized]; - $new = clone $this; - unset($new->headers[$header], $new->headerNames[$normalized]); - - return $new; - } - - public function getBody() - { - if (!$this->stream) { - $this->stream = stream_for(''); - } - - return $this->stream; - } - - public function withBody(StreamInterface $body) - { - if ($body === $this->stream) { - return $this; - } - $new = clone $this; - $new->stream = $body; - - return $new; - } - - private function setHeaders(array $headers) - { - $this->headerNames = $this->headers = []; - foreach ($headers as $header => $value) { - if (!is_array($value)) { - $value = [$value]; - } - $value = $this->trimHeaderValues($value); - $normalized = mb_strtolower($header); - if (isset($this->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $this->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $this->headerNames[$normalized] = $header; - $this->headers[$header] = $value; - } - } - } - - /** - * Trims whitespace from the header values. - * - * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. - * - * header-field = field-name ":" OWS field-value OWS - * OWS = *( SP / HTAB ) - * - * @param string[] $values Header values - * - * @return string[] Trimmed header values - * - * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 - */ - private function trimHeaderValues(array $values) - { - return array_map(function ($value) { - return trim($value, " \t"); - }, $values); - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Response.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Response.php deleted file mode 100644 index ee338a823b..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/Response.php +++ /dev/null @@ -1,314 +0,0 @@ - array of values */ - private $headers = []; - - /** @var array Map of lowercase header name => original name at registration */ - private $headerNames = []; - - /** @var string */ - private $protocol = '1.1'; - - /** @var StreamInterface */ - private $stream; - - /** @var array Map of standard HTTP status code/reason phrases */ - private static $phrases = [ - 100 => 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-status', - 208 => 'Already Reported', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => 'Switch Proxy', - 307 => 'Temporary Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Time-out', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Large', - 415 => 'Unsupported Media Type', - 416 => 'Requested range not satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', - 422 => 'Unprocessable Entity', - 423 => 'Locked', - 424 => 'Failed Dependency', - 425 => 'Unordered Collection', - 426 => 'Upgrade Required', - 428 => 'Precondition Required', - 429 => 'Too Many Requests', - 431 => 'Request Header Fields Too Large', - 451 => 'Unavailable For Legal Reasons', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Time-out', - 505 => 'HTTP Version not supported', - 506 => 'Variant Also Negotiates', - 507 => 'Insufficient Storage', - 508 => 'Loop Detected', - 511 => 'Network Authentication Required', - ]; - - /** @var string */ - private $reasonPhrase = ''; - - /** @var int */ - private $statusCode = 200; - - /** - * @param int $status Status code - * @param array $headers Response headers - * @param string|resource|StreamInterface|null $body Response body - * @param string $version Protocol version - * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) - */ - public function __construct( - $status = 200, - array $headers = [], - $body = null, - $version = '1.1', - $reason = null - ) { - $this->statusCode = (int) $status; - - if ('' !== $body && null !== $body) { - $this->stream = stream_for($body); - } - - $this->setHeaders($headers); - if ('' === $reason && isset(self::$phrases[$this->statusCode])) { - $this->reasonPhrase = self::$phrases[$this->statusCode]; - } else { - $this->reasonPhrase = (string) $reason; - } - - $this->protocol = $version; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getReasonPhrase() - { - return $this->reasonPhrase; - } - - public function withStatus($code, $reasonPhrase = '') - { - $new = clone $this; - $new->statusCode = (int) $code; - if ('' === $reasonPhrase && isset(self::$phrases[$new->statusCode])) { - $reasonPhrase = self::$phrases[$new->statusCode]; - } - $new->reasonPhrase = $reasonPhrase; - - return $new; - } - - public function getProtocolVersion() - { - return $this->protocol; - } - - public function withProtocolVersion($version) - { - if ($this->protocol === $version) { - return $this; - } - - $new = clone $this; - $new->protocol = $version; - - return $new; - } - - public function getHeaders() - { - return $this->headers; - } - - public function hasHeader($header) - { - return isset($this->headerNames[mb_strtolower($header)]); - } - - public function getHeader($header) - { - $header = mb_strtolower($header); - - if (!isset($this->headerNames[$header])) { - return []; - } - - $header = $this->headerNames[$header]; - - return $this->headers[$header]; - } - - public function getHeaderLine($header) - { - return implode(', ', $this->getHeader($header)); - } - - public function withHeader($header, $value) - { - if (!is_array($value)) { - $value = [$value]; - } - - $value = $this->trimHeaderValues($value); - $normalized = mb_strtolower($header); - - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - unset($new->headers[$new->headerNames[$normalized]]); - } - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - - return $new; - } - - public function withAddedHeader($header, $value) - { - if (!is_array($value)) { - $value = [$value]; - } - - $value = $this->trimHeaderValues($value); - $normalized = mb_strtolower($header); - - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $new->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - } - - return $new; - } - - public function withoutHeader($header) - { - $normalized = mb_strtolower($header); - - if (!isset($this->headerNames[$normalized])) { - return $this; - } - - $header = $this->headerNames[$normalized]; - - $new = clone $this; - unset($new->headers[$header], $new->headerNames[$normalized]); - - return $new; - } - - public function getBody() - { - if (!$this->stream) { - $this->stream = stream_for(''); - } - - return $this->stream; - } - - public function withBody(StreamInterface $body) - { - if ($body === $this->stream) { - return $this; - } - - $new = clone $this; - $new->stream = $body; - - return $new; - } - - private function setHeaders(array $headers) - { - $this->headerNames = $this->headers = []; - foreach ($headers as $header => $value) { - if (!is_array($value)) { - $value = [$value]; - } - - $value = $this->trimHeaderValues($value); - $normalized = mb_strtolower($header); - if (isset($this->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $this->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $this->headerNames[$normalized] = $header; - $this->headers[$header] = $value; - } - } - } - - /** - * Trims whitespace from the header values. - * - * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. - * - * header-field = field-name ":" OWS field-value OWS - * OWS = *( SP / HTAB ) - * - * @param string[] $values Header values - * - * @return string[] Trimmed header values - * - * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 - */ - private function trimHeaderValues(array $values) - { - return array_map(function ($value) { - return trim($value, " \t"); - }, $values); - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php deleted file mode 100644 index 818864e06d..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php +++ /dev/null @@ -1,278 +0,0 @@ - [ - 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, - 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, - 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, - 'x+t' => true, 'c+t' => true, 'a+' => true, - ], - 'write' => [ - 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, - 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, - 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, - 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true, - ], - ]; - - /** - * This constructor accepts an associative array of options. - * - * - size: (int) If a read stream would otherwise have an indeterminate - * size, but the size is known due to foreknowledge, then you can - * provide that size, in bytes. - * - metadata: (array) Any additional metadata to return when the metadata - * of the stream is accessed. - * - * @param resource $stream stream resource to wrap - * @param array $options associative array of options - * - * @throws \InvalidArgumentException if the stream is not a stream resource - */ - public function __construct($stream, $options = []) - { - if (!is_resource($stream)) { - throw new \InvalidArgumentException('Stream must be a resource'); - } - - if (isset($options['size'])) { - $this->size = $options['size']; - } - - $this->customMetadata = isset($options['metadata']) - ? $options['metadata'] - : []; - - $this->stream = $stream; - $meta = stream_get_meta_data($this->stream); - $this->seekable = $meta['seekable']; - $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]); - $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]); - $this->uri = $this->getMetadata('uri'); - } - - /** - * Closes the stream when the destructed. - */ - public function __destruct() - { - $this->close(); - } - - public function __toString() - { - try { - $this->seek(0); - - return (string) stream_get_contents($this->stream); - } catch (\Exception $e) { - return ''; - } - } - - public function getContents() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - $contents = stream_get_contents($this->stream); - - if (false === $contents) { - throw new \RuntimeException('Unable to read stream contents'); - } - - return $contents; - } - - public function close() - { - if (isset($this->stream)) { - if (is_resource($this->stream)) { - fclose($this->stream); - } - $this->detach(); - } - } - - public function detach() - { - if (!isset($this->stream)) { - return null; - } - - $result = $this->stream; - unset($this->stream); - $this->size = $this->uri = null; - $this->readable = $this->writable = $this->seekable = false; - - return $result; - } - - public function getSize() - { - if (null !== $this->size) { - return $this->size; - } - - if (!isset($this->stream)) { - return null; - } - - // Clear the stat cache if the stream has a URI - if ($this->uri) { - clearstatcache(true, $this->uri); - } - - $stats = fstat($this->stream); - if (isset($stats['size'])) { - $this->size = $stats['size']; - - return $this->size; - } - - return null; - } - - public function isReadable() - { - return $this->readable; - } - - public function isWritable() - { - return $this->writable; - } - - public function isSeekable() - { - return $this->seekable; - } - - public function eof() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - return feof($this->stream); - } - - public function tell() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - $result = ftell($this->stream); - - if (false === $result) { - throw new \RuntimeException('Unable to determine stream position'); - } - - return $result; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->seekable) { - throw new \RuntimeException('Stream is not seekable'); - } - if (-1 === fseek($this->stream, $offset, $whence)) { - throw new \RuntimeException('Unable to seek to stream position '.$offset.' with whence '.var_export($whence, true)); - } - } - - public function read($length) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->readable) { - throw new \RuntimeException('Cannot read from non-readable stream'); - } - if ($length < 0) { - throw new \RuntimeException('Length parameter cannot be negative'); - } - - if (0 === $length) { - return ''; - } - - $string = fread($this->stream, $length); - if (false === $string) { - throw new \RuntimeException('Unable to read from stream'); - } - - return $string; - } - - public function write($string) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->writable) { - throw new \RuntimeException('Cannot write to a non-writable stream'); - } - - // We can't know the size after writing anything - $this->size = null; - $result = fwrite($this->stream, $string); - - if (false === $result) { - throw new \RuntimeException('Unable to write to stream'); - } - - return $result; - } - - public function getMetadata($key = null) - { - if (!isset($this->stream)) { - return $key ? null : []; - } elseif (!$key) { - return $this->customMetadata + stream_get_meta_data($this->stream); - } elseif (isset($this->customMetadata[$key])) { - return $this->customMetadata[$key]; - } - - $meta = stream_get_meta_data($this->stream); - - return isset($meta[$key]) ? $meta[$key] : null; - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php deleted file mode 100644 index 9d532477ac..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php +++ /dev/null @@ -1,716 +0,0 @@ - 80, - 'https' => 443, - 'ftp' => 21, - 'gopher' => 70, - 'nntp' => 119, - 'news' => 119, - 'telnet' => 23, - 'tn3270' => 23, - 'imap' => 143, - 'pop' => 110, - 'ldap' => 389, - ]; - - private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; - - private static $charSubDelims = '!\$&\'\(\)\*\+,;='; - - private static $replaceQuery = ['=' => '%3D', '&' => '%26']; - - /** @var string Uri scheme. */ - private $scheme = ''; - - /** @var string Uri user info. */ - private $userInfo = ''; - - /** @var string Uri host. */ - private $host = ''; - - /** @var int|null Uri port. */ - private $port; - - /** @var string Uri path. */ - private $path = ''; - - /** @var string Uri query string. */ - private $query = ''; - - /** @var string Uri fragment. */ - private $fragment = ''; - - /** - * @param string $uri URI to parse - */ - public function __construct($uri = '') - { - // weak type check to also accept null until we can add scalar type hints - if ('' !== $uri) { - $parts = parse_url($uri); - if (false === $parts) { - throw new \InvalidArgumentException("Unable to parse URI: $uri"); - } - $this->applyParts($parts); - } - } - - public function __toString() - { - return self::composeComponents( - $this->scheme, - $this->getAuthority(), - $this->path, - $this->query, - $this->fragment - ); - } - - /** - * Composes a URI reference string from its various components. - * - * Usually this method does not need to be called manually but instead is used indirectly via - * `Psr\Http\Message\UriInterface::__toString`. - * - * PSR-7 UriInterface treats an empty component the same as a missing component as - * getQuery(), getFragment() etc. always return a string. This explains the slight - * difference to RFC 3986 Section 5.3. - * - * Another adjustment is that the authority separator is added even when the authority is missing/empty - * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with - * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But - * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to - * that format). - * - * @param string $scheme - * @param string $authority - * @param string $path - * @param string $query - * @param string $fragment - * - * @return string - * - * @see https://tools.ietf.org/html/rfc3986#section-5.3 - */ - public static function composeComponents($scheme, $authority, $path, $query, $fragment) - { - $uri = ''; - - // weak type checks to also accept null until we can add scalar type hints - if ('' !== $scheme) { - $uri .= $scheme.':'; - } - - if ('' !== $authority || 'file' === $scheme) { - $uri .= '//'.$authority; - } - - $uri .= $path; - - if ('' !== $query) { - $uri .= '?'.$query; - } - - if ('' !== $fragment) { - $uri .= '#'.$fragment; - } - - return $uri; - } - - /** - * Whether the URI has the default port of the current scheme. - * - * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used - * independently of the implementation. - * - * @return bool - */ - public static function isDefaultPort(UriInterface $uri) - { - return null === $uri->getPort() - || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); - } - - /** - * Whether the URI is absolute, i.e. it has a scheme. - * - * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true - * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative - * to another URI, the base URI. Relative references can be divided into several forms: - * - network-path references, e.g. '//example.com/path' - * - absolute-path references, e.g. '/path' - * - relative-path references, e.g. 'subpath' - * - * @return bool - * - * @see Uri::isNetworkPathReference - * @see Uri::isAbsolutePathReference - * @see Uri::isRelativePathReference - * @see https://tools.ietf.org/html/rfc3986#section-4 - */ - public static function isAbsolute(UriInterface $uri) - { - return '' !== $uri->getScheme(); - } - - /** - * Whether the URI is a network-path reference. - * - * A relative reference that begins with two slash characters is termed an network-path reference. - * - * @return bool - * - * @see https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isNetworkPathReference(UriInterface $uri) - { - return '' === $uri->getScheme() && '' !== $uri->getAuthority(); - } - - /** - * Whether the URI is a absolute-path reference. - * - * A relative reference that begins with a single slash character is termed an absolute-path reference. - * - * @return bool - * - * @see https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isAbsolutePathReference(UriInterface $uri) - { - $path = $uri->getPath(); - - return '' === $uri->getScheme() - && '' === $uri->getAuthority() - && isset($path[0]) - && '/' === $path[0]; - } - - /** - * Whether the URI is a relative-path reference. - * - * A relative reference that does not begin with a slash character is termed a relative-path reference. - * - * @return bool - * - * @see https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isRelativePathReference(UriInterface $uri) - { - $path = $uri->getPath(); - - return '' === $uri->getScheme() - && '' === $uri->getAuthority() - && (!isset($path[0]) || '/' !== $path[0]); - } - - /** - * Whether the URI is a same-document reference. - * - * A same-document reference refers to a URI that is, aside from its fragment - * component, identical to the base URI. When no base URI is given, only an empty - * URI reference (apart from its fragment) is considered a same-document reference. - * - * @param UriInterface $uri The URI to check - * @param UriInterface|null $base An optional base URI to compare against - * - * @return bool - * - * @see https://tools.ietf.org/html/rfc3986#section-4.4 - */ - public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) - { - if (null !== $base) { - $uri = UriResolver::resolve($base, $uri); - - return ($uri->getScheme() === $base->getScheme()) - && ($uri->getAuthority() === $base->getAuthority()) - && ($uri->getPath() === $base->getPath()) - && ($uri->getQuery() === $base->getQuery()); - } - - return '' === $uri->getScheme() && '' === $uri->getAuthority() && '' === $uri->getPath() && '' === $uri->getQuery(); - } - - /** - * Removes dot segments from a path and returns the new path. - * - * @param string $path - * - * @return string - * - * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. - * @see UriResolver::removeDotSegments - */ - public static function removeDotSegments($path) - { - return UriResolver::removeDotSegments($path); - } - - /** - * Converts the relative URI into a new URI that is resolved against the base URI. - * - * @param UriInterface $base Base URI - * @param string|UriInterface $rel Relative URI - * - * @return UriInterface - * - * @deprecated since version 1.4. Use UriResolver::resolve instead. - * @see UriResolver::resolve - */ - public static function resolve(UriInterface $base, $rel) - { - if (!($rel instanceof UriInterface)) { - $rel = new self($rel); - } - - return UriResolver::resolve($base, $rel); - } - - /** - * Creates a new URI with a specific query string value removed. - * - * Any existing query string values that exactly match the provided key are - * removed. - * - * @param uriInterface $uri URI to use as a base - * @param string $key query string key to remove - * - * @return UriInterface - */ - public static function withoutQueryValue(UriInterface $uri, $key) - { - $current = $uri->getQuery(); - if ('' === $current) { - return $uri; - } - - $decodedKey = rawurldecode($key); - $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { - $parts = explode('=', $part); - - return rawurldecode($parts[0]) !== $decodedKey; - }); - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a new URI with a specific query string value. - * - * Any existing query string values that exactly match the provided key are - * removed and replaced with the given key value pair. - * - * A value of null will set the query string key without a value, e.g. "key" - * instead of "key=value". - * - * @param UriInterface $uri URI to use as a base - * @param string $key key to set - * @param string|null $value Value to set - * - * @return UriInterface - */ - public static function withQueryValue(UriInterface $uri, $key, $value) - { - $current = $uri->getQuery(); - - if ('' === $current) { - $result = []; - } else { - $decodedKey = rawurldecode($key); - $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { - $parts = explode('=', $part); - - return rawurldecode($parts[0]) !== $decodedKey; - }); - } - - // Query string separators ("=", "&") within the key or value need to be encoded - // (while preventing double-encoding) before setting the query string. All other - // chars that need percent-encoding will be encoded by withQuery(). - $key = strtr($key, self::$replaceQuery); - - if (null !== $value) { - $result[] = $key.'='.strtr($value, self::$replaceQuery); - } else { - $result[] = $key; - } - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a URI from a hash of `parse_url` components. - * - * @throws \InvalidArgumentException if the components do not form a valid URI - * - * @return UriInterface - * - * @see http://php.net/manual/en/function.parse-url.php - * - */ - public static function fromParts(array $parts) - { - $uri = new self(); - $uri->applyParts($parts); - $uri->validateState(); - - return $uri; - } - - public function getScheme() - { - return $this->scheme; - } - - public function getAuthority() - { - $authority = $this->host; - if ('' !== $this->userInfo) { - $authority = $this->userInfo.'@'.$authority; - } - - if (null !== $this->port) { - $authority .= ':'.$this->port; - } - - return $authority; - } - - public function getUserInfo() - { - return $this->userInfo; - } - - public function getHost() - { - return $this->host; - } - - public function getPort() - { - return $this->port; - } - - public function getPath() - { - return $this->path; - } - - public function getQuery() - { - return $this->query; - } - - public function getFragment() - { - return $this->fragment; - } - - public function withScheme($scheme) - { - $scheme = $this->filterScheme($scheme); - - if ($this->scheme === $scheme) { - return $this; - } - - $new = clone $this; - $new->scheme = $scheme; - $new->removeDefaultPort(); - $new->validateState(); - - return $new; - } - - public function withUserInfo($user, $password = null) - { - $info = $user; - if ('' !== $password) { - $info .= ':'.$password; - } - - if ($this->userInfo === $info) { - return $this; - } - - $new = clone $this; - $new->userInfo = $info; - $new->validateState(); - - return $new; - } - - public function withHost($host) - { - $host = $this->filterHost($host); - - if ($this->host === $host) { - return $this; - } - - $new = clone $this; - $new->host = $host; - $new->validateState(); - - return $new; - } - - public function withPort($port) - { - $port = $this->filterPort($port); - - if ($this->port === $port) { - return $this; - } - - $new = clone $this; - $new->port = $port; - $new->removeDefaultPort(); - $new->validateState(); - - return $new; - } - - public function withPath($path) - { - $path = $this->filterPath($path); - - if ($this->path === $path) { - return $this; - } - - $new = clone $this; - $new->path = $path; - $new->validateState(); - - return $new; - } - - public function withQuery($query) - { - $query = $this->filterQueryAndFragment($query); - - if ($this->query === $query) { - return $this; - } - - $new = clone $this; - $new->query = $query; - - return $new; - } - - public function withFragment($fragment) - { - $fragment = $this->filterQueryAndFragment($fragment); - - if ($this->fragment === $fragment) { - return $this; - } - - $new = clone $this; - $new->fragment = $fragment; - - return $new; - } - - /** - * Apply parse_url parts to a URI. - * - * @param array $parts array of parse_url parts to apply - */ - private function applyParts(array $parts) - { - $this->scheme = isset($parts['scheme']) - ? $this->filterScheme($parts['scheme']) - : ''; - $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; - $this->host = isset($parts['host']) - ? $this->filterHost($parts['host']) - : ''; - $this->port = isset($parts['port']) - ? $this->filterPort($parts['port']) - : null; - $this->path = isset($parts['path']) - ? $this->filterPath($parts['path']) - : ''; - $this->query = isset($parts['query']) - ? $this->filterQueryAndFragment($parts['query']) - : ''; - $this->fragment = isset($parts['fragment']) - ? $this->filterQueryAndFragment($parts['fragment']) - : ''; - if (isset($parts['pass'])) { - $this->userInfo .= ':'.$parts['pass']; - } - - $this->removeDefaultPort(); - } - - /** - * @param string $scheme - * - * @throws \InvalidArgumentException if the scheme is invalid - * - * @return string - * - */ - private function filterScheme($scheme) - { - if (!is_string($scheme)) { - throw new \InvalidArgumentException('Scheme must be a string'); - } - - return mb_strtolower($scheme); - } - - /** - * @param string $host - * - * @throws \InvalidArgumentException if the host is invalid - * - * @return string - * - */ - private function filterHost($host) - { - if (!is_string($host)) { - throw new \InvalidArgumentException('Host must be a string'); - } - - return mb_strtolower($host); - } - - /** - * @param int|null $port - * - * @throws \InvalidArgumentException if the port is invalid - * - * @return int|null - * - */ - private function filterPort($port) - { - if (null === $port) { - return null; - } - - $port = (int) $port; - if (1 > $port || 0xffff < $port) { - throw new \InvalidArgumentException(sprintf('Invalid port: %d. Must be between 1 and 65535', $port)); - } - - return $port; - } - - private function removeDefaultPort() - { - if (null !== $this->port && self::isDefaultPort($this)) { - $this->port = null; - } - } - - /** - * Filters the path of a URI. - * - * @param string $path - * - * @throws \InvalidArgumentException if the path is invalid - * - * @return string - * - */ - private function filterPath($path) - { - if (!is_string($path)) { - throw new \InvalidArgumentException('Path must be a string'); - } - - return preg_replace_callback( - '/(?:[^'.self::$charUnreserved.self::$charSubDelims.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $path - ); - } - - /** - * Filters the query string or fragment of a URI. - * - * @param string $str - * - * @throws \InvalidArgumentException if the query or fragment is invalid - * - * @return string - * - */ - private function filterQueryAndFragment($str) - { - if (!is_string($str)) { - throw new \InvalidArgumentException('Query and fragment must be a string'); - } - - return preg_replace_callback( - '/(?:[^'.self::$charUnreserved.self::$charSubDelims.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $str - ); - } - - private function rawurlencodeMatchZero(array $match) - { - return rawurlencode($match[0]); - } - - private function validateState() - { - if ('' === $this->host && ('http' === $this->scheme || 'https' === $this->scheme)) { - $this->host = self::HTTP_DEFAULT_HOST; - } - - if ('' === $this->getAuthority()) { - if (0 === mb_strpos($this->path, '//')) { - throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); - } - $parts = explode('/', $this->path, 2); - if ('' === $this->scheme && false !== mb_strpos($parts[0], ':')) { - throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); - } - } elseif (isset($this->path[0]) && '/' !== $this->path[0]) { - @trigger_error( - 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI '. - 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', - E_USER_DEPRECATED - ); - $this->path = '/'.$this->path; - //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); - } - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php b/clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php deleted file mode 100644 index 048328fe60..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php +++ /dev/null @@ -1,227 +0,0 @@ -getScheme()) { - return $rel->withPath(self::removeDotSegments($rel->getPath())); - } - - if ('' !== $rel->getAuthority()) { - $targetAuthority = $rel->getAuthority(); - $targetPath = self::removeDotSegments($rel->getPath()); - $targetQuery = $rel->getQuery(); - } else { - $targetAuthority = $base->getAuthority(); - if ('' === $rel->getPath()) { - $targetPath = $base->getPath(); - $targetQuery = '' !== $rel->getQuery() ? $rel->getQuery() : $base->getQuery(); - } else { - $path = $rel->getPath(); - if ('/' === $path[0]) { - $targetPath = $rel->getPath(); - } else { - if ('' !== $targetAuthority && '' === $base->getPath()) { - $targetPath = '/'.$rel->getPath(); - } else { - $lastSlashPos = mb_strrpos($base->getPath(), '/'); - if (false === $lastSlashPos) { - $targetPath = $rel->getPath(); - } else { - $targetPath = mb_substr($base->getPath(), 0, $lastSlashPos + 1).$rel->getPath(); - } - } - } - $targetPath = self::removeDotSegments($targetPath); - $targetQuery = $rel->getQuery(); - } - } - - return new Uri(Uri::composeComponents( - $base->getScheme(), - $targetAuthority, - $targetPath, - $targetQuery, - $rel->getFragment() - )); - } - - /** - * Returns the target URI as a relative reference from the base URI. - * - * This method is the counterpart to resolve(): - * - * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) - * - * One use-case is to use the current request URI as base URI and then generate relative links in your documents - * to reduce the document size or offer self-contained downloadable document archives. - * - * $base = new Uri('http://example.com/a/b/'); - * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. - * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. - * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. - * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. - * - * This method also accepts a target that is already relative and will try to relativize it further. Only a - * relative-path reference will be returned as-is. - * - * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well - * - * @param UriInterface $base Base URI - * @param UriInterface $target Target URI - * - * @return UriInterface The relative URI reference - */ - public static function relativize(UriInterface $base, UriInterface $target) - { - if ('' !== $target->getScheme() && - ($base->getScheme() !== $target->getScheme() || '' === $target->getAuthority() && '' !== $base->getAuthority()) - ) { - return $target; - } - - if (Uri::isRelativePathReference($target)) { - // As the target is already highly relative we return it as-is. It would be possible to resolve - // the target with `$target = self::resolve($base, $target);` and then try make it more relative - // by removing a duplicate query. But let's not do that automatically. - return $target; - } - - if ('' !== $target->getAuthority() && $base->getAuthority() !== $target->getAuthority()) { - return $target->withScheme(''); - } - - // We must remove the path before removing the authority because if the path starts with two slashes, the URI - // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also - // invalid. - $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); - - if ($base->getPath() !== $target->getPath()) { - return $emptyPathUri->withPath(self::getRelativePath($base, $target)); - } - - if ($base->getQuery() === $target->getQuery()) { - // Only the target fragment is left. And it must be returned even if base and target fragment are the same. - return $emptyPathUri->withQuery(''); - } - - // If the base URI has a query but the target has none, we cannot return an empty path reference as it would - // inherit the base query component when resolving. - if ('' === $target->getQuery()) { - $segments = explode('/', $target->getPath()); - $lastSegment = end($segments); - - return $emptyPathUri->withPath('' === $lastSegment ? './' : $lastSegment); - } - - return $emptyPathUri; - } - - private static function getRelativePath(UriInterface $base, UriInterface $target) - { - $sourceSegments = explode('/', $base->getPath()); - $targetSegments = explode('/', $target->getPath()); - array_pop($sourceSegments); - $targetLastSegment = array_pop($targetSegments); - foreach ($sourceSegments as $i => $segment) { - if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { - unset($sourceSegments[$i], $targetSegments[$i]); - } else { - break; - } - } - $targetSegments[] = $targetLastSegment; - $relativePath = str_repeat('../', count($sourceSegments)).implode('/', $targetSegments); - - // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. - $pathParts = explode('/', $relativePath, 2); - if ('' === $relativePath || false !== mb_strpos($pathParts[0], ':')) { - $relativePath = "./$relativePath"; - } elseif ('/' === $relativePath[0]) { - if ('' !== $base->getAuthority() && '' === $base->getPath()) { - // In this case an extra slash is added by resolve() automatically. So we must not add one here. - $relativePath = ".$relativePath"; - } else { - $relativePath = "./$relativePath"; - } - } - - return $relativePath; - } - - private function __construct() - { - // cannot be instantiated - } -} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/functions.php b/clients/algoliasearch-client-php/lib/Http/Psr7/functions.php deleted file mode 100644 index 646e75341b..0000000000 --- a/clients/algoliasearch-client-php/lib/Http/Psr7/functions.php +++ /dev/null @@ -1,82 +0,0 @@ -valid()) { - return false; - } - $result = $resource->current(); - $resource->next(); - - return $result; - }, $options); - } elseif (method_exists($resource, '__toString')) { - return stream_for((string) $resource, $options); - } - - break; - case 'NULL': - return new Stream(fopen('php://temp', 'r+'), $options); - } - if (is_callable($resource)) { - return new PumpStream($resource, $options); - } - - throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource)); -} - -/** - * @internal - */ -function copy_to_string(StreamInterface $stream, $maxLen = -1) -{ - $buffer = ''; - if (-1 === $maxLen) { - while (!$stream->eof()) { - $buf = $stream->read(1048576); - // Using a loose equality here to match on '' and false. - if (null === $buf) { - break; - } - $buffer .= $buf; - } - - return $buffer; - } - $len = 0; - while (!$stream->eof() && $len < $maxLen) { - $buf = $stream->read($maxLen - $len); - // Using a loose equality here to match on '' and false. - if (null === $buf) { - break; - } - $buffer .= $buf; - $len = mb_strlen($buffer); - } - - return $buffer; -} diff --git a/clients/algoliasearch-client-php/lib/Log/DebugLogger.php b/clients/algoliasearch-client-php/lib/Log/DebugLogger.php deleted file mode 100644 index 61c81ff1e1..0000000000 --- a/clients/algoliasearch-client-php/lib/Log/DebugLogger.php +++ /dev/null @@ -1,57 +0,0 @@ - $level, - 'message' => $message, - 'context' => $context, - ]; - - if (function_exists('dump')) { - dump($logMessage); - } else { - var_dump($logMessage); - } - } - } -} diff --git a/clients/algoliasearch-client-php/lib/ModelInterface.php b/clients/algoliasearch-client-php/lib/ModelInterface.php deleted file mode 100644 index a9505a67e5..0000000000 --- a/clients/algoliasearch-client-php/lib/ModelInterface.php +++ /dev/null @@ -1,68 +0,0 @@ -format('Y-m-d') : $data->format(self::$dateTimeFormat); - } - - if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = self::sanitizeForSerialization($value); - } - - return $data; - } - - if (is_object($data)) { - $values = []; - if ($data instanceof ModelInterface) { - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - $callable = [$openAPIType, 'getAllowableEnumValues']; - if (is_callable($callable)) { - /** array $callable */ - $allowedEnumTypes = $callable(); - if (!in_array($value, $allowedEnumTypes, true)) { - $imploded = implode("', '", $allowedEnumTypes); - - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); - } - } - } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); - } - } - } else { - foreach ($data as $property => $value) { - $values[$property] = self::sanitizeForSerialization($value); - } - } - - return (object) $values; - } - - return (string) $data; - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param string $filename filename to be sanitized - * - * @return string the sanitized filename - */ - public static function sanitizeFilename($filename) - { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { - return $match[1]; - } - - return $filename; - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * - * @param string $value a string which will be part of the path - * - * @return string the serialized object - */ - public static function toPathValue($value) - { - return rawurlencode(self::toString($value)); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. - * - * @param string[]|string|\DateTime $object an object to be serialized to a string - * - * @return string the serialized object - */ - public static function toQueryValue($object) - { - if (is_array($object)) { - return implode(',', $object); - } - - return self::toString($object); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string $value a string which will be part of the header - * - * @return string the header string - */ - public static function toHeaderValue($value) - { - $callable = [$value, 'toHeaderValue']; - if (is_callable($callable)) { - return $callable(); - } - - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } - - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * If it's a boolean, convert it to "true" or "false". - * - * @param string|bool|\DateTime $value the value of the parameter - * - * @return string the header string - */ - public static function toString($value) - { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(self::$dateTimeFormat); - } elseif (is_bool($value)) { - return $value ? 'true' : 'false'; - } - - return $value; - } - - /** - * Serialize an array to a string. - * - * @param array $collection collection to serialize to a string - * @param string $style the format use for serialization (csv, - * ssv, tsv, pipes, multi) - * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array - * - * @return string - */ - public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) - { - if ($allowCollectionFormatMulti && ('multi' === $style)) { - // http_build_query() almost does the job for us. We just - // need to fix the result of multidimensional arrays. - return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); - } - switch ($style) { - case 'pipeDelimited': - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'spaceDelimited': - case 'ssv': - return implode(' ', $collection); - - case 'simple': - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } - } - - /** - * Deserialize a JSON string into an object - * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used - * - * @return object|array|null a single or an array of $class instances - */ - public static function deserialize($data, $class, $httpHeaders = null) - { - if (null === $data) { - return null; - } - - if (strcasecmp(mb_substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data) : $data; - - if (!is_array($data)) { - throw new \InvalidArgumentException("Invalid array '$class'"); - } - - $subClass = mb_substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - - return $values; - } - - if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array - $data = is_string($data) ? json_decode($data) : $data; - settype($data, 'array'); - $inner = mb_substr($class, 4, -1); - $deserialized = []; - if (mb_strrpos($inner, ',') !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $deserialized[$key] = self::deserialize($value, $subClass, null); - } - } - - return $deserialized; - } - - if ($class === 'object') { - settype($data, 'array'); - - return $data; - } elseif ($class === 'mixed') { - settype($data, gettype($data)); - - return $data; - } - - if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a - // date-time property. DateTime::__construct() will return - // the current time for empty input which is probably not - // what is meant. The invalid empty string is probably to - // be interpreted as a missing field/value. Let's handle - // this graceful. - if (!empty($data)) { - try { - return new \DateTime($data); - } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond - // precision for php's DateTime to handle. This conversion - // (string -> unix timestamp -> DateTime) is a workaround - // for the problem. - return (new \DateTime())->setTimestamp(strtotime($data)); - } - } else { - return null; - } - } - - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - - return $data; - } - - if (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $class::getAllowableEnumValues()); - - throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); - } - - return $data; - } - $data = is_string($data) ? json_decode($data) : $data; - // If a discriminator is defined and points to a valid subclass, use it. - $discriminator = $class::DISCRIMINATOR; - if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { - $subclass = '\Algolia\AlgoliaSearch\Model\\' . $data->{$discriminator}; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; - } - } - - /** @var ModelInterface $instance */ - $instance = new $class(); - foreach ($instance::openAPITypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; - - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { - continue; - } - - if (isset($data->{$instance::attributeMap()[$property]})) { - $propertyValue = $data->{$instance::attributeMap()[$property]}; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } - } - - return $instance; - } -} diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php deleted file mode 100644 index 45b176223c..0000000000 --- a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php +++ /dev/null @@ -1,368 +0,0 @@ -{$name} = $options[$name]; - } - } - - $this->readTimeout = $options['readTimeout']; - $this->writeTimeout = $options['writeTimeout']; - $this->connectTimeout = $options['connectTimeout']; - } - - /** - * Get the HTTP headers to add to the request. - * - * @return array List of name/value pairs - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Add a header to the list. If a value already exists for that name, it will be overwritten. - * - * @param string $name Name of the header - * @param string $value Value of the header - * - * @return $this - */ - public function addHeader($name, $value) - { - $this->headers[$name] = $value; - - return $this; - } - - /** - * @param $headers - * - * @return $this - */ - public function addHeaders($headers) - { - $this->headers = array_merge($this->headers, $headers); - - return $this; - } - - /** - * Add a new header to the list if there is no value already set. - * - * @param string $name Name of the header - * @param string $value Value of the header - * - * @return $this - */ - public function addDefaultHeader($name, $value) - { - if (!isset($this->headers[$name])) { - $this->headers[$name] = $value; - } - - return $this; - } - - /** - * Add the headers passed if the value isn't already set. - * - * @param array $headers List of header name/value pairs - * - * @return $this - */ - public function addDefaultHeaders($headers) - { - foreach ($headers as $name => $value) { - $this->addDefaultHeader($name, $value); - } - - return $this; - } - - /** - * Replace all existing headers with the given name/value pairs. - * - * @param array $headers List of header name/value pairs - * - * @return $this - */ - public function setHeaders($headers) - { - $this->headers = $headers; - - return $this; - } - - /** - * @return array List of name/value query parameters - */ - public function getQueryParameters() - { - return $this->query; - } - - /** - * @return string URL-encoded query string - */ - public function getBuiltQueryParameters() - { - return Helpers::buildQuery($this->query); - } - - /** - * Add a query parameter. If a value already exists for that name, it will be overwritten. - * - * @param string $name - * @param string $value - * - * @return $this - */ - public function addQueryParameter($name, $value) - { - $this->query[$name] = $value; - - return $this; - } - - /** - * Add a list of query parameters name/value pairs. - * If a value already exists for a name, it will be overwritten. - * - * @param $parameters - * - * @return $this - */ - public function addQueryParameters($parameters) - { - $this->query = array_merge($this->query, $parameters); - - return $this; - } - - /** - * Add a query parameter if it isn't already set. - * - * @param string $name Name of the query parameter - * @param string $value Value of the query parameter - * - * @return $this - */ - public function addDefaultQueryParameter($name, $value) - { - if (!isset($this->query[$name])) { - $this->query[$name] = $value; - } - - return $this; - } - - /** - * Add parameters if they aren't already set. - * - * @param array $queryParameters Query parameters name/value pairs - * - * @return $this - */ - public function addDefaultQueryParameters($queryParameters) - { - foreach ($queryParameters as $name => $value) { - $this->addDefaultQueryParameter($name, $value); - } - - return $this; - } - - /** - * Replace all existing query parameters with the given name/value pairs. - * - * @param array $queryParameters - * - * @return $this - */ - public function setQueryParameters($queryParameters) - { - $this->query = $queryParameters; - - return $this; - } - - /** - * Get HTTP body to add. - * - * @return array - */ - public function getBody() - { - return $this->body; - } - - /** - * Add a body parameter. If a value already exists for that name, it will be overwritten. - * - * @param string $name - * @param mixed $value - * - * @return $this - */ - public function addBodyParameter($name, $value) - { - $this->body[$name] = $value; - - return $this; - } - - /** - * Add parameters if they aren't already set. - * - * @param array $parameters Body parameters name/value pairs - * - * @return $this - */ - public function addBodyParameters($parameters) - { - $this->body = array_merge($this->body, $parameters); - - return $this; - } - - /** - * Add a body parameter if it isn't already set. - * - * @param string $name Name of the query parameter - * @param string $value Value of the query parameter - * - * @return $this - */ - public function addDefaultBodyParameter($name, $value) - { - if (!isset($this->body[$name])) { - $this->body[$name] = $value; - } - - return $this; - } - - /** - * Add parameters if they aren't already set. - * - * @param array $parameters Body parameters name/value pairs - * - * @return $this - */ - public function addDefaultBodyParameters($parameters) - { - foreach ($parameters as $name => $value) { - $this->addDefaultBodyParameter($name, $value); - } - - return $this; - } - - /** - * Replace all existing body parameters with the given name/value pairs. - * - * @param $body - * - * @return $this - */ - public function setBody($body) - { - $this->body = $body; - - return $this; - } - - /** - * Get timeout for read operations. - * - * @return int Timeout in seconds - */ - public function getReadTimeout() - { - return $this->readTimeout; - } - - /** - * Set timeout for read operations. - * - * @param int $readTimeout Timeout in seconds - * - * @return $this - */ - public function setReadTimeout($readTimeout) - { - $this->readTimeout = $readTimeout; - - return $this; - } - - /** - * Get timeout for write operations. - * - * @return int Timeout in seconds - */ - public function getWriteTimeout() - { - return $this->writeTimeout; - } - - /** - * Set timeout for write operations. - * - * @param int $writeTimeout Timeout in seconds - * - * @return $this - */ - public function setWriteTimeout($writeTimeout) - { - $this->writeTimeout = $writeTimeout; - - return $this; - } - - /** - * Get connect timeout. - * - * @return int Connect timeout in seconds - */ - public function getConnectTimeout() - { - return $this->connectTimeout; - } - - /** - * Set connect timeout. - * - * @param $connectTimeout Connect timeout in seconds - * - * @return $this - */ - public function setConnectTimeout($connectTimeout) - { - $this->connectTimeout = $connectTimeout; - - return $this; - } -} diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php deleted file mode 100644 index 5f23b630b8..0000000000 --- a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php +++ /dev/null @@ -1,134 +0,0 @@ -config = $config; - } - - /** - * @param \Algolia\AlgoliaSearch\RequestOptions\RequestOptions|array $options - * @param array $defaults - * - * @return \Algolia\AlgoliaSearch\RequestOptions\RequestOptions - */ - public function create($options, $defaults = []) - { - if (is_array($options)) { - $options += $defaults; - $options = $this->format($options); - $options = $this->normalize($options); - - $options = new RequestOptions($options); - } elseif ($options instanceof RequestOptions) { - $defaults = $this->create($defaults); - $options->addDefaultHeaders($defaults->getHeaders()); - $options->addDefaultQueryParameters($defaults->getQueryParameters()); - $options->addDefaultBodyParameters($defaults->getBody()); - } else { - throw new \InvalidArgumentException('RequestOptions can only be created from array or from RequestOptions object'); - } - - return $options->addDefaultHeaders($this->config->getDefaultHeaders()); - } - - public function createBodyLess($options, $defaults = []) - { - $options = $this->create($options, $defaults); - - return $options - ->addQueryParameters($options->getBody()) - ->setBody([]); - } - - private function normalize($options) - { - $normalized = [ - 'headers' => [ - 'X-Algolia-Application-Id' => $this->config->getAppId(), - 'X-Algolia-API-Key' => $this->config->getAlgoliaApiKey(), - 'User-Agent' => $this->config->getUserAgent() !== null ? - $this->config->getUserAgent() : - UserAgent::get(), - 'Content-Type' => 'application/json', - ], - 'query' => [], - 'body' => [], - 'readTimeout' => $this->config->getReadTimeout(), - 'writeTimeout' => $this->config->getWriteTimeout(), - 'connectTimeout' => $this->config->getConnectTimeout(), - ]; - - foreach ($options as $optionName => $value) { - $type = $this->getOptionType($optionName); - - if (in_array($type, ['readTimeout', 'writeTimeout', 'connectTimeout'], true)) { - $normalized[$type] = $value; - } else { - $normalized[$type][$optionName] = $value; - } - } - - return $normalized; - } - - private function format($options) - { - foreach ($options as $name => $value) { - if (in_array($name, ['attributesToRetrieve', 'type'], true)) { - if (is_array($value)) { - $options[$name] = implode(',', $value); - } - } - } - - return $options; - } - - private function getOptionType($optionName) - { - if ($this->isValidHeaderName($optionName)) { - return 'headers'; - } elseif (in_array($optionName, $this->validQueryParameters, true)) { - return 'query'; - } elseif (in_array($optionName, ['connectTimeout', 'readTimeout', 'writeTimeout'], true)) { - return $optionName; - } - - return 'body'; - } - - private function isValidHeaderName($name) - { - if (preg_match('/^X-[a-zA-Z-]+/', $name)) { - return true; - } - - if (in_array($name, $this->validHeaders, true)) { - return true; - } - - return false; - } -} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php deleted file mode 100644 index e008c5e32b..0000000000 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php +++ /dev/null @@ -1,263 +0,0 @@ -http = $http; - $this->clusterHosts = $clusterHosts; - $this->requestOptionsFactory = $RqstOptsFactory ?: new RequestOptionsFactory($config); - $this->logger = $logger ?: Algolia::getLogger(); - if (defined('JSON_UNESCAPED_UNICODE')) { - // `JSON_UNESCAPED_UNICODE` is introduced in PHP 5.4.0 - $this->jsonOptions = JSON_UNESCAPED_UNICODE; - } - } - - public function read($method, $path, $requestOptions = [], $defaultRequestOptions = []) - { - if ('GET' === mb_strtoupper($method)) { - $requestOptions = $this->requestOptionsFactory->createBodyLess($requestOptions, $defaultRequestOptions); - } else { - $requestOptions = $this->requestOptionsFactory->create($requestOptions, $defaultRequestOptions); - } - - return $this->request( - $method, - $path, - $requestOptions, - $this->clusterHosts->read(), - $requestOptions->getReadTimeout() - ); - } - - public function write($method, $path, $data = [], $requestOptions = [], $defaultRequestOptions = []) - { - if ('DELETE' === mb_strtoupper($method)) { - $requestOptions = $this->requestOptionsFactory->createBodyLess($requestOptions, $defaultRequestOptions); - $data = []; - } else { - $requestOptions = $this->requestOptionsFactory->create($requestOptions, $defaultRequestOptions); - } - - return $this->request( - $method, - $path, - $requestOptions, - $this->clusterHosts->write(), - $requestOptions->getWriteTimeout(), - $data - ); - } - - public function send($method, $path, $requestOptions = [], $hosts = null) - { - $requestOptions = $this->requestOptionsFactory->create($requestOptions); - - if (null === $hosts) { - $hosts = $this->clusterHosts->write(); - } elseif (!is_array($hosts)) { - $hosts = [$hosts]; - } - - return $this->request( - $method, - $path, - $requestOptions, - $hosts, - $requestOptions->getWriteTimeout() - ); - } - - private function request($method, $path, RequestOptions $requestOptions, $hosts, $timeout, $data = []) - { - $uri = $this->createUri($path) - ->withQuery($requestOptions->getBuiltQueryParameters()) - ->withScheme('https'); - - $body = array_merge($data, $requestOptions->getBody()); - - $logParams = [ - 'body' => $body, - 'headers' => $requestOptions->getHeaders(), - 'method' => $method, - 'query' => $requestOptions->getQueryParameters(), - ]; - - $retry = 1; - foreach ($hosts as $host) { - $uri = $uri->withHost($host); - $request = null; - $logParams['retryNumber'] = $retry; - $logParams['host'] = (string) $uri; - - try { - $request = $this->createRequest( - $method, - $uri, - $requestOptions->getHeaders(), - $body - ); - - $this->log(LogLevel::DEBUG, 'Sending request.', $logParams); - - $response = $this->http->sendRequest( - $request, - $timeout * $retry, - $requestOptions->getConnectTimeout() * $retry - ); - - $responseBody = $this->handleResponse($response, $request); - - $logParams['response'] = $responseBody; - $this->log(LogLevel::DEBUG, 'Response received.', $logParams); - - return $responseBody; - } catch (RetriableException $e) { - $this->log(LogLevel::DEBUG, 'Host failed.', array_merge($logParams, [ - 'description' => $e->getMessage(), - ])); - - $this->clusterHosts->failed($host); - } catch (BadRequestException $e) { - unset($logParams['body'], $logParams['headers']); - $logParams['description'] = $e->getMessage(); - $this->log(LogLevel::WARNING, 'Bad request.', $logParams); - - throw $e; - } catch (\Exception $e) { - unset($logParams['body'], $logParams['headers']); - $logParams['description'] = $e->getMessage(); - $this->log(LogLevel::ERROR, 'Generic error.', $logParams); - - throw $e; - } - - $retry++; - } - - throw new UnreachableException(); - } - - private function handleResponse(ResponseInterface $response, RequestInterface $request) - { - $body = (string) $response->getBody(); - $statusCode = $response->getStatusCode(); - - if (0 === $statusCode || ($statusCode >= 100 && $statusCode < 200) || $statusCode >= 500) { - $reason = $response->getReasonPhrase(); - - if (null === $response->getReasonPhrase() || '' === $response->getReasonPhrase()) { - $reason = $statusCode >= 500 ? 'Internal Server Error' : 'Unreachable Host'; - } - - throw new RetriableException('Retriable failure on '.$request->getUri()->getHost().': '.$reason, $statusCode); - } - - $responseArray = Helpers::json_decode($body, true); - - if (404 === $statusCode) { - throw new NotFoundException($responseArray['message'], $statusCode); - } elseif ($statusCode >= 400) { - throw new BadRequestException($responseArray['message'], $statusCode); - } elseif (2 !== (int) ($statusCode / 100)) { - throw new AlgoliaException($statusCode.': '.$body, $statusCode); - } - - return $responseArray; - } - - private function createUri($uri) - { - if ($uri instanceof UriInterface) { - return $uri; - } elseif (is_string($uri)) { - return new Uri($uri); - } - - throw new \InvalidArgumentException('URI must be a string or UriInterface'); - } - - private function createRequest( - $method, - $uri, - array $headers = [], - $body = null, - $protocolVersion = '1.1' - ) { - if (is_array($body)) { - // Send an empty body instead of "[]" in case there are - // no content/params to send - if (empty($body)) { - $body = ''; - } else { - $body = \json_encode($body, $this->jsonOptions); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new \InvalidArgumentException('json_encode error: '.json_last_error_msg()); - } - } - } - - return new Request($method, $uri, $headers, $body, $protocolVersion); - } - - /** - * @param string $level - * @param string $message - */ - private function log($level, $message, array $context = []) - { - $this->logger->log($level, 'Algolia API client: '.$message, $context); - } -} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php deleted file mode 100644 index 9d2ba6f822..0000000000 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -read = $read; - $this->write = $write; - } - - public static function create($read, $write = null) - { - if (null === $write) { - $write = $read; - } - - if (is_string($read)) { - $read = [$read => 0]; - } - - if (is_string($write)) { - $write = [$write => 0]; - } - - if (array_values($read) === $read) { - $read = array_fill_keys($read, 0); - } - - if (array_values($write) === $write) { - $write = array_fill_keys($write, 0); - } - - return new static(HostCollection::create($read), HostCollection::create($write)); - } - - public static function createFromAppId($applicationId) - { - $read = $write = [ - $applicationId.'-1.algolianet.com' => 0, - $applicationId.'-2.algolianet.com' => 0, - $applicationId.'-3.algolianet.com' => 0, - ]; - - $read[$applicationId.'-dsn.algolia.net'] = 10; - $write[$applicationId.'.algolia.net'] = 10; - - return static::create($read, $write); - } - - public static function createFromCache($cacheKey) - { - if (!Algolia::isCacheEnabled()) { - return false; - } - - if (!Algolia::getCache()->has($cacheKey)) { - return false; - } - - return @unserialize(Algolia::getCache()->get($cacheKey)); - } - - public function read() - { - return $this->getUrls('read'); - } - - public function write() - { - return $this->getUrls('write'); - } - - public function failed($host) - { - $this->read->markAsDown($host); - $this->write->markAsDown($host); - - $this->updateCache(); - - return $this; - } - - public function reset() - { - $this->read->reset(); - $this->write->reset(); - - return $this; - } - - public function shuffle() - { - $this->read->shuffle(); - $this->write->shuffle(); - - return $this; - } - - /** - * Sets the cache key to save the state of the ClusterHosts. - * - * @param string $cacheKey - * - * @return $this - */ - public function setCacheKey($cacheKey) - { - $this->cacheKey = $cacheKey; - - return $this; - } - - private function getUrls($type) - { - $urls = $this->{$type}->getUrls(); - $lashHashName = 'last'.ucfirst($type).'Hash'; - - if (Algolia::isCacheEnabled()) { - $hash = sha1(implode('-', $urls)); - if ($hash !== $this->{$lashHashName}) { - $this->updateCache(); - } - $this->{$lashHashName} = $hash; - } - - return $urls; - } - - private function updateCache() - { - if (null !== $this->cacheKey && Algolia::isCacheEnabled()) { - Algolia::getCache()->set($this->cacheKey, serialize($this)); - } - } -} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/Host.php b/clients/algoliasearch-client-php/lib/RetryStrategy/Host.php deleted file mode 100644 index d7685487ce..0000000000 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/Host.php +++ /dev/null @@ -1,65 +0,0 @@ -url = $url; - $this->priority = $priority; - } - - public function getUrl() - { - return $this->url; - } - - public function getPriority() - { - return $this->priority; - } - - public function isUp() - { - if (!$this->up) { - $this->resetIfExpired(); - } - - return $this->up; - } - - public function markAsDown() - { - $this->up = false; - $this->lastCheck = time(); - } - - public function reset() - { - $this->up = true; - $this->lastCheck = null; - } - - private function resetIfExpired() - { - $expired = $this->lastCheck + self::TTL < time(); - - if ($expired) { - $this->reset(); - } - } -} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php b/clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php deleted file mode 100644 index 1f2c76d220..0000000000 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php +++ /dev/null @@ -1,85 +0,0 @@ -hosts = $hosts; - - $this->shuffle(); - } - - public static function create(array $urlsWithPriority) - { - $hosts = []; - foreach ($urlsWithPriority as $url => $priority) { - $hosts[] = new Host($url, $priority); - } - - return new static($hosts); - } - - public function get() - { - // We pass the result through array_values because sometimes - // we need to make sure you can access the first element - // via $result[0] - return array_values(array_filter($this->hosts, function (Host $host) { - return $host->isUp(); - })); - } - - public function getUrls() - { - return array_map(function (Host $host) { - return $host->getUrl(); - }, $this->get()); - } - - public function markAsDown($hostKey) - { - array_map(function (Host $host) use ($hostKey) { - if ($host->getUrl() === $hostKey) { - $host->markAsDown(); - } - }, $this->hosts); - } - - public function shuffle() - { - if (shuffle($this->hosts)) { - $this->sort(); - } - - return $this; - } - - public function reset() - { - foreach ($this->hosts as $host) { - $host->reset(); - } - - return $this; - } - - private function sort() - { - usort($this->hosts, function (Host $a, Host $b) { - $prioA = $a->getPriority(); - $prioB = $b->getPriority(); - if ($prioA === $prioB) { - return 0; - } - - return ($prioA > $prioB) ? -1 : 1; - }); - } -} diff --git a/clients/algoliasearch-client-php/lib/Support/Helpers.php b/clients/algoliasearch-client-php/lib/Support/Helpers.php deleted file mode 100644 index 33716920e4..0000000000 --- a/clients/algoliasearch-client-php/lib/Support/Helpers.php +++ /dev/null @@ -1,62 +0,0 @@ - ['one', 'two']] is - * turned into key[1]=one&key[2]=two. Algolia will not understand key[x]. - * It should be turned into key=['one','two'] (before being url_encoded). - * - * @return string The urlencoded query string to send to Algolia - */ - public static function buildQuery(array $args) - { - if (!$args) { - return ''; - } - - $args = array_map(function ($value) { - if (is_array($value)) { - return json_encode($value); - } elseif (is_bool($value)) { - return $value ? 'true' : 'false'; - } - - return $value; - }, $args); - - return http_build_query($args); - } - - /** - * Wrapper for json_decode that throws when an error occurs. - * - * This function is extracted from Guzzlehttp/Guzzle package which is not - * compatible with PHP 5.3 so the client cannot always use it. - * - * @param string $json JSON data to parse - * @param bool $assoc when true, returned objects will be converted - * into associative arrays - * @param int $depth user specified recursion depth - * - * @throws \InvalidArgumentException if the JSON cannot be decoded - * - * @return mixed - * - * @see http://www.php.net/manual/en/function.json-decode.php - */ - public static function json_decode($json, $assoc = false, $depth = 512) - { - $data = \json_decode($json, $assoc, $depth); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new \InvalidArgumentException('json_decode error: '.json_last_error_msg()); - } - - return $data; - } -} diff --git a/clients/algoliasearch-client-php/lib/Support/UserAgent.php b/clients/algoliasearch-client-php/lib/Support/UserAgent.php deleted file mode 100644 index 6be12e5f53..0000000000 --- a/clients/algoliasearch-client-php/lib/Support/UserAgent.php +++ /dev/null @@ -1,59 +0,0 @@ - $version) { - $ua[] = $segment.' ('.$version.')'; - } - - return implode('; ', $ua); - } - - private static function getDefaultSegments() - { - $segments = []; - - $segments['Algolia for PHP'] = Algolia::VERSION; - $segments['PHP'] = rtrim(str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION), '-'); - if (defined('HHVM_VERSION')) { - $segments['HHVM'] = HHVM_VERSION; - } - if (interface_exists('\GuzzleHttp\ClientInterface')) { - if (defined('\GuzzleHttp\ClientInterface::VERSION')) { - $segments['Guzzle'] = \GuzzleHttp\ClientInterface::VERSION; - } else { - $segments['Guzzle'] = \GuzzleHttp\ClientInterface::MAJOR_VERSION; - } - } - - return $segments; - } -} diff --git a/clients/algoliasearch-client-php/phpunit.xml.dist b/clients/algoliasearch-client-php/phpunit.xml.dist deleted file mode 100644 index 5221417220..0000000000 --- a/clients/algoliasearch-client-php/phpunit.xml.dist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - ../../tests/output/php/src/ - - - From 8c720994bb26ae1066ab09acecf440e602f291f2 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Fri, 25 Feb 2022 15:14:43 +0100 Subject: [PATCH 20/69] chore(ci): set up real submodules --- .gitmodules | 9 ++++ clients/algoliasearch-client-java-2 | 1 + clients/algoliasearch-client-javascript | 1 + clients/algoliasearch-client-php | 1 + docs/submodules.md | 67 +++++++++++++++++++++++++ 5 files changed, 79 insertions(+) create mode 160000 clients/algoliasearch-client-java-2 create mode 160000 clients/algoliasearch-client-javascript create mode 160000 clients/algoliasearch-client-php create mode 100644 docs/submodules.md diff --git a/.gitmodules b/.gitmodules index e69de29bb2..d6d0b69eb9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "clients/algoliasearch-client-javascript"] + path = clients/algoliasearch-client-javascript + url = git@github.com:algolia/algoliasearch-client-javascript.git +[submodule "clients/algoliasearch-client-java-2"] + path = clients/algoliasearch-client-java-2 + url = git@github.com:algolia/algoliasearch-client-java-2.git +[submodule "clients/algoliasearch-client-php"] + path = clients/algoliasearch-client-php + url = git@github.com:algolia/algoliasearch-client-php.git diff --git a/clients/algoliasearch-client-java-2 b/clients/algoliasearch-client-java-2 new file mode 160000 index 0000000000..0af7adf44e --- /dev/null +++ b/clients/algoliasearch-client-java-2 @@ -0,0 +1 @@ +Subproject commit 0af7adf44e04b80738767827259194bf2b222015 diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript new file mode 160000 index 0000000000..326c833501 --- /dev/null +++ b/clients/algoliasearch-client-javascript @@ -0,0 +1 @@ +Subproject commit 326c833501a2e9837b45032b5d703cbf4860936f diff --git a/clients/algoliasearch-client-php b/clients/algoliasearch-client-php new file mode 160000 index 0000000000..8d78421f83 --- /dev/null +++ b/clients/algoliasearch-client-php @@ -0,0 +1 @@ +Subproject commit 8d78421f831b31868506e429828935c4dd1a0f23 diff --git a/docs/submodules.md b/docs/submodules.md new file mode 100644 index 0000000000..becc3e7bed --- /dev/null +++ b/docs/submodules.md @@ -0,0 +1,67 @@ +## Add a submodule + +```sh +git submodule add git@github.com:algolia/algoliasearch-client-javascript.git clients/algoliasearch-client-javascript + +(cd clients/algoliasearch-client-javascript && git checkout -b next) + +git add clients/algoliasearch-client-javascript +git commit -m "chore: add submodule" +``` + +## How to modify the content of a submodule manually + +This repository does not include the actual repository of the submodule. It's just a reference. + +```sh +cd clients/algoliasearch-client-javascript +``` + +You need to checkout to a specific branch, because it's normally detached. + +```sh +git checkout next +``` + +Then modify something and push to its origin. + +```sh +vi README.md +... +git add README.md +git commit -m "docs: update README.md" +git push origin next +``` + +Then come back to the root directory, and you will see a change. + +```sh +cd ../../ +git status +``` + +``` +Changes to be committed: + (use "git restore --staged ..." to unstage) + modified: clients/algoliasearch-client-javascript +``` + +It means the reference (SHA) needs to change. + +```sh +git add clients/algoliasearch-client-javascript +git commit -m "chore: update submodule" +git push +``` + +## How to ignore the change of a submodule + +If you generated API clients locally and want to remove the change from `git status`, + +go to the directory, clean up, and check out to the proper branch. + +```sh +cd clients/algoliasearch-client-javascript +git reset --hard HEAD +git checkout next +``` From d44abef1d70a17292a78389df9fb9ee3287aa60f Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Fri, 25 Feb 2022 15:35:32 +0100 Subject: [PATCH 21/69] chore: re-apply changes --- scripts/release/process-release.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index e95fa565fa..069685c41a 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -61,7 +61,7 @@ async function processRelease(): Promise { const result = line.match(/- \[ \] (.+): v(.+) -> v(.+)/); return result?.[1]; }) - .filter(Boolean); // e.g. ['javascript', 'php'] + .filter(Boolean) as string[]; // e.g. ['javascript', 'php'] // update versions in `openapitools.json` Object.keys(openapitools['generator-cli'].generators).forEach((client) => { @@ -96,14 +96,15 @@ async function processRelease(): Promise { } ); + await run('git config user.name "api-clients-bot"'); + await run('git config user.email "bot@algolia.com"'); + // commit openapitools and changelogs if (process.env.RELEASE_TEST !== 'true') { - await run('git config user.name "api-clients-bot"'); - await run('git config user.email "bot@algolia.com"'); await run('git add openapitools.json'); await run('git add doc/changelogs/*'); execa.sync('git', ['commit', '-m', TEXT.commitMessage]); - await run(`git push origin ${MAIN_BRANCH}`); + await run(`git push`); } // generate clients to release @@ -121,21 +122,21 @@ async function processRelease(): Promise { const clientPath = toAbsolutePath( 'clients/dummy-algoliasearch-client-javascript' ); - const runInClient = (command: string, options = {}): Promise => - run(command, { - cwd: clientPath, - ...options, - }); - await runInClient(`git checkout next`); + await run(`git checkout next`, { cwd: clientPath }); + await run(`git pull origin next`, { cwd: clientPath }); await run( `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript` ); - await runInClient(`git add .`); + await run(`git add .`, { cwd: clientPath }); execa.sync('git', ['commit', '-m', 'chore: release test'], { cwd: clientPath, }); - await runInClient(`git push origin next`); + await run(`git push origin next`, { cwd: clientPath }); + + await run(`git add clients/dummy-algoliasearch-client-javascript`); + execa.sync('git', ['commit', '-m', 'chore: update submodules']); + await run(`git push`); } processRelease(); From ba264f61d33fb72cd205bc2a6e6e6ed2ce8e2c7a Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Fri, 25 Feb 2022 16:41:03 +0100 Subject: [PATCH 22/69] chore: support real submodules --- docs/changelogs/java.md | 0 docs/changelogs/javascript.md | 0 docs/changelogs/php.md | 0 release.config.json | 8 +- scripts/common.ts | 12 +++ scripts/release/common.ts | 4 + scripts/release/process-release.ts | 126 +++++++++++++++++------------ scripts/release/text.ts | 2 +- 8 files changed, 97 insertions(+), 55 deletions(-) delete mode 100644 docs/changelogs/java.md delete mode 100644 docs/changelogs/javascript.md delete mode 100644 docs/changelogs/php.md diff --git a/docs/changelogs/java.md b/docs/changelogs/java.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docs/changelogs/javascript.md b/docs/changelogs/javascript.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docs/changelogs/php.md b/docs/changelogs/php.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/release.config.json b/release.config.json index c37c9064e6..3365f5d02f 100644 --- a/release.config.json +++ b/release.config.json @@ -2,5 +2,11 @@ "releasedTag": "released", "mainBranch": "main", "owner": "algolia", - "repo": "api-clients-automation" + "repo": "api-clients-automation", + "targetBranch": { + "javascript": "next", + "php": "next", + "java": "next" + }, + "defaultTargetBranch": "next" } diff --git a/scripts/common.ts b/scripts/common.ts index 41dcf7643d..e5b92afe81 100644 --- a/scripts/common.ts +++ b/scripts/common.ts @@ -38,6 +38,18 @@ export function splitGeneratorKey(generatorKey: string): Generator { return { language, client, key: generatorKey }; } +export function getGitHubUrl(lang: string): string { + const entry = Object.entries(openapitools['generator-cli'].generators).find( + (_entry) => _entry[0].startsWith(`${lang}-`) + ); + + if (!entry) { + throw new Error(`\`${lang}\` is not found from \`openapitools.json\`.`); + } + const { gitHost, gitRepoId } = entry[1]; + return `https://github.com/${gitHost}/${gitRepoId}`; +} + export function createGeneratorKey({ language, client, diff --git a/scripts/release/common.ts b/scripts/release/common.ts index 61d154dcf0..a112debcb7 100644 --- a/scripts/release/common.ts +++ b/scripts/release/common.ts @@ -5,6 +5,10 @@ export const MAIN_BRANCH = config.mainBranch; export const OWNER = config.owner; export const REPO = config.repo; +export function getTargetBranch(language: string): string { + return config.targetBranch[language] || config.defaultTargetBranch; +} + export function getMarkdownSection(markdown: string, title: string): string { const levelIndicator = title.split(' ')[0]; // e.g. `##` const lines = markdown diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 069685c41a..31e01ea1a2 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -1,13 +1,14 @@ /* eslint-disable no-console */ -import fs from 'fs'; +import fsp from 'fs/promises'; import dotenv from 'dotenv'; import execa from 'execa'; +import clientsConfig from '../../clients.config.json'; import openapitools from '../../openapitools.json'; -import { toAbsolutePath, run } from '../common'; +import { toAbsolutePath, run, exists, getGitHubUrl } from '../common'; -import { MAIN_BRANCH, OWNER, REPO, getMarkdownSection } from './common'; +import { OWNER, REPO, getMarkdownSection, getTargetBranch } from './common'; import TEXT from './text'; dotenv.config(); @@ -37,7 +38,12 @@ async function processRelease(): Promise { throw new Error('The issue was not approved.'); } - const versionsToRelease = {}; + const versionsToRelease: { + [lang: string]: { + current: string; + next: string; + }; + } = {}; getMarkdownSection(issueBody, TEXT.versionChangeHeader) .split('\n') .forEach((line) => { @@ -72,70 +78,84 @@ async function processRelease(): Promise { ].additionalProperties.packageVersion = versionsToRelease[lang].next; } }); - fs.writeFileSync( + await fsp.writeFile( toAbsolutePath('openapitools.json'), JSON.stringify(openapitools, null, 2) ); - // update changelogs - new Set([...Object.keys(versionsToRelease), ...langsToUpdateRepo]).forEach( - (lang) => { - const filePath = toAbsolutePath(`docs/changelogs/${lang}.md`); - const header = versionsToRelease[lang!] - ? `## ${versionsToRelease[lang!].next}` - : `## ${new Date().toISOString().split('T')[0]}`; - const newChangelog = getMarkdownSection( - getMarkdownSection(issueBody, TEXT.changelogHeader), - `### ${lang}` - ); - const existingContent = fs.readFileSync(filePath).toString(); - fs.writeFileSync( - filePath, - [header, newChangelog, existingContent].join('\n\n') - ); - } - ); - await run('git config user.name "api-clients-bot"'); await run('git config user.email "bot@algolia.com"'); // commit openapitools and changelogs - if (process.env.RELEASE_TEST !== 'true') { - await run('git add openapitools.json'); - await run('git add doc/changelogs/*'); - execa.sync('git', ['commit', '-m', TEXT.commitMessage]); - await run(`git push`); - } + await run('git add openapitools.json'); + + const langsToReleaseOrUpdate = [ + ...Object.keys(versionsToRelease), + ...langsToUpdateRepo, + ]; + + for (const lang of langsToReleaseOrUpdate) { + const goal = versionsToRelease[lang] ? 'release' : 'update'; + + // prepare the submodule + const clientPath = toAbsolutePath(`clients/${clientsConfig[lang].folder}`); + const targetBranch = getTargetBranch(lang); + await run(`git checkout ${targetBranch}`, { cwd: clientPath }); + await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); - // generate clients to release - for (const lang of Object.keys(versionsToRelease)) { console.log(`Generating ${lang} client(s)...`); await run(`yarn cli generate ${lang}`); - } - // generate clients to just update the repos - for (const lang of langsToUpdateRepo) { - console.log(`Generating ${lang} client(s)...`); - await run(`yarn cli generate ${lang}`, { verbose: true }); - } + const dateStamp = new Date().toISOString().split('T')[0]; + const currentVersion = versionsToRelease[lang].current; + const nextVersion = versionsToRelease[lang].next; + + // update changelog + const changelogPath = toAbsolutePath( + `clients/${clientsConfig[lang].folder}/CHANGELOG.md` + ); + const existingContent = (await exists(changelogPath)) + ? (await fsp.readFile(changelogPath)).toString() + : ''; + const changelogHeader = + goal === 'release' + ? `## [v${nextVersion}](${getGitHubUrl( + lang + )}/compare/v${currentVersion}...v${nextVersion})` + : `## ${dateStamp}`; + const newChangelog = getMarkdownSection( + getMarkdownSection(issueBody, TEXT.changelogHeader), + `### ${lang}` + ); + await fsp.writeFile( + changelogPath, + [changelogHeader, newChangelog, existingContent].join('\n\n') + ); + + // commit changelog and the generated client + await run(`git add .`, { cwd: clientPath }); + if (goal === 'release') { + await execa('git', ['commit', '-m', `chore: release ${nextVersion}`], { + cwd: clientPath, + }); + await execa('git', ['tag', `v${nextVersion}`], { cwd: clientPath }); + } else { + await execa('git', ['commit', '-m', `chore: update repo ${dateStamp}`], { + cwd: clientPath, + }); + } - const clientPath = toAbsolutePath( - 'clients/dummy-algoliasearch-client-javascript' - ); + // push the commit to the submodule + await run(`git push origin ${targetBranch}`, { cwd: clientPath }); + if (goal === 'release') { + await execa('git', ['push', '--tags'], { cwd: clientPath }); + } - await run(`git checkout next`, { cwd: clientPath }); - await run(`git pull origin next`, { cwd: clientPath }); - await run( - `cp -r clients/algoliasearch-client-javascript/ clients/dummy-algoliasearch-client-javascript` - ); - await run(`git add .`, { cwd: clientPath }); - execa.sync('git', ['commit', '-m', 'chore: release test'], { - cwd: clientPath, - }); - await run(`git push origin next`, { cwd: clientPath }); + // add the new reference of the submodule in the monorepo + await run(`git add clients/${clientsConfig[lang].folder}`); + } - await run(`git add clients/dummy-algoliasearch-client-javascript`); - execa.sync('git', ['commit', '-m', 'chore: update submodules']); + await execa('git', ['commit', '-m', TEXT.commitMessage]); await run(`git push`); } diff --git a/scripts/release/text.ts b/scripts/release/text.ts index 9dfccb3ec5..90bea1df1b 100644 --- a/scripts/release/text.ts +++ b/scripts/release/text.ts @@ -25,5 +25,5 @@ export default { `- [ ] ${APPROVED}`, ].join('\n'), - commitMessage: `chore: update versions and changelogs`, + commitMessage: `chore: update versions and submodules`, }; From fd286ee45e094ba2bb11eebce554113a88263ad6 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Fri, 25 Feb 2022 16:56:20 +0100 Subject: [PATCH 23/69] chore: update released tag --- scripts/release/process-release.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 31e01ea1a2..a682b7ff03 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -8,7 +8,13 @@ import clientsConfig from '../../clients.config.json'; import openapitools from '../../openapitools.json'; import { toAbsolutePath, run, exists, getGitHubUrl } from '../common'; -import { OWNER, REPO, getMarkdownSection, getTargetBranch } from './common'; +import { + RELEASED_TAG, + OWNER, + REPO, + getMarkdownSection, + getTargetBranch, +} from './common'; import TEXT from './text'; dotenv.config(); @@ -148,7 +154,7 @@ async function processRelease(): Promise { // push the commit to the submodule await run(`git push origin ${targetBranch}`, { cwd: clientPath }); if (goal === 'release') { - await execa('git', ['push', '--tags'], { cwd: clientPath }); + await run('git push --tags', { cwd: clientPath }); } // add the new reference of the submodule in the monorepo @@ -157,6 +163,14 @@ async function processRelease(): Promise { await execa('git', ['commit', '-m', TEXT.commitMessage]); await run(`git push`); + + // remove old `released` tag + await run(`git tag -d ${RELEASED_TAG}`); + await run(`git push --delete origin ${RELEASED_TAG}`); + + // create new `released` tag + await run(`git tag released`); + await run(`git push --tags`); } processRelease(); From 19a569e38c934e4886837990f0f41eb716d9dfe8 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 14:38:11 +0100 Subject: [PATCH 24/69] docs: update submodules.md --- docs/submodules.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/submodules.md b/docs/submodules.md index becc3e7bed..ff81968276 100644 --- a/docs/submodules.md +++ b/docs/submodules.md @@ -65,3 +65,9 @@ cd clients/algoliasearch-client-javascript git reset --hard HEAD git checkout next ``` + +## Troubleshootings + +### When something is weird, + +Try `git submodule update` first. From 6897e1981c3727bd8f0919ba5e01672be45b591b Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 15:03:39 +0100 Subject: [PATCH 25/69] chore: update reference to js client --- clients/algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript index 326c833501..11c61823cc 160000 --- a/clients/algoliasearch-client-javascript +++ b/clients/algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 326c833501a2e9837b45032b5d703cbf4860936f +Subproject commit 11c61823cc91b2025da1a6c086c598db6421032e From 78364326b3122b8b2210e79cdbef3d43ba58eb48 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 15:04:41 +0100 Subject: [PATCH 26/69] chore: update workspace config --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d76fc72c0..1f72873279 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@algolia/api-client-automation", "version": "0.0.0", "workspaces": [ - "clients/algoliasearch-client-javascript/", + "clients/algoliasearch-client-javascript-*/packages/*", "playground/javascript/node/", "playground/javascript/browser/", "scripts/", From 8f3287cecebbd5961ae3f59568362a2ca6677f99 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 15:11:26 +0100 Subject: [PATCH 27/69] chore: update issue template --- scripts/release/create-release-issue.ts | 3 ++- scripts/release/text.ts | 13 ++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/release/create-release-issue.ts b/scripts/release/create-release-issue.ts index d425a2597f..a886697455 100755 --- a/scripts/release/create-release-issue.ts +++ b/scripts/release/create-release-issue.ts @@ -169,7 +169,7 @@ async function createReleaseIssue(): Promise { const checked = skipRelease ? ' ' : 'x'; return [ `- [${checked}] ${langName}: v${current} -> v${next}`, - skipRelease && TEXT.descriptionForSkippedLang(langName), + skipRelease && TEXT.descriptionForSkippedLang, ] .filter(Boolean) .join('\n'); @@ -196,6 +196,7 @@ async function createReleaseIssue(): Promise { TEXT.header, TEXT.versionChangeHeader, versionChanges, + TEXT.descriptionVersionChanges, TEXT.changelogHeader, TEXT.changelogDescription, changelogs, diff --git a/scripts/release/text.ts b/scripts/release/text.ts index 90bea1df1b..22161a697d 100644 --- a/scripts/release/text.ts +++ b/scripts/release/text.ts @@ -6,13 +6,12 @@ export default { versionChangeHeader: `## Version Changes`, noCommit: `no commit`, currentVersionNotFound: `current version not found`, - descriptionForSkippedLang: (langName: string): string => - [ - ` - No \`feat\` or \`fix\` commit, thus unchecked by default.`, - ` - **Checked** → Update version, update ${langName} repository, and release the library.`, - ` - **Unchecked** → Update ${langName} repository.`, - ` - **Line removed** → Do nothing.`, - ].join('\n'), + descriptionVersionChanges: [ + `**Checked** → Update version, update repository, and release the library.`, + `**Unchecked** → Update repository.`, + `**Line removed** → Do nothing.`, + ].join('\n'), + descriptionForSkippedLang: ` - No \`feat\` or \`fix\` commit, thus unchecked by default.`, changelogHeader: `## CHANGELOG`, changelogDescription: `Update the following lines. Once merged, it will be reflected to \`docs/changelogs/*.\``, From 9ff4a378fd874c42942c0b5cc4a6535400286737 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 15:13:24 +0100 Subject: [PATCH 28/69] chore: update issue template --- scripts/release/text.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/text.ts b/scripts/release/text.ts index 22161a697d..ce568b3d21 100644 --- a/scripts/release/text.ts +++ b/scripts/release/text.ts @@ -8,7 +8,7 @@ export default { currentVersionNotFound: `current version not found`, descriptionVersionChanges: [ `**Checked** → Update version, update repository, and release the library.`, - `**Unchecked** → Update repository.`, + `**Un-checked** → Update repository.`, `**Line removed** → Do nothing.`, ].join('\n'), descriptionForSkippedLang: ` - No \`feat\` or \`fix\` commit, thus unchecked by default.`, From 6f19e5ce5e5c90eb10fdbbb1237b2506acc2260d Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 15:19:48 +0100 Subject: [PATCH 29/69] chore: update submodule after checking out --- .github/workflows/process-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index 4189d0682d..3ee24ccec3 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -22,6 +22,8 @@ jobs: - run: git checkout chore/release + - run: git submodule update + - name: Setup id: setup uses: ./.github/actions/setup From f16b5bca3d2d53bab7879240aa7d00a84b3fc2b5 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 15:41:25 +0100 Subject: [PATCH 30/69] chore: fix script --- scripts/release/create-release-issue.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release/create-release-issue.ts b/scripts/release/create-release-issue.ts index a886697455..e992999551 100755 --- a/scripts/release/create-release-issue.ts +++ b/scripts/release/create-release-issue.ts @@ -62,10 +62,10 @@ async function createReleaseIssue(): Promise { const versions = readVersions(); console.log('Pulling from origin...'); - run(`git pull origin ${MAIN_BRANCH}`); + run(`git pull`); console.log('Pushing to origin...'); - run(`git push origin ${MAIN_BRANCH}`); + run(`git push`); const commitsWithoutScope: string[] = []; const commitsWithNonLanguageScope: string[] = []; From ad712943ccdd69633487557c8e8bcab6a55ca635 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 16:10:25 +0100 Subject: [PATCH 31/69] chore: update reference to js client --- clients/algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript index 11c61823cc..f91f443b07 160000 --- a/clients/algoliasearch-client-javascript +++ b/clients/algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 11c61823cc91b2025da1a6c086c598db6421032e +Subproject commit f91f443b071d10f62059a2fcc1b6a54556cc8d6b From 7e8f2061c3af639d549f5c7bfca4c538cb660e11 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 16:24:43 +0100 Subject: [PATCH 32/69] chore: update yarn workspace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f72873279..0d76fc72c0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@algolia/api-client-automation", "version": "0.0.0", "workspaces": [ - "clients/algoliasearch-client-javascript-*/packages/*", + "clients/algoliasearch-client-javascript/", "playground/javascript/node/", "playground/javascript/browser/", "scripts/", From 216bb066aa7c99e575f49bdfba0d4cedfa137f99 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Feb 2022 16:36:21 +0100 Subject: [PATCH 33/69] chore: update reference to js client --- clients/algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript index f91f443b07..e0af272a75 160000 --- a/clients/algoliasearch-client-javascript +++ b/clients/algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit f91f443b071d10f62059a2fcc1b6a54556cc8d6b +Subproject commit e0af272a75796a97b0147fe2bf0e3655c676e830 From 7e46818d916d37111c2bb2b37c0e792f98fd6447 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 11:25:31 +0100 Subject: [PATCH 34/69] docs: update guide --- docs/submodules.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/submodules.md b/docs/submodules.md index ff81968276..f98d02ae92 100644 --- a/docs/submodules.md +++ b/docs/submodules.md @@ -66,6 +66,10 @@ git reset --hard HEAD git checkout next ``` +## How to remove a submodule from the monorepo + +https://stackoverflow.com/a/1260982 + ## Troubleshootings ### When something is weird, From 089b2665e4f2187f5de76be5d6fc5df6cf622145 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 15:56:52 +0100 Subject: [PATCH 35/69] chore: update submodule --- .../package.json | 2 +- .../package.json~main | 38 --- .../rollup.config.js | 10 +- .../rollup.config.js~main | 249 ------------------ 4 files changed, 6 insertions(+), 293 deletions(-) delete mode 100644 clients/algoliasearch-client-javascript/package.json~main delete mode 100644 clients/algoliasearch-client-javascript/rollup.config.js~main diff --git a/clients/algoliasearch-client-javascript/package.json b/clients/algoliasearch-client-javascript/package.json index 69cd7909f4..a937006c9b 100644 --- a/clients/algoliasearch-client-javascript/package.json +++ b/clients/algoliasearch-client-javascript/package.json @@ -6,7 +6,7 @@ ], "private": true, "scripts": { - "build:utils": "UTILS=${0:-all} yarn rollup -c rollup.config.js", + "build:utils": "yarn build client-common && yarn build requester-browser-xhr && yarn build requester-node-http", "build": "CLIENT=${0:-all} yarn rollup -c rollup.config.js", "clean:utils": "yarn workspace @algolia/client-common clean && yarn workspace @algolia/requester-node-http clean && yarn workspace @algolia/requester-browser-xhr clean", "clean": "rm -rf packages/*/dist", diff --git a/clients/algoliasearch-client-javascript/package.json~main b/clients/algoliasearch-client-javascript/package.json~main deleted file mode 100644 index a937006c9b..0000000000 --- a/clients/algoliasearch-client-javascript/package.json~main +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "algoliasearch-client-javascript", - "version": "5.0.0", - "workspaces": [ - "packages/*" - ], - "private": true, - "scripts": { - "build:utils": "yarn build client-common && yarn build requester-browser-xhr && yarn build requester-node-http", - "build": "CLIENT=${0:-all} yarn rollup -c rollup.config.js", - "clean:utils": "yarn workspace @algolia/client-common clean && yarn workspace @algolia/requester-node-http clean && yarn workspace @algolia/requester-browser-xhr clean", - "clean": "rm -rf packages/*/dist", - "release": "shipjs prepare", - "test:size": "bundlesize", - "test:lint": "eslint . --ext .js,.ts", - "test:types": "yarn tsc --noEmit" - }, - "devDependencies": { - "@babel/core": "7.17.2", - "@babel/plugin-transform-runtime": "7.17.0", - "@babel/preset-env": "7.16.11", - "@babel/runtime": "7.17.2", - "@rollup/plugin-babel": "5.3.0", - "@rollup/plugin-node-resolve": "13.1.3", - "@types/rollup-plugin-node-globals": "1.4.1", - "bundlesize": "0.18.1", - "rollup": "2.67.1", - "rollup-plugin-filesize": "9.1.2", - "rollup-plugin-node-globals": "1.4.0", - "rollup-plugin-terser": "7.0.2", - "rollup-plugin-typescript2": "0.31.2", - "typescript": "4.5.4" - }, - "engines": { - "node": "^14.0.0", - "yarn": "^3.0.0" - } -} diff --git a/clients/algoliasearch-client-javascript/rollup.config.js b/clients/algoliasearch-client-javascript/rollup.config.js index 2cc39059bd..c00d3528bb 100644 --- a/clients/algoliasearch-client-javascript/rollup.config.js +++ b/clients/algoliasearch-client-javascript/rollup.config.js @@ -9,11 +9,11 @@ import ts from 'rollup-plugin-typescript2'; import generatorConfig from '../../openapitools.json'; -import { version } from './packages/algoliasearch/package.json'; +import { version } from './version'; // Retrieve package to build const client = process.env.CLIENT?.replace('@algolia/', ''); -const utils = process.env.UTILS; +const UTILS = ['client-common', 'requester-browser-xhr', 'requester-node-http']; function createLicence(name) { return `/*! ${name}.umd.js | ${version} | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */`; @@ -64,7 +64,7 @@ function getAvailableClients() { } function initPackagesConfig() { - if (utils) { + if (UTILS.includes(client)) { const commonOptions = { input: 'index.ts', formats: ['cjs-node', 'esm-node'], @@ -100,10 +100,10 @@ function initPackagesConfig() { }, ]; - return utils === 'all' + return client === 'all' ? availableUtils : availableUtils.filter( - (availableUtil) => availableUtil.package === utils + (availableUtil) => availableUtil.package === client ); } diff --git a/clients/algoliasearch-client-javascript/rollup.config.js~main b/clients/algoliasearch-client-javascript/rollup.config.js~main deleted file mode 100644 index c00d3528bb..0000000000 --- a/clients/algoliasearch-client-javascript/rollup.config.js~main +++ /dev/null @@ -1,249 +0,0 @@ -import path from 'path'; - -import babel from '@rollup/plugin-babel'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import filesize from 'rollup-plugin-filesize'; -import globals from 'rollup-plugin-node-globals'; -import { terser } from 'rollup-plugin-terser'; -import ts from 'rollup-plugin-typescript2'; - -import generatorConfig from '../../openapitools.json'; - -import { version } from './version'; - -// Retrieve package to build -const client = process.env.CLIENT?.replace('@algolia/', ''); -const UTILS = ['client-common', 'requester-browser-xhr', 'requester-node-http']; - -function createLicence(name) { - return `/*! ${name}.umd.js | ${version} | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */`; -} - -function createBundlers({ output, clientPath }) { - return { - 'esm-node': { - file: `${clientPath}/dist/${output}.esm.node.js`, - format: 'es', - }, - 'esm-browser': { - file: `${clientPath}/dist/${output}.esm.browser.js`, - format: 'es', - }, - 'umd-browser': { - file: `${clientPath}/dist/${output}.umd.browser.js`, - format: 'umd', - }, - 'cjs-node': { - file: `${clientPath}/dist/${output}.cjs.node.js`, - format: 'cjs', - }, - 'cjs-browser': { - file: `${clientPath}/dist/${output}.cjs.browser.js`, - format: 'cjs', - }, - }; -} - -function getAvailableClients() { - // We default `algoliasearch` as it's not a generated client, but an aggregation of - // multiple clients. - const availableClients = ['algoliasearch']; - const generators = Object.entries( - generatorConfig['generator-cli'].generators - ); - - for (const [name, options] of generators) { - if (name.startsWith('javascript')) { - availableClients.push(options.additionalProperties.buildFile); - } - } - - return client === 'all' - ? availableClients - : availableClients.filter((availableClient) => availableClient === client); -} - -function initPackagesConfig() { - if (UTILS.includes(client)) { - const commonOptions = { - input: 'index.ts', - formats: ['cjs-node', 'esm-node'], - external: [], - dependencies: [], - }; - - const availableUtils = [ - // Common - { - ...commonOptions, - output: 'client-common', - package: 'client-common', - name: '@algolia/client-common', - }, - // Browser requester - { - ...commonOptions, - output: 'requester-browser-xhr', - package: 'requester-browser-xhr', - name: '@algolia/requester-browser-xhr', - external: ['dom'], - dependencies: ['@algolia/client-common'], - }, - // Node requester - { - ...commonOptions, - output: 'requester-node-http', - package: 'requester-node-http', - name: '@algolia/requester-node-http', - external: ['https', 'http', 'url'], - dependencies: ['@algolia/client-common'], - }, - ]; - - return client === 'all' - ? availableUtils - : availableUtils.filter( - (availableUtil) => availableUtil.package === client - ); - } - - const availableClients = getAvailableClients(); - - if (availableClients.length === 0) { - throw new Error(`No clients matching ${client}.`); - } - - return availableClients.flatMap((packageName) => { - const isAlgoliasearchClient = packageName.startsWith('algoliasearch'); - const commonConfig = { - package: packageName, - name: isAlgoliasearchClient ? packageName : `@algolia/${packageName}`, - output: packageName, - dependencies: isAlgoliasearchClient - ? [ - '@algolia/client-analytics', - '@algolia/client-common', - '@algolia/client-personalization', - '@algolia/client-search', - ] - : ['@algolia/client-common'], - external: [], - }; - const browserFormats = ['umd-browser', 'esm-browser', 'cjs-browser']; - const nodeFormats = ['cjs-node', 'esm-node']; - - return [ - { - ...commonConfig, - input: 'builds/browser.ts', - formats: browserFormats, - external: ['dom'], - dependencies: [ - ...commonConfig.dependencies, - '@algolia/requester-browser-xhr', - ], - globals: { - [packageName]: packageName, - }, - }, - { - ...commonConfig, - input: 'builds/node.ts', - dependencies: [ - ...commonConfig.dependencies, - '@algolia/requester-node-http', - ], - formats: nodeFormats, - }, - ]; - }); -} - -const packagesConfig = initPackagesConfig(); -const rollupConfig = []; - -packagesConfig.forEach((packageConfig) => { - const clientPath = path.resolve('packages', packageConfig.package); - const bundlers = createBundlers({ - output: packageConfig.output, - clientPath, - }); - - packageConfig.formats.forEach((format) => { - // Avoid generating types multiple times. - let isTypesGenerated = false; - const output = bundlers[format]; - const isUmdBuild = format === 'umd-browser'; - const isEsmBrowserBuild = format === 'esm-browser'; - - if (isUmdBuild) { - output.name = packageConfig.name; - output.banner = createLicence(packageConfig.package); - } - - const compressorPlugins = isUmdBuild ? [terser()] : []; - const transpilerPlugins = isUmdBuild - ? [ - babel({ - babelrc: false, - babelHelpers: 'runtime', - extensions: ['.ts'], - exclude: 'node_modules/**', - presets: [ - [ - '@babel/preset-env', - { - targets: { - browsers: ['> .5%', 'ie >= 11'], - }, - }, - ], - ], - plugins: ['@babel/plugin-transform-runtime'], - }), - ] - : []; - - if (isUmdBuild || isEsmBrowserBuild) { - // eslint-disable-next-line no-param-reassign - packageConfig.dependencies = []; - } - - rollupConfig.push({ - input: path.resolve(clientPath, packageConfig.input), - external: [...packageConfig.dependencies, ...packageConfig.external], - plugins: [ - globals({ - global: true, - }), - nodeResolve(), - ts({ - check: !isTypesGenerated, - tsconfig: path.resolve(clientPath, 'tsconfig.json'), - tsconfigOverride: { - compilerOptions: { - declaration: !isTypesGenerated, - declarationMap: !isTypesGenerated, - }, - }, - }), - ...transpilerPlugins, - ...compressorPlugins, - filesize({ - showMinifiedSize: false, - showGzippedSize: true, - }), - ], - output, - onwarn(msg, warn) { - if (!/Circular/.test(msg)) { - warn(msg); - } - }, - }); - - isTypesGenerated = true; - }); -}); - -export default rollupConfig; From 067b4ee3f2809c4bddcb3fab4f2d0089a6dc4ac3 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 16:41:08 +0100 Subject: [PATCH 36/69] chore: add log --- scripts/release/process-release.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index a682b7ff03..55a8254c7f 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -106,6 +106,8 @@ async function processRelease(): Promise { // prepare the submodule const clientPath = toAbsolutePath(`clients/${clientsConfig[lang].folder}`); const targetBranch = getTargetBranch(lang); + console.log('# debug', { clientPath }); + console.log(await run(`ls -al ${clientPath}`)); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); From 033ddac019ce8ea6a561268915cb045e7d35dac3 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 16:46:40 +0100 Subject: [PATCH 37/69] fix: fix clientPath --- scripts/release/process-release.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 55a8254c7f..dfe2fcf7ac 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -104,10 +104,8 @@ async function processRelease(): Promise { const goal = versionsToRelease[lang] ? 'release' : 'update'; // prepare the submodule - const clientPath = toAbsolutePath(`clients/${clientsConfig[lang].folder}`); + const clientPath = toAbsolutePath(clientsConfig[lang].folder); const targetBranch = getTargetBranch(lang); - console.log('# debug', { clientPath }); - console.log(await run(`ls -al ${clientPath}`)); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); From 67f3acd03b4ccbc56a21282b6df61e17bbf4c10c Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 16:54:19 +0100 Subject: [PATCH 38/69] add log --- scripts/release/process-release.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index dfe2fcf7ac..ffb110b169 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -105,6 +105,9 @@ async function processRelease(): Promise { // prepare the submodule const clientPath = toAbsolutePath(clientsConfig[lang].folder); + console.log('log#1', { clientPath }); + console.log('log#2', await run(`ls -al ${clientPath}`)); + console.log('log#3', await run(`cd ${clientPath} && git branch -r`)); const targetBranch = getTargetBranch(lang); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); From b4a1813ba81be23570c278b88bdca8083c121029 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:01:51 +0100 Subject: [PATCH 39/69] add log --- scripts/release/process-release.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index ffb110b169..281d8af756 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -108,6 +108,7 @@ async function processRelease(): Promise { console.log('log#1', { clientPath }); console.log('log#2', await run(`ls -al ${clientPath}`)); console.log('log#3', await run(`cd ${clientPath} && git branch -r`)); + console.log('log#4', await run(`cat .git/config`)); const targetBranch = getTargetBranch(lang); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); From 4cc3a6053eef3d39b4cd63e872b4cd9b70479034 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:11:34 +0100 Subject: [PATCH 40/69] chore: add log --- scripts/release/process-release.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 281d8af756..b63848dc91 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -109,6 +109,21 @@ async function processRelease(): Promise { console.log('log#2', await run(`ls -al ${clientPath}`)); console.log('log#3', await run(`cd ${clientPath} && git branch -r`)); console.log('log#4', await run(`cat .git/config`)); + console.log( + 'log#5', + await run(`cd clients/algoliasearch-client-php && git branch -r`) + ); + console.log('log#6', await run(`cat .gitmodules`)); + + console.log( + 'log#7', + await run( + `git submodule add https://${process.env.GITHUB_TOKEN}:${process.env.GITHUB_TOKEN}@github.com/algolia/api-clients-automation.git` + ) + ); + console.log('log#8', await run(`cat .git/config`)); + console.log('log#9', await run(`cd ${clientPath} && git branch -r`)); + const targetBranch = getTargetBranch(lang); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); From a3951237d5b00b5d0061693413ccd3ac9253a435 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:15:31 +0100 Subject: [PATCH 41/69] chore: try something else --- scripts/release/process-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index b63848dc91..487fb927f9 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -118,7 +118,7 @@ async function processRelease(): Promise { console.log( 'log#7', await run( - `git submodule add https://${process.env.GITHUB_TOKEN}:${process.env.GITHUB_TOKEN}@github.com/algolia/api-clients-automation.git` + `git submodule add https://${process.env.GITHUB_TOKEN}:${process.env.GITHUB_TOKEN}@github.com/algolia/algoliasearch-client-javascript.git clients/algoliasearch-client-javascript` ) ); console.log('log#8', await run(`cat .git/config`)); From 5004d6c330d8f0d51cbe79cdedfc987e509dbec5 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:24:24 +0100 Subject: [PATCH 42/69] chore: test --- .gitmodules | 6 +++--- scripts/release/process-release.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index d6d0b69eb9..9730e519bd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "clients/algoliasearch-client-javascript"] - path = clients/algoliasearch-client-javascript - url = git@github.com:algolia/algoliasearch-client-javascript.git [submodule "clients/algoliasearch-client-java-2"] path = clients/algoliasearch-client-java-2 url = git@github.com:algolia/algoliasearch-client-java-2.git +[submodule "clients/algoliasearch-client-javascript"] + path = clients/algoliasearch-client-javascript + url = git@github.com:algolia/algoliasearch-client-javascript.git [submodule "clients/algoliasearch-client-php"] path = clients/algoliasearch-client-php url = git@github.com:algolia/algoliasearch-client-php.git diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 487fb927f9..af06c2360c 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -115,14 +115,14 @@ async function processRelease(): Promise { ); console.log('log#6', await run(`cat .gitmodules`)); - console.log( - 'log#7', - await run( - `git submodule add https://${process.env.GITHUB_TOKEN}:${process.env.GITHUB_TOKEN}@github.com/algolia/algoliasearch-client-javascript.git clients/algoliasearch-client-javascript` - ) - ); - console.log('log#8', await run(`cat .git/config`)); - console.log('log#9', await run(`cd ${clientPath} && git branch -r`)); + // console.log( + // 'log#7', + // await run( + // `git submodule add https://${process.env.GITHUB_TOKEN}:${process.env.GITHUB_TOKEN}@github.com/algolia/algoliasearch-client-javascript.git clients/algoliasearch-client-javascript` + // ) + // ); + // console.log('log#8', await run(`cat .git/config`)); + // console.log('log#9', await run(`cd ${clientPath} && git branch -r`)); const targetBranch = getTargetBranch(lang); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); From 114ebf22b99c1958fd8ded950053c5df1dac04a8 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:34:34 +0100 Subject: [PATCH 43/69] chore: remove log --- scripts/release/process-release.ts | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index af06c2360c..dfe2fcf7ac 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -105,25 +105,6 @@ async function processRelease(): Promise { // prepare the submodule const clientPath = toAbsolutePath(clientsConfig[lang].folder); - console.log('log#1', { clientPath }); - console.log('log#2', await run(`ls -al ${clientPath}`)); - console.log('log#3', await run(`cd ${clientPath} && git branch -r`)); - console.log('log#4', await run(`cat .git/config`)); - console.log( - 'log#5', - await run(`cd clients/algoliasearch-client-php && git branch -r`) - ); - console.log('log#6', await run(`cat .gitmodules`)); - - // console.log( - // 'log#7', - // await run( - // `git submodule add https://${process.env.GITHUB_TOKEN}:${process.env.GITHUB_TOKEN}@github.com/algolia/algoliasearch-client-javascript.git clients/algoliasearch-client-javascript` - // ) - // ); - // console.log('log#8', await run(`cat .git/config`)); - // console.log('log#9', await run(`cd ${clientPath} && git branch -r`)); - const targetBranch = getTargetBranch(lang); await run(`git checkout ${targetBranch}`, { cwd: clientPath }); await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); From b00a222ab15bf0a8773ecd71fbb320d5093e8d2e Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:39:03 +0100 Subject: [PATCH 44/69] chore: remove javascript repo from submodule --- .../.gitignore | 10 - .../algoliasearch-client-javascript/.nvmrc | 1 - .../algoliasearch-client-javascript/README.md | 30 - .../bundlesize.config.json | 52 - .../package.json | 38 - .../packages/algoliasearch/builds/browser.ts | 84 - .../packages/algoliasearch/builds/node.ts | 83 - .../packages/algoliasearch/index.d.ts | 2 - .../packages/algoliasearch/index.js | 2 - .../packages/algoliasearch/package.json | 35 - .../packages/algoliasearch/tsconfig.json | 8 - .../packages/client-abtesting/.gitignore | 4 - .../.openapi-generator-ignore | 23 - .../client-abtesting/builds/browser.ts | 37 - .../packages/client-abtesting/builds/node.ts | 36 - .../packages/client-abtesting/git_push.sh | 57 - .../packages/client-abtesting/index.d.ts | 2 - .../packages/client-abtesting/index.js | 2 - .../packages/client-abtesting/model/aBTest.ts | 36 - .../client-abtesting/model/aBTestResponse.ts | 14 - .../client-abtesting/model/abTestsVariant.ts | 14 - .../model/abTestsVariantSearchParams.ts | 4 - .../model/addABTestsRequest.ts | 16 - .../model/addABTestsVariant.ts | 4 - .../model/customSearchParams.ts | 3 - .../client-abtesting/model/errorBase.ts | 6 - .../model/listABTestsResponse.ts | 16 - .../packages/client-abtesting/model/models.ts | 276 -- .../client-abtesting/model/variant.ts | 50 - .../packages/client-abtesting/package.json | 29 - .../client-abtesting/src/abtestingApi.ts | 277 -- .../packages/client-abtesting/tsconfig.json | 8 - .../packages/client-analytics/.gitignore | 4 - .../.openapi-generator-ignore | 23 - .../client-analytics/builds/browser.ts | 37 - .../packages/client-analytics/builds/node.ts | 36 - .../packages/client-analytics/git_push.sh | 57 - .../packages/client-analytics/index.d.ts | 2 - .../packages/client-analytics/index.js | 2 - .../client-analytics/model/errorBase.ts | 6 - .../model/getAverageClickPositionResponse.ts | 16 - .../getAverageClickPositionResponseDates.ts | 14 - .../model/getClickPositionsResponse.ts | 8 - .../getClickPositionsResponsePositions.ts | 10 - .../model/getClickThroughRateResponse.ts | 20 - .../model/getClickThroughRateResponseDates.ts | 18 - .../model/getConversationRateResponse.ts | 20 - .../model/getConversationRateResponseDates.ts | 18 - .../model/getNoClickRateResponse.ts | 20 - .../model/getNoClickRateResponseDates.ts | 18 - .../model/getNoResultsRateResponse.ts | 20 - .../model/getNoResultsRateResponseDates.ts | 18 - .../model/getSearchesCountResponse.ts | 12 - .../model/getSearchesCountResponseDates.ts | 10 - .../model/getSearchesNoClicksResponse.ts | 8 - .../getSearchesNoClicksResponseSearches.ts | 14 - .../model/getSearchesNoResultsResponse.ts | 8 - .../getSearchesNoResultsResponseSearches.ts | 14 - .../model/getStatusResponse.ts | 6 - .../model/getTopCountriesResponse.ts | 8 - .../model/getTopCountriesResponseCountries.ts | 10 - .../model/getTopFilterAttribute.ts | 10 - .../model/getTopFilterAttributesResponse.ts | 8 - .../model/getTopFilterForAttribute.ts | 18 - .../model/getTopFilterForAttributeResponse.ts | 8 - .../model/getTopFiltersNoResultsResponse.ts | 8 - .../model/getTopFiltersNoResultsValue.ts | 14 - .../model/getTopFiltersNoResultsValues.ts | 12 - .../model/getTopHitsResponse.ts | 8 - .../model/getTopHitsResponseHits.ts | 10 - .../model/getTopHitsResponseWithAnalytics.ts | 8 - .../getTopHitsResponseWithAnalyticsHits.ts | 30 - .../model/getTopSearchesResponse.ts | 8 - .../getTopSearchesResponseWithAnalytics.ts | 8 - ...opSearchesResponseWithAnalyticsSearches.ts | 38 - .../model/getUsersCountResponse.ts | 12 - .../packages/client-analytics/model/models.ts | 357 -- .../packages/client-analytics/package.json | 29 - .../client-analytics/src/analyticsApi.ts | 1553 --------- .../packages/client-analytics/tsconfig.json | 8 - .../packages/client-common/index.ts | 12 - .../packages/client-common/package.json | 21 - .../packages/client-common/src/Response.ts | 23 - .../packages/client-common/src/createAuth.ts | 25 - .../client-common/src/createEchoRequester.ts | 44 - .../client-common/src/createMemoryCache.ts | 41 - .../client-common/src/createStatefulHost.ts | 22 - .../client-common/src/createTransporter.ts | 226 -- .../client-common/src/createUserAgent.ts | 20 - .../packages/client-common/src/errors.ts | 38 - .../client-common/src/getUserAgent.ts | 23 - .../packages/client-common/src/helpers.ts | 116 - .../packages/client-common/src/stackTrace.ts | 30 - .../packages/client-common/src/types/Cache.ts | 27 - .../client-common/src/types/CreateClient.ts | 15 - .../packages/client-common/src/types/Host.ts | 12 - .../client-common/src/types/Requester.ts | 40 - .../client-common/src/types/Transporter.ts | 162 - .../packages/client-common/src/types/index.ts | 5 - .../packages/client-common/tsconfig.json | 8 - .../packages/client-insights/.gitignore | 4 - .../client-insights/.openapi-generator-ignore | 23 - .../client-insights/builds/browser.ts | 37 - .../packages/client-insights/builds/node.ts | 36 - .../packages/client-insights/git_push.sh | 57 - .../packages/client-insights/index.d.ts | 2 - .../packages/client-insights/index.js | 2 - .../client-insights/model/errorBase.ts | 6 - .../client-insights/model/insightEvent.ts | 43 - .../client-insights/model/insightEvents.ts | 11 - .../packages/client-insights/model/models.ts | 260 -- .../model/pushEventsResponse.ts | 6 - .../packages/client-insights/package.json | 29 - .../client-insights/src/insightsApi.ts | 99 - .../packages/client-insights/tsconfig.json | 8 - .../client-personalization/.gitignore | 4 - .../.openapi-generator-ignore | 23 - .../client-personalization/builds/browser.ts | 41 - .../client-personalization/builds/node.ts | 40 - .../client-personalization/git_push.sh | 57 - .../client-personalization/index.d.ts | 2 - .../packages/client-personalization/index.js | 2 - .../model/deleteUserProfileResponse.ts | 10 - .../client-personalization/model/errorBase.ts | 6 - .../model/eventScoring.ts | 14 - .../model/facetScoring.ts | 10 - .../model/getUserTokenResponse.ts | 14 - .../client-personalization/model/models.ts | 267 -- .../model/personalizationStrategyParams.ts | 17 - .../setPersonalizationStrategyResponse.ts | 6 - .../client-personalization/package.json | 29 - .../src/personalizationApi.ts | 218 -- .../client-personalization/tsconfig.json | 8 - .../packages/client-predict/.gitignore | 4 - .../client-predict/.openapi-generator-ignore | 23 - .../packages/client-predict/builds/browser.ts | 35 - .../packages/client-predict/builds/node.ts | 34 - .../packages/client-predict/git_push.sh | 57 - .../packages/client-predict/index.d.ts | 2 - .../packages/client-predict/index.js | 2 - .../client-predict/model/affinities.ts | 5 - .../client-predict/model/errorBase.ts | 6 - .../model/fetchUserProfileResponse.ts | 10 - .../client-predict/model/funnelStage.ts | 4 - .../packages/client-predict/model/models.ts | 282 -- .../packages/client-predict/model/params.ts | 20 - .../client-predict/model/predictions.ts | 9 - .../model/predictionsAffinities.ts | 9 - .../model/predictionsFunnelStage.ts | 9 - .../model/predictionsOrderValue.ts | 7 - .../client-predict/model/properties.ts | 17 - .../packages/client-predict/model/segments.ts | 13 - .../packages/client-predict/package.json | 29 - .../packages/client-predict/src/predictApi.ts | 107 - .../packages/client-predict/tsconfig.json | 8 - .../client-query-suggestions/.gitignore | 4 - .../.openapi-generator-ignore | 23 - .../builds/browser.ts | 41 - .../client-query-suggestions/builds/node.ts | 40 - .../client-query-suggestions/git_push.sh | 57 - .../client-query-suggestions/index.d.ts | 2 - .../client-query-suggestions/index.js | 2 - .../model/errorBase.ts | 6 - .../model/indexName.ts | 6 - .../client-query-suggestions/model/logFile.ts | 20 - .../client-query-suggestions/model/models.ts | 281 -- .../model/querySuggestionsIndex.ts | 20 - .../model/querySuggestionsIndexParam.ts | 16 - .../querySuggestionsIndexWithIndexParam.ts | 5 - .../model/sourceIndex.ts | 32 - .../model/sourceIndexExternal.ts | 10 - .../model/sourceIndiceWithReplicas.ts | 39 - .../client-query-suggestions/model/status.ts | 14 - .../model/sucessResponse.ts | 10 - .../client-query-suggestions/package.json | 29 - .../src/querySuggestionsApi.ts | 344 -- .../client-query-suggestions/tsconfig.json | 8 - .../packages/client-search/.gitignore | 4 - .../client-search/.openapi-generator-ignore | 23 - .../packages/client-search/builds/browser.ts | 35 - .../packages/client-search/builds/node.ts | 34 - .../packages/client-search/git_push.sh | 57 - .../packages/client-search/index.d.ts | 2 - .../packages/client-search/index.js | 2 - .../packages/client-search/model/action.ts | 12 - .../client-search/model/addApiKeyResponse.ts | 10 - .../packages/client-search/model/anchoring.ts | 5 - .../packages/client-search/model/apiKey.ts | 53 - .../client-search/model/assignUserIdParams.ts | 9 - .../model/automaticFacetFilter.ts | 17 - .../client-search/model/baseBrowseResponse.ts | 6 - .../client-search/model/baseIndexSettings.ts | 50 - .../client-search/model/baseSearchParams.ts | 130 - .../client-search/model/baseSearchResponse.ts | 100 - .../model/baseSearchResponseFacetsStats.ts | 18 - .../model/batchAssignUserIdsParams.ts | 13 - .../model/batchDictionaryEntriesParams.ts | 15 - .../model/batchDictionaryEntriesRequest.ts | 7 - .../client-search/model/batchParams.ts | 8 - .../client-search/model/batchResponse.ts | 10 - .../client-search/model/batchWriteParams.ts | 8 - .../client-search/model/browseRequest.ts | 10 - .../client-search/model/browseResponse.ts | 7 - .../client-search/model/builtInOperation.ts | 22 - .../packages/client-search/model/condition.ts | 17 - .../client-search/model/consequence.ts | 26 - .../client-search/model/consequenceHide.ts | 9 - .../client-search/model/consequenceParams.ts | 7 - .../client-search/model/createdAtObject.ts | 6 - .../client-search/model/createdAtResponse.ts | 9 - .../model/deleteApiKeyResponse.ts | 6 - .../model/deleteSourceResponse.ts | 6 - .../client-search/model/deletedAtResponse.ts | 13 - .../client-search/model/dictionaryAction.ts | 5 - .../client-search/model/dictionaryEntry.ts | 28 - .../model/dictionaryEntryState.ts | 5 - .../client-search/model/dictionaryLanguage.ts | 9 - .../model/dictionarySettingsParams.ts | 8 - .../packages/client-search/model/errorBase.ts | 6 - .../model/getDictionarySettingsResponse.ts | 5 - .../client-search/model/getLogsResponse.ts | 5 - .../model/getLogsResponseInnerQueries.ts | 14 - .../model/getLogsResponseLogs.ts | 64 - .../client-search/model/getObjectsParams.ts | 8 - .../client-search/model/getObjectsResponse.ts | 6 - .../client-search/model/getTaskResponse.ts | 5 - .../model/getTopUserIdsResponse.ts | 11 - .../client-search/model/highlightResult.ts | 23 - .../packages/client-search/model/hit.ts | 17 - .../client-search/model/indexSettings.ts | 4 - .../model/indexSettingsAsSearchParams.ts | 209 -- .../packages/client-search/model/indice.ts | 46 - .../packages/client-search/model/key.ts | 4 - .../packages/client-search/model/languages.ts | 10 - .../model/listApiKeysResponse.ts | 8 - .../model/listClustersResponse.ts | 9 - .../model/listIndicesResponse.ts | 12 - .../model/listUserIdsResponse.ts | 11 - .../packages/client-search/model/models.ts | 613 ---- .../model/multipleBatchResponse.ts | 10 - .../model/multipleGetObjectsParams.ts | 17 - .../client-search/model/multipleQueries.ts | 21 - .../model/multipleQueriesParams.ts | 7 - .../model/multipleQueriesResponse.ts | 5 - .../model/multipleQueriesStrategy.ts | 1 - .../model/multipleQueriesType.ts | 5 - .../packages/client-search/model/operation.ts | 13 - .../model/operationIndexParams.ts | 14 - .../client-search/model/operationType.ts | 5 - .../packages/client-search/model/params.ts | 19 - .../packages/client-search/model/promote.ts | 17 - .../client-search/model/rankingInfo.ts | 45 - .../model/rankingInfoMatchedGeoLocation.ts | 14 - .../model/removeUserIdResponse.ts | 6 - .../model/replaceSourceResponse.ts | 6 - .../model/requiredSearchParams.ts | 6 - .../packages/client-search/model/rule.ts | 30 - .../client-search/model/saveObjectResponse.ts | 11 - .../model/saveSynonymResponse.ts | 14 - .../packages/client-search/model/scopeType.ts | 1 - .../model/searchDictionaryEntriesParams.ts | 21 - .../model/searchForFacetValuesRequest.ts | 14 - .../model/searchForFacetValuesResponse.ts | 5 - .../searchForFacetValuesResponseFacetHits.ts | 14 - .../client-search/model/searchHits.ts | 5 - .../client-search/model/searchParams.ts | 4 - .../client-search/model/searchParamsObject.ts | 7 - .../client-search/model/searchParamsString.ts | 6 - .../client-search/model/searchResponse.ts | 4 - .../client-search/model/searchRulesParams.ts | 32 - .../model/searchRulesResponse.ts | 20 - .../model/searchSynonymsResponse.ts | 12 - .../model/searchUserIdsParams.ts | 21 - .../model/searchUserIdsResponse.ts | 27 - .../searchUserIdsResponseHighlightResult.ts | 6 - .../model/searchUserIdsResponseHits.ts | 25 - .../client-search/model/snippetResult.ts | 12 - .../packages/client-search/model/source.ts | 13 - .../client-search/model/standardEntries.ts | 17 - .../client-search/model/synonymHit.ts | 38 - .../model/synonymHitHighlightResult.ts | 9 - .../client-search/model/synonymType.ts | 10 - .../packages/client-search/model/timeRange.ts | 10 - .../model/updateApiKeyResponse.ts | 10 - .../client-search/model/updatedAtResponse.ts | 13 - .../model/updatedAtWithObjectIdResponse.ts | 17 - .../model/updatedRuleResponse.ts | 14 - .../packages/client-search/model/userId.ts | 21 - .../packages/client-search/package.json | 29 - .../packages/client-search/src/searchApi.ts | 2932 ----------------- .../packages/client-search/tsconfig.json | 8 - .../packages/client-sources/.gitignore | 4 - .../client-sources/.openapi-generator-ignore | 23 - .../packages/client-sources/builds/browser.ts | 41 - .../packages/client-sources/builds/node.ts | 40 - .../packages/client-sources/git_push.sh | 57 - .../packages/client-sources/index.d.ts | 2 - .../packages/client-sources/index.js | 2 - .../client-sources/model/errorBase.ts | 6 - .../packages/client-sources/model/models.ts | 274 -- .../model/postIngestUrlResponse.ts | 5 - .../client-sources/model/postURLJob.ts | 20 - .../client-sources/model/postURLJobAuth.ts | 19 - .../client-sources/model/postURLJobInput.ts | 18 - .../client-sources/model/postURLJobTarget.ts | 21 - .../packages/client-sources/model/task.ts | 15 - .../packages/client-sources/package.json | 29 - .../packages/client-sources/src/sourcesApi.ts | 107 - .../packages/client-sources/tsconfig.json | 8 - .../packages/recommend/.gitignore | 4 - .../recommend/.openapi-generator-ignore | 23 - .../packages/recommend/builds/browser.ts | 35 - .../packages/recommend/builds/node.ts | 34 - .../packages/recommend/git_push.sh | 57 - .../packages/recommend/index.d.ts | 2 - .../packages/recommend/index.js | 2 - .../recommend/model/baseSearchParams.ts | 130 - .../recommend/model/baseSearchResponse.ts | 100 - .../model/baseSearchResponseFacetsStats.ts | 18 - .../packages/recommend/model/errorBase.ts | 6 - .../model/getRecommendationsParams.ts | 11 - .../model/getRecommendationsResponse.ts | 5 - .../recommend/model/highlightResult.ts | 23 - .../model/indexSettingsAsSearchParams.ts | 209 -- .../packages/recommend/model/models.ts | 322 -- .../packages/recommend/model/rankingInfo.ts | 45 - .../model/rankingInfoMatchedGeoLocation.ts | 14 - .../packages/recommend/model/recommendHit.ts | 21 - .../packages/recommend/model/recommendHits.ts | 5 - .../recommend/model/recommendationRequest.ts | 28 - .../model/recommendationsResponse.ts | 4 - .../recommend/model/requiredSearchParams.ts | 6 - .../packages/recommend/model/searchParams.ts | 7 - .../packages/recommend/model/snippetResult.ts | 12 - .../packages/recommend/package.json | 29 - .../packages/recommend/src/recommendApi.ts | 119 - .../packages/recommend/tsconfig.json | 8 - .../packages/requester-browser-xhr/index.ts | 2 - .../requester-browser-xhr/package.json | 25 - .../src/createXhrRequester.ts | 79 - .../src/echoRequester.ts | 28 - .../requester-browser-xhr/tsconfig.json | 8 - .../packages/requester-node-http/index.ts | 2 - .../packages/requester-node-http/package.json | 24 - .../src/createHttpRequester.ts | 95 - .../requester-node-http/src/echoRequester.ts | 30 - .../requester-node-http/tsconfig.json | 8 - .../rollup.config.js | 249 -- .../tsconfig.json | 25 - 349 files changed, 15964 deletions(-) delete mode 100644 clients/algoliasearch-client-javascript/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/.nvmrc delete mode 100644 clients/algoliasearch-client-javascript/README.md delete mode 100644 clients/algoliasearch-client-javascript/bundlesize.config.json delete mode 100644 clients/algoliasearch-client-javascript/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/action.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/key.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/params.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/source.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/.gitignore delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/git_push.sh delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/models.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/rollup.config.js delete mode 100644 clients/algoliasearch-client-javascript/tsconfig.json diff --git a/clients/algoliasearch-client-javascript/.gitignore b/clients/algoliasearch-client-javascript/.gitignore deleted file mode 100644 index d92b308889..0000000000 --- a/clients/algoliasearch-client-javascript/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -**dist -**.openapi-generator - -yarn-error.log - -.yarn/* -!.yarn/releases -!.yarn/plugins - -node_modules \ No newline at end of file diff --git a/clients/algoliasearch-client-javascript/.nvmrc b/clients/algoliasearch-client-javascript/.nvmrc deleted file mode 100644 index 6e9d5a1ef2..0000000000 --- a/clients/algoliasearch-client-javascript/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -16.13.1 \ No newline at end of file diff --git a/clients/algoliasearch-client-javascript/README.md b/clients/algoliasearch-client-javascript/README.md deleted file mode 100644 index 2b1a128fdc..0000000000 --- a/clients/algoliasearch-client-javascript/README.md +++ /dev/null @@ -1,30 +0,0 @@ -.... - -

- - Algolia for JavaScript - - -

The perfect starting point to integrate Algolia within your JavaScript project

- -

- NPM version - NPM downloads - jsDelivr Downloads - License -

-

- -

- Documentation • - InstantSearch • - Community Forum • - Stack Overflow • - Report a bug • - FAQ • - Support -

- -# Contributing to this repository - -The Algolia API clients are automatically generated, you can find everything here https://github.com/algolia/api-clients-automation diff --git a/clients/algoliasearch-client-javascript/bundlesize.config.json b/clients/algoliasearch-client-javascript/bundlesize.config.json deleted file mode 100644 index 27e80d2f40..0000000000 --- a/clients/algoliasearch-client-javascript/bundlesize.config.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "files": [ - { - "path": "packages/algoliasearch/dist/algoliasearch.umd.browser.js", - "maxSize": "6.25KB" - }, - { - "path": "packages/client-abtesting/dist/client-abtesting.umd.browser.js", - "maxSize": "3.25KB" - }, - { - "path": "packages/client-analytics/dist/client-analytics.umd.browser.js", - "maxSize": "3.75KB" - }, - { - "path": "packages/client-insights/dist/client-insights.umd.browser.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/client-personalization/dist/client-personalization.umd.browser.js", - "maxSize": "3.25KB" - }, - { - "path": "packages/client-query-suggestions/dist/client-query-suggestions.umd.browser.js", - "maxSize": "3.25KB" - }, - { - "path": "packages/client-search/dist/client-search.umd.browser.js", - "maxSize": "5.25KB" - }, - { - "path": "packages/client-sources/dist/client-sources.umd.browser.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/recommend/dist/recommend.umd.browser.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/client-common/dist/client-common.esm.node.js", - "maxSize": "3.00KB" - }, - { - "path": "packages/requester-browser-xhr/dist/requester-browser-xhr.esm.node.js", - "maxSize": "1.00KB" - }, - { - "path": "packages/requester-node-http/dist/requester-node-http.esm.node.js", - "maxSize": "1.00KB" - } - ] -} diff --git a/clients/algoliasearch-client-javascript/package.json b/clients/algoliasearch-client-javascript/package.json deleted file mode 100644 index a937006c9b..0000000000 --- a/clients/algoliasearch-client-javascript/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "algoliasearch-client-javascript", - "version": "5.0.0", - "workspaces": [ - "packages/*" - ], - "private": true, - "scripts": { - "build:utils": "yarn build client-common && yarn build requester-browser-xhr && yarn build requester-node-http", - "build": "CLIENT=${0:-all} yarn rollup -c rollup.config.js", - "clean:utils": "yarn workspace @algolia/client-common clean && yarn workspace @algolia/requester-node-http clean && yarn workspace @algolia/requester-browser-xhr clean", - "clean": "rm -rf packages/*/dist", - "release": "shipjs prepare", - "test:size": "bundlesize", - "test:lint": "eslint . --ext .js,.ts", - "test:types": "yarn tsc --noEmit" - }, - "devDependencies": { - "@babel/core": "7.17.2", - "@babel/plugin-transform-runtime": "7.17.0", - "@babel/preset-env": "7.16.11", - "@babel/runtime": "7.17.2", - "@rollup/plugin-babel": "5.3.0", - "@rollup/plugin-node-resolve": "13.1.3", - "@types/rollup-plugin-node-globals": "1.4.1", - "bundlesize": "0.18.1", - "rollup": "2.67.1", - "rollup-plugin-filesize": "9.1.2", - "rollup-plugin-node-globals": "1.4.0", - "rollup-plugin-terser": "7.0.2", - "rollup-plugin-typescript2": "0.31.2", - "typescript": "4.5.4" - }, - "engines": { - "node": "^14.0.0", - "yarn": "^3.0.0" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts deleted file mode 100644 index 4da5a3355e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { - AnalyticsApi, - Region as AnalyticsRegion, -} from '@algolia/client-analytics/src/analyticsApi'; -import { createAnalyticsApi } from '@algolia/client-analytics/src/analyticsApi'; -import type { - CreateClientOptions, - Host, - Requester, -} from '@algolia/client-common'; -import type { - PersonalizationApi, - Region as PersonalizationRegion, -} from '@algolia/client-personalization/src/personalizationApi'; -import { createPersonalizationApi } from '@algolia/client-personalization/src/personalizationApi'; -import { createSearchApi } from '@algolia/client-search/src/searchApi'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function algoliasearch( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -) { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - const commonOptions: Omit = { - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }; - - function initAnalytics( - analyticsAppId: string, - analyticsApiKey: string, - region?: AnalyticsRegion, - analyticsOptions?: { requester?: Requester; hosts?: Host[] } - ): AnalyticsApi { - return createAnalyticsApi({ - appId: analyticsAppId, - apiKey: analyticsApiKey, - region, - ...analyticsOptions, - ...commonOptions, - }); - } - - function initPersonalization( - personalizationAppId: string, - personalizationApiKey: string, - region: PersonalizationRegion, - personalizationOptions?: { requester?: Requester; hosts?: Host[] } - ): PersonalizationApi { - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId: personalizationAppId, - apiKey: personalizationApiKey, - region, - ...personalizationOptions, - ...commonOptions, - }); - } - - return { - ...createSearchApi({ appId, apiKey, ...commonOptions }), - initAnalytics, - initPersonalization, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts deleted file mode 100644 index e17d171f54..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { - AnalyticsApi, - Region as AnalyticsRegion, -} from '@algolia/client-analytics/src/analyticsApi'; -import { createAnalyticsApi } from '@algolia/client-analytics/src/analyticsApi'; -import type { - CreateClientOptions, - Host, - Requester, -} from '@algolia/client-common'; -import type { - PersonalizationApi, - Region as PersonalizationRegion, -} from '@algolia/client-personalization/src/personalizationApi'; -import { createPersonalizationApi } from '@algolia/client-personalization/src/personalizationApi'; -import { createSearchApi } from '@algolia/client-search/src/searchApi'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function algoliasearch( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -) { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - const commonOptions: Omit = { - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }; - - function initAnalytics( - analyticsAppId: string, - analyticsApiKey: string, - region?: AnalyticsRegion, - analyticsOptions?: { requester?: Requester; hosts?: Host[] } - ): AnalyticsApi { - return createAnalyticsApi({ - appId: analyticsAppId, - apiKey: analyticsApiKey, - region, - ...analyticsOptions, - ...commonOptions, - }); - } - - function initPersonalization( - personalizationAppId: string, - personalizationApiKey: string, - region: PersonalizationRegion, - personalizationOptions?: { requester?: Requester; hosts?: Host[] } - ): PersonalizationApi { - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId: personalizationAppId, - apiKey: personalizationApiKey, - region, - ...personalizationOptions, - ...commonOptions, - }); - } - - return { - ...createSearchApi({ appId, apiKey, ...commonOptions }), - initAnalytics, - initPersonalization, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts deleted file mode 100644 index 7b4d638346..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/algoliasearch/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.js b/clients/algoliasearch-client-javascript/packages/algoliasearch/index.js deleted file mode 100644 index 1bfaf73d0e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/algoliasearch.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/package.json b/clients/algoliasearch-client-javascript/packages/algoliasearch/package.json deleted file mode 100644 index 3808b693f0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "algoliasearch", - "version": "5.0.0", - "description": "A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/algoliasearch.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/algoliasearch.umd.browser.js", - "unpkg": "dist/algoliasearch.umd.browser.js", - "browser": { - "./index.js": "./dist/algoliasearch.cjs.browser.js", - "./lite.js": "./dist/algoliasearch-lite.cjs.browser.js" - }, - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-analytics": "5.0.0", - "@algolia/client-common": "5.0.0", - "@algolia/client-personalization": "5.0.0", - "@algolia/client-search": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json b/clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json deleted file mode 100644 index e5af720cb3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/.gitignore b/clients/algoliasearch-client-javascript/packages/client-abtesting/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts deleted file mode 100644 index 31bbae9d49..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createAbtestingApi } from '../src/abtestingApi'; -import type { AbtestingApi, Region } from '../src/abtestingApi'; - -export * from '../src/abtestingApi'; - -export function abtestingApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AbtestingApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAbtestingApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts deleted file mode 100644 index 034c5ea5b9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/builds/node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createAbtestingApi } from '../src/abtestingApi'; -import type { AbtestingApi, Region } from '../src/abtestingApi'; - -export * from '../src/abtestingApi'; - -export function abtestingApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AbtestingApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAbtestingApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-abtesting/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.js b/clients/algoliasearch-client-javascript/packages/client-abtesting/index.js deleted file mode 100644 index c6b9604592..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-abtesting.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts deleted file mode 100644 index 3d076739f6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTest.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Variant } from './variant'; - -export type ABTest = { - /** - * The A/B test ID. - */ - abTestID: number; - /** - * A/B test significance based on click data. Should be > 0.95 to be considered significant (no matter which variant is winning). - */ - clickSignificance: number; - /** - * A/B test significance based on conversion data. Should be > 0.95 to be considered significant (no matter which variant is winning). - */ - conversionSignificance: number; - /** - * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. - */ - endAt: string; - /** - * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. - */ - createdAt: string; - /** - * A/B test name. - */ - name: string; - /** - * Status of the A/B test. - */ - status: string; - /** - * List of A/B test variant. - */ - variants: Variant[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts deleted file mode 100644 index bf211fd44d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/aBTestResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type ABTestResponse = { - /** - * The index performing the A/B test. - */ - index: string; - /** - * The A/B test ID. - */ - abTestID: number; - /** - * TaskID of the task to wait for. - */ - taskID: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts deleted file mode 100644 index 5100fec263..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariant.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type AbTestsVariant = { - /** - * The index performing the A/B test. - */ - index: string; - /** - * The traffic perfecentage for the A/B test. - */ - trafficPercentage: number; - /** - * The A/B test description. - */ - description?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts deleted file mode 100644 index b9cede265e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/abTestsVariantSearchParams.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { AbTestsVariant } from './abTestsVariant'; -import type { CustomSearchParams } from './customSearchParams'; - -export type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts deleted file mode 100644 index 7f06f24a37..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { AddABTestsVariant } from './addABTestsVariant'; - -export type AddABTestsRequest = { - /** - * A/B test name. - */ - name: string; - /** - * List of 2 variants for the A/B test. - */ - variant: AddABTestsVariant[]; - /** - * End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. - */ - endAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts deleted file mode 100644 index 70e611f007..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/addABTestsVariant.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { AbTestsVariant } from './abTestsVariant'; -import type { AbTestsVariantSearchParams } from './abTestsVariantSearchParams'; - -export type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts deleted file mode 100644 index 44f24075b6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/customSearchParams.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type CustomSearchParams = { - customSearchParameters: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts deleted file mode 100644 index 44f25e3b5f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/listABTestsResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ABTest } from './aBTest'; - -export type ListABTestsResponse = { - /** - * List of A/B tests. - */ - abtests: ABTest[]; - /** - * Number of A/B tests found for the app. - */ - count: number; - /** - * Number of A/B tests retrievable. - */ - total: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/models.ts deleted file mode 100644 index 790b484f2d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/models.ts +++ /dev/null @@ -1,276 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { ABTest } from './aBTest'; -import { ABTestResponse } from './aBTestResponse'; -import { AbTestsVariant } from './abTestsVariant'; -import { AbTestsVariantSearchParams } from './abTestsVariantSearchParams'; -import { AddABTestsRequest } from './addABTestsRequest'; -import { AddABTestsVariant } from './addABTestsVariant'; -import { CustomSearchParams } from './customSearchParams'; -import { ErrorBase } from './errorBase'; -import { ListABTestsResponse } from './listABTestsResponse'; -import { Variant } from './variant'; - -export * from './aBTest'; -export * from './aBTestResponse'; -export * from './abTestsVariant'; -export * from './abTestsVariantSearchParams'; -export * from './addABTestsRequest'; -export * from './addABTestsVariant'; -export * from './customSearchParams'; -export * from './errorBase'; -export * from './listABTestsResponse'; -export * from './variant'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = {}; - -const typeMap: { [index: string]: any } = { - ABTest, - ABTestResponse, - AbTestsVariant, - AbTestsVariantSearchParams, - AddABTestsRequest, - AddABTestsVariant, - CustomSearchParams, - ErrorBase, - ListABTestsResponse, - Variant, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts deleted file mode 100644 index 3328858f2b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/model/variant.ts +++ /dev/null @@ -1,50 +0,0 @@ -export type Variant = { - /** - * Average click position for the variant. - */ - averageClickPosition: number; - /** - * Distinct click count for the variant. - */ - clickCount: number; - /** - * Click through rate for the variant. - */ - clickThroughRate: number; - /** - * Distinct conversion count for the variant. - */ - conversionCount: number; - /** - * Conversion rate for the variant. - */ - conversionRate: number; - /** - * The A/B test description. - */ - description: string; - /** - * The index performing the A/B test. - */ - index: string; - /** - * The number of occurrences. - */ - noResultCount: number; - /** - * The number of search during the A/B test. - */ - searchCount: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The traffic perfecentage for the A/B test. - */ - trafficPercentage: number; - /** - * The number of user during the A/B test. - */ - userCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/package.json b/clients/algoliasearch-client-javascript/packages/client-abtesting/package.json deleted file mode 100644 index 348cc5ae4e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-abtesting", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-abtesting", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-abtesting.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-abtesting.umd.browser.js", - "unpkg": "dist/client-abtesting.umd.browser.js", - "browser": "dist/client-abtesting.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts deleted file mode 100644 index a1533a5e79..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingApi.ts +++ /dev/null @@ -1,277 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { ABTest } from '../model/aBTest'; -import type { ABTestResponse } from '../model/aBTestResponse'; -import type { AddABTestsRequest } from '../model/addABTestsRequest'; -import type { ListABTestsResponse } from '../model/listABTestsResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region?: Region): Host[] { - const regionHost = region ? `.${region}.` : '.'; - - return [ - { - url: `analytics${regionHost}algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createAbtestingApi( - options: CreateClientOptions & { region?: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Abtesting', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Creates a new A/B test with provided configuration. You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants. - * - * @summary Creates a new A/B test with provided configuration. - * @param addABTestsRequest - The addABTestsRequest object. - */ - function addABTests( - addABTestsRequest: AddABTestsRequest - ): Promise { - const path = '/2/abtests'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!addABTestsRequest) { - throw new Error( - 'Parameter `addABTestsRequest` is required when calling `addABTests`.' - ); - } - - if (!addABTestsRequest.name) { - throw new Error( - 'Parameter `addABTestsRequest.name` is required when calling `addABTests`.' - ); - } - if (!addABTestsRequest.variant) { - throw new Error( - 'Parameter `addABTestsRequest.variant` is required when calling `addABTests`.' - ); - } - if (!addABTestsRequest.endAt) { - throw new Error( - 'Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: addABTestsRequest, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Deletes the A/B Test and removes all associated metadata & metrics. - * - * @summary Deletes the A/B Test. - * @param deleteABTest - The deleteABTest object. - * @param deleteABTest.id - The A/B test ID. - */ - function deleteABTest({ id }: DeleteABTestProps): Promise { - const path = '/2/abtests/{id}'.replace( - '{id}', - encodeURIComponent(String(id)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!id) { - throw new Error( - 'Parameter `id` is required when calling `deleteABTest`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns metadata and metrics for A/B test id. Behaves in the same way as GET /2/abtests however the endpoint will return 403. - * - * @summary Returns metadata and metrics for A/B test id. - * @param getABTest - The getABTest object. - * @param getABTest.id - The A/B test ID. - */ - function getABTest({ id }: GetABTestProps): Promise { - const path = '/2/abtests/{id}'.replace( - '{id}', - encodeURIComponent(String(id)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!id) { - throw new Error('Parameter `id` is required when calling `getABTest`.'); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Fetch all existing A/B tests for App that are available for the current API Key. Returns an array of metadata and metrics. When no data has been processed, the metrics will be returned as null. - * - * @summary Fetch all existing A/B tests for App that are available for the current API Key. - * @param listABTests - The listABTests object. - * @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param listABTests.limit - Number of records to return. Limit is the size of the page. - */ - function listABTests({ - offset, - limit, - }: ListABTestsProps): Promise { - const path = '/2/abtests'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Marks the A/B test as stopped. At this point, the test is over and cannot be restarted. As a result, your application is back to normal: index A will perform as usual, receiving 100% of all search requests. Associated metadata and metrics are still stored. - * - * @summary Marks the A/B test as stopped. - * @param stopABTest - The stopABTest object. - * @param stopABTest.id - The A/B test ID. - */ - function stopABTest({ id }: StopABTestProps): Promise { - const path = '/2/abtests/{id}/stop'.replace( - '{id}', - encodeURIComponent(String(id)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!id) { - throw new Error('Parameter `id` is required when calling `stopABTest`.'); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - addABTests, - deleteABTest, - getABTest, - listABTests, - stopABTest, - }; -} - -export type AbtestingApi = ReturnType; - -export type DeleteABTestProps = { - /** - * The A/B test ID. - */ - id: number; -}; - -export type GetABTestProps = { - /** - * The A/B test ID. - */ - id: number; -}; - -export type ListABTestsProps = { - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; -}; - -export type StopABTestProps = { - /** - * The A/B test ID. - */ - id: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/.gitignore b/clients/algoliasearch-client-javascript/packages/client-analytics/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts deleted file mode 100644 index ca2ad2d132..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createAnalyticsApi } from '../src/analyticsApi'; -import type { AnalyticsApi, Region } from '../src/analyticsApi'; - -export * from '../src/analyticsApi'; - -export function analyticsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AnalyticsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAnalyticsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts deleted file mode 100644 index 10a674ef6d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/builds/node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createAnalyticsApi } from '../src/analyticsApi'; -import type { AnalyticsApi, Region } from '../src/analyticsApi'; - -export * from '../src/analyticsApi'; - -export function analyticsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): AnalyticsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createAnalyticsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-analytics/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/index.js b/clients/algoliasearch-client-javascript/packages/client-analytics/index.js deleted file mode 100644 index 72eddf17b0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-analytics.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts deleted file mode 100644 index 594148b405..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { GetAverageClickPositionResponseDates } from './getAverageClickPositionResponseDates'; - -export type GetAverageClickPositionResponse = { - /** - * The average of all the click count event. - */ - average: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * A list of average click position with their date. - */ - dates: GetAverageClickPositionResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts deleted file mode 100644 index 297387383b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getAverageClickPositionResponseDates.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetAverageClickPositionResponseDates = { - /** - * The average of all the click count event. - */ - average: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts deleted file mode 100644 index 85ea2e7177..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetClickPositionsResponsePositions } from './getClickPositionsResponsePositions'; - -export type GetClickPositionsResponse = { - /** - * A list of the click positions with their click count. - */ - positions: GetClickPositionsResponsePositions[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts deleted file mode 100644 index f1fb8bbecd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickPositionsResponsePositions.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetClickPositionsResponsePositions = { - /** - * Range of positions with the following pattern: Positions from 1 to 10 included are displayed in separated groups. Positions from 11 to 20 included are grouped together. Positions from 21 and up are grouped together. - */ - position: number[]; - /** - * The number of click event. - */ - clickCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts deleted file mode 100644 index e22dcf9e92..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetClickThroughRateResponseDates } from './getClickThroughRateResponseDates'; - -export type GetClickThroughRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * A list of click-through rate events with their date. - */ - dates: GetClickThroughRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts deleted file mode 100644 index 4b512e006a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getClickThroughRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetClickThroughRateResponseDates = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts deleted file mode 100644 index 04ecd51de5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetConversationRateResponseDates } from './getConversationRateResponseDates'; - -export type GetConversationRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; - /** - * A list of conversion events with their date. - */ - dates: GetConversationRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts deleted file mode 100644 index bee3367b80..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getConversationRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetConversationRateResponseDates = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts deleted file mode 100644 index e45f85d2f0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetNoClickRateResponseDates } from './getNoClickRateResponseDates'; - -export type GetNoClickRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - count: number; - /** - * The number of click event. - */ - noClickCount: number; - /** - * A list of searches without clicks with their date, rate and counts. - */ - dates: GetNoClickRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts deleted file mode 100644 index 72692149c5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoClickRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetNoClickRateResponseDates = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of click event. - */ - count: number; - /** - * The number of click event. - */ - noClickCount: number; - /** - * Date of the event. - */ - date: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts deleted file mode 100644 index bebc3527e7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GetNoResultsRateResponseDates } from './getNoResultsRateResponseDates'; - -export type GetNoResultsRateResponse = { - /** - * The click-through rate. - */ - rate: number; - /** - * The number of occurrences. - */ - count: number; - /** - * The number of occurrences. - */ - noResultCount: number; - /** - * A list of searches without results with their date, rate and counts. - */ - dates: GetNoResultsRateResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts deleted file mode 100644 index 01856b0b0a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getNoResultsRateResponseDates.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetNoResultsRateResponseDates = { - /** - * Date of the event. - */ - date: string; - /** - * The number of occurrences. - */ - noResultCount: number; - /** - * The number of occurrences. - */ - count: number; - /** - * The click-through rate. - */ - rate: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts deleted file mode 100644 index 4b67c49096..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GetSearchesCountResponseDates } from './getSearchesCountResponseDates'; - -export type GetSearchesCountResponse = { - /** - * The number of occurrences. - */ - count: number; - /** - * A list of search events with their date and count. - */ - dates: GetSearchesCountResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts deleted file mode 100644 index 096b1f055e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesCountResponseDates.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetSearchesCountResponseDates = { - /** - * Date of the event. - */ - date: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts deleted file mode 100644 index d4ab03d68d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetSearchesNoClicksResponseSearches } from './getSearchesNoClicksResponseSearches'; - -export type GetSearchesNoClicksResponse = { - /** - * A list of searches with no clicks and their count. - */ - searches: GetSearchesNoClicksResponseSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts deleted file mode 100644 index 5fd59ec278..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoClicksResponseSearches.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetSearchesNoClicksResponseSearches = { - /** - * The search query. - */ - search: string; - /** - * The number of occurrences. - */ - count: number; - /** - * The number of occurrences. - */ - withFilterCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts deleted file mode 100644 index c44df94b77..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetSearchesNoResultsResponseSearches } from './getSearchesNoResultsResponseSearches'; - -export type GetSearchesNoResultsResponse = { - /** - * A list of searches with no results and their count. - */ - searches: GetSearchesNoResultsResponseSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts deleted file mode 100644 index 592730c073..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getSearchesNoResultsResponseSearches.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetSearchesNoResultsResponseSearches = { - /** - * The search query. - */ - search: string; - /** - * The number of occurrences. - */ - count: number; - /** - * Number of hits that the search query matched. - */ - nbHits: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts deleted file mode 100644 index 379fff0845..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getStatusResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type GetStatusResponse = { - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts deleted file mode 100644 index 6093557d10..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopCountriesResponseCountries } from './getTopCountriesResponseCountries'; - -export type GetTopCountriesResponse = { - /** - * A list of countries with their count. - */ - countries: GetTopCountriesResponseCountries[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts deleted file mode 100644 index a5c121a487..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopCountriesResponseCountries.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetTopCountriesResponseCountries = { - /** - * The country. - */ - country: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts deleted file mode 100644 index 85fe43b917..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttribute.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetTopFilterAttribute = { - /** - * The attribute. - */ - attribute: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts deleted file mode 100644 index d54653be74..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterAttributesResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopFilterAttribute } from './getTopFilterAttribute'; - -export type GetTopFilterAttributesResponse = { - /** - * A list of attributes with their count. - */ - attributes: GetTopFilterAttribute[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts deleted file mode 100644 index 501a4298a1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttribute.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type GetTopFilterForAttribute = { - /** - * The attribute. - */ - attribute: string; - /** - * The operator. - */ - operator: string; - /** - * The value of the attribute. - */ - value: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts deleted file mode 100644 index 982de7c3ce..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFilterForAttributeResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopFilterForAttribute } from './getTopFilterForAttribute'; - -export type GetTopFilterForAttributeResponse = { - /** - * A list of filters for the given attributes. - */ - values: GetTopFilterForAttribute[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts deleted file mode 100644 index 60d85c2abf..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopFiltersNoResultsValues } from './getTopFiltersNoResultsValues'; - -export type GetTopFiltersNoResultsResponse = { - /** - * A list of filters without results. - */ - values: GetTopFiltersNoResultsValues[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts deleted file mode 100644 index fb40a51d7b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValue.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetTopFiltersNoResultsValue = { - /** - * The attribute. - */ - attribute: string; - /** - * The operator. - */ - operator: string; - /** - * The value of the attribute. - */ - value: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts deleted file mode 100644 index fb8c39d7a9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopFiltersNoResultsValues.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GetTopFiltersNoResultsValue } from './getTopFiltersNoResultsValue'; - -export type GetTopFiltersNoResultsValues = { - /** - * The number of occurrences. - */ - count: number; - /** - * A list of filters without results. - */ - values: GetTopFiltersNoResultsValue[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts deleted file mode 100644 index 454261b174..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopHitsResponseHits } from './getTopHitsResponseHits'; - -export type GetTopHitsResponse = { - /** - * A list of top hits with their count. - */ - hits: GetTopHitsResponseHits[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts deleted file mode 100644 index 4a24c30a21..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseHits.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type GetTopHitsResponseHits = { - /** - * The hit. - */ - hit: string; - /** - * The number of occurrences. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts deleted file mode 100644 index 254e062bd1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalytics.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopHitsResponseWithAnalyticsHits } from './getTopHitsResponseWithAnalyticsHits'; - -export type GetTopHitsResponseWithAnalytics = { - /** - * A list of top hits with their count and analytics. - */ - hits: GetTopHitsResponseWithAnalyticsHits[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts deleted file mode 100644 index 0a117f396f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopHitsResponseWithAnalyticsHits.ts +++ /dev/null @@ -1,30 +0,0 @@ -export type GetTopHitsResponseWithAnalyticsHits = { - /** - * The hit. - */ - hit: string; - /** - * The number of occurrences. - */ - count: number; - /** - * The click-through rate. - */ - clickThroughRate: number; - /** - * The conversion rate. - */ - conversionRate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts deleted file mode 100644 index cc805fa4e6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetSearchesNoResultsResponseSearches } from './getSearchesNoResultsResponseSearches'; - -export type GetTopSearchesResponse = { - /** - * A list of top searches with their count. - */ - searches: GetSearchesNoResultsResponseSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts deleted file mode 100644 index 78fad12f8b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalytics.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { GetTopSearchesResponseWithAnalyticsSearches } from './getTopSearchesResponseWithAnalyticsSearches'; - -export type GetTopSearchesResponseWithAnalytics = { - /** - * A list of top searches with their count and analytics. - */ - searches: GetTopSearchesResponseWithAnalyticsSearches[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts deleted file mode 100644 index dca7dd1d3a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getTopSearchesResponseWithAnalyticsSearches.ts +++ /dev/null @@ -1,38 +0,0 @@ -export type GetTopSearchesResponseWithAnalyticsSearches = { - /** - * The search query. - */ - search: string; - /** - * The number of occurrences. - */ - count: number; - /** - * The click-through rate. - */ - clickThroughRate: number; - /** - * The average position of all the click count event. - */ - averageClickPosition: number; - /** - * The conversion rate. - */ - conversionRate: number; - /** - * The number of tracked search click. - */ - trackedSearchCount: number; - /** - * The number of click event. - */ - clickCount: number; - /** - * The number of converted clicks. - */ - conversionCount: number; - /** - * Number of hits that the search query matched. - */ - nbHits: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts deleted file mode 100644 index 437bba9b00..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/getUsersCountResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GetSearchesCountResponseDates } from './getSearchesCountResponseDates'; - -export type GetUsersCountResponse = { - /** - * The number of occurrences. - */ - count: number; - /** - * A list of users count with their date. - */ - dates: GetSearchesCountResponseDates[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/model/models.ts deleted file mode 100644 index 4d8ab7c064..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/model/models.ts +++ /dev/null @@ -1,357 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { ErrorBase } from './errorBase'; -import { GetAverageClickPositionResponse } from './getAverageClickPositionResponse'; -import { GetAverageClickPositionResponseDates } from './getAverageClickPositionResponseDates'; -import { GetClickPositionsResponse } from './getClickPositionsResponse'; -import { GetClickPositionsResponsePositions } from './getClickPositionsResponsePositions'; -import { GetClickThroughRateResponse } from './getClickThroughRateResponse'; -import { GetClickThroughRateResponseDates } from './getClickThroughRateResponseDates'; -import { GetConversationRateResponse } from './getConversationRateResponse'; -import { GetConversationRateResponseDates } from './getConversationRateResponseDates'; -import { GetNoClickRateResponse } from './getNoClickRateResponse'; -import { GetNoClickRateResponseDates } from './getNoClickRateResponseDates'; -import { GetNoResultsRateResponse } from './getNoResultsRateResponse'; -import { GetNoResultsRateResponseDates } from './getNoResultsRateResponseDates'; -import { GetSearchesCountResponse } from './getSearchesCountResponse'; -import { GetSearchesCountResponseDates } from './getSearchesCountResponseDates'; -import { GetSearchesNoClicksResponse } from './getSearchesNoClicksResponse'; -import { GetSearchesNoClicksResponseSearches } from './getSearchesNoClicksResponseSearches'; -import { GetSearchesNoResultsResponse } from './getSearchesNoResultsResponse'; -import { GetSearchesNoResultsResponseSearches } from './getSearchesNoResultsResponseSearches'; -import { GetStatusResponse } from './getStatusResponse'; -import { GetTopCountriesResponse } from './getTopCountriesResponse'; -import { GetTopCountriesResponseCountries } from './getTopCountriesResponseCountries'; -import { GetTopFilterAttribute } from './getTopFilterAttribute'; -import { GetTopFilterAttributesResponse } from './getTopFilterAttributesResponse'; -import { GetTopFilterForAttribute } from './getTopFilterForAttribute'; -import { GetTopFilterForAttributeResponse } from './getTopFilterForAttributeResponse'; -import { GetTopFiltersNoResultsResponse } from './getTopFiltersNoResultsResponse'; -import { GetTopFiltersNoResultsValue } from './getTopFiltersNoResultsValue'; -import { GetTopFiltersNoResultsValues } from './getTopFiltersNoResultsValues'; -import { GetTopHitsResponse } from './getTopHitsResponse'; -import { GetTopHitsResponseHits } from './getTopHitsResponseHits'; -import { GetTopHitsResponseWithAnalytics } from './getTopHitsResponseWithAnalytics'; -import { GetTopHitsResponseWithAnalyticsHits } from './getTopHitsResponseWithAnalyticsHits'; -import { GetTopSearchesResponse } from './getTopSearchesResponse'; -import { GetTopSearchesResponseWithAnalytics } from './getTopSearchesResponseWithAnalytics'; -import { GetTopSearchesResponseWithAnalyticsSearches } from './getTopSearchesResponseWithAnalyticsSearches'; -import { GetUsersCountResponse } from './getUsersCountResponse'; - -export * from './errorBase'; -export * from './getAverageClickPositionResponse'; -export * from './getAverageClickPositionResponseDates'; -export * from './getClickPositionsResponse'; -export * from './getClickPositionsResponsePositions'; -export * from './getClickThroughRateResponse'; -export * from './getClickThroughRateResponseDates'; -export * from './getConversationRateResponse'; -export * from './getConversationRateResponseDates'; -export * from './getNoClickRateResponse'; -export * from './getNoClickRateResponseDates'; -export * from './getNoResultsRateResponse'; -export * from './getNoResultsRateResponseDates'; -export * from './getSearchesCountResponse'; -export * from './getSearchesCountResponseDates'; -export * from './getSearchesNoClicksResponse'; -export * from './getSearchesNoClicksResponseSearches'; -export * from './getSearchesNoResultsResponse'; -export * from './getSearchesNoResultsResponseSearches'; -export * from './getStatusResponse'; -export * from './getTopCountriesResponse'; -export * from './getTopCountriesResponseCountries'; -export * from './getTopFilterAttribute'; -export * from './getTopFilterAttributesResponse'; -export * from './getTopFilterForAttribute'; -export * from './getTopFilterForAttributeResponse'; -export * from './getTopFiltersNoResultsResponse'; -export * from './getTopFiltersNoResultsValue'; -export * from './getTopFiltersNoResultsValues'; -export * from './getTopHitsResponse'; -export * from './getTopHitsResponseHits'; -export * from './getTopHitsResponseWithAnalytics'; -export * from './getTopHitsResponseWithAnalyticsHits'; -export * from './getTopSearchesResponse'; -export * from './getTopSearchesResponseWithAnalytics'; -export * from './getTopSearchesResponseWithAnalyticsSearches'; -export * from './getUsersCountResponse'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = {}; - -const typeMap: { [index: string]: any } = { - ErrorBase, - GetAverageClickPositionResponse, - GetAverageClickPositionResponseDates, - GetClickPositionsResponse, - GetClickPositionsResponsePositions, - GetClickThroughRateResponse, - GetClickThroughRateResponseDates, - GetConversationRateResponse, - GetConversationRateResponseDates, - GetNoClickRateResponse, - GetNoClickRateResponseDates, - GetNoResultsRateResponse, - GetNoResultsRateResponseDates, - GetSearchesCountResponse, - GetSearchesCountResponseDates, - GetSearchesNoClicksResponse, - GetSearchesNoClicksResponseSearches, - GetSearchesNoResultsResponse, - GetSearchesNoResultsResponseSearches, - GetStatusResponse, - GetTopCountriesResponse, - GetTopCountriesResponseCountries, - GetTopFilterAttribute, - GetTopFilterAttributesResponse, - GetTopFilterForAttribute, - GetTopFilterForAttributeResponse, - GetTopFiltersNoResultsResponse, - GetTopFiltersNoResultsValue, - GetTopFiltersNoResultsValues, - GetTopHitsResponse, - GetTopHitsResponseHits, - GetTopHitsResponseWithAnalytics, - GetTopHitsResponseWithAnalyticsHits, - GetTopSearchesResponse, - GetTopSearchesResponseWithAnalytics, - GetTopSearchesResponseWithAnalyticsSearches, - GetUsersCountResponse, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/package.json b/clients/algoliasearch-client-javascript/packages/client-analytics/package.json deleted file mode 100644 index 6324f14570..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-analytics", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-analytics", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-analytics.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-analytics.umd.browser.js", - "unpkg": "dist/client-analytics.umd.browser.js", - "browser": "dist/client-analytics.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts deleted file mode 100644 index 7486b001f1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsApi.ts +++ /dev/null @@ -1,1553 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { GetAverageClickPositionResponse } from '../model/getAverageClickPositionResponse'; -import type { GetClickPositionsResponse } from '../model/getClickPositionsResponse'; -import type { GetClickThroughRateResponse } from '../model/getClickThroughRateResponse'; -import type { GetConversationRateResponse } from '../model/getConversationRateResponse'; -import type { GetNoClickRateResponse } from '../model/getNoClickRateResponse'; -import type { GetNoResultsRateResponse } from '../model/getNoResultsRateResponse'; -import type { GetSearchesCountResponse } from '../model/getSearchesCountResponse'; -import type { GetSearchesNoClicksResponse } from '../model/getSearchesNoClicksResponse'; -import type { GetSearchesNoResultsResponse } from '../model/getSearchesNoResultsResponse'; -import type { GetStatusResponse } from '../model/getStatusResponse'; -import type { GetTopCountriesResponse } from '../model/getTopCountriesResponse'; -import type { GetTopFilterAttributesResponse } from '../model/getTopFilterAttributesResponse'; -import type { GetTopFilterForAttributeResponse } from '../model/getTopFilterForAttributeResponse'; -import type { GetTopFiltersNoResultsResponse } from '../model/getTopFiltersNoResultsResponse'; -import type { GetTopHitsResponse } from '../model/getTopHitsResponse'; -import type { GetTopHitsResponseWithAnalytics } from '../model/getTopHitsResponseWithAnalytics'; -import type { GetTopSearchesResponse } from '../model/getTopSearchesResponse'; -import type { GetTopSearchesResponseWithAnalytics } from '../model/getTopSearchesResponseWithAnalytics'; -import type { GetUsersCountResponse } from '../model/getUsersCountResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region?: Region): Host[] { - const regionHost = region ? `.${region}.` : '.'; - - return [ - { - url: `analytics${regionHost}algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createAnalyticsApi( - options: CreateClientOptions & { region?: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Analytics', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Returns the average click position. The endpoint returns a value for the complete given time range, as well as a value per day. - * - * @summary Returns the average click position. - * @param getAverageClickPosition - The getAverageClickPosition object. - * @param getAverageClickPosition.index - The index name to target. - * @param getAverageClickPosition.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getAverageClickPosition.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getAverageClickPosition.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getAverageClickPosition({ - index, - startDate, - endDate, - tags, - }: GetAverageClickPositionProps): Promise { - const path = '/2/clicks/averageClickPosition'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getAverageClickPosition`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the distribution of clicks per range of positions. - * - * @summary Returns the distribution of clicks per range of positions. - * @param getClickPositions - The getClickPositions object. - * @param getClickPositions.index - The index name to target. - * @param getClickPositions.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickPositions.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickPositions.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getClickPositions({ - index, - startDate, - endDate, - tags, - }: GetClickPositionsProps): Promise { - const path = '/2/clicks/positions'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getClickPositions`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns a click-through rate (CTR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of clicks and searches used to compute the rates. - * - * @summary Returns a click-through rate (CTR). - * @param getClickThroughRate - The getClickThroughRate object. - * @param getClickThroughRate.index - The index name to target. - * @param getClickThroughRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickThroughRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getClickThroughRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getClickThroughRate({ - index, - startDate, - endDate, - tags, - }: GetClickThroughRateProps): Promise { - const path = '/2/clicks/clickThroughRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getClickThroughRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns a conversion rate (CR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of conversion and searches used to compute the rates. - * - * @summary Returns a conversion rate (CR). - * @param getConversationRate - The getConversationRate object. - * @param getConversationRate.index - The index name to target. - * @param getConversationRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getConversationRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getConversationRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getConversationRate({ - index, - startDate, - endDate, - tags, - }: GetConversationRateProps): Promise { - const path = '/2/conversions/conversionRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getConversationRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the rate at which searches didn\'t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. - * - * @summary Returns the rate at which searches didn\'t lead to any clicks. - * @param getNoClickRate - The getNoClickRate object. - * @param getNoClickRate.index - The index name to target. - * @param getNoClickRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoClickRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoClickRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getNoClickRate({ - index, - startDate, - endDate, - tags, - }: GetNoClickRateProps): Promise { - const path = '/2/searches/noClickRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getNoClickRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the rate at which searches didn\'t return any results. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without results used to compute the rates. - * - * @summary Returns the rate at which searches didn\'t return any results. - * @param getNoResultsRate - The getNoResultsRate object. - * @param getNoResultsRate.index - The index name to target. - * @param getNoResultsRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoResultsRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getNoResultsRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getNoResultsRate({ - index, - startDate, - endDate, - tags, - }: GetNoResultsRateProps): Promise { - const path = '/2/searches/noResultRate'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getNoResultsRate`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the number of searches across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day. - * - * @summary Returns the number of searches across the given time range. - * @param getSearchesCount - The getSearchesCount object. - * @param getSearchesCount.index - The index name to target. - * @param getSearchesCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getSearchesCount({ - index, - startDate, - endDate, - tags, - }: GetSearchesCountProps): Promise { - const path = '/2/searches/count'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getSearchesCount`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top searches that didn\'t lead to any clicks. Limited to the 1000 most frequent ones. For each search, also returns the average number of found hits. - * - * @summary Returns top searches that didn\'t lead to any clicks. - * @param getSearchesNoClicks - The getSearchesNoClicks object. - * @param getSearchesNoClicks.index - The index name to target. - * @param getSearchesNoClicks.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoClicks.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoClicks.limit - Number of records to return. Limit is the size of the page. - * @param getSearchesNoClicks.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getSearchesNoClicks.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getSearchesNoClicks({ - index, - startDate, - endDate, - limit, - offset, - tags, - }: GetSearchesNoClicksProps): Promise { - const path = '/2/searches/noClicks'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getSearchesNoClicks`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top searches that didn\'t return any results. Limited to the 1000 most frequent ones. - * - * @summary Returns top searches that didn\'t return any results. - * @param getSearchesNoResults - The getSearchesNoResults object. - * @param getSearchesNoResults.index - The index name to target. - * @param getSearchesNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getSearchesNoResults.limit - Number of records to return. Limit is the size of the page. - * @param getSearchesNoResults.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getSearchesNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getSearchesNoResults({ - index, - startDate, - endDate, - limit, - offset, - tags, - }: GetSearchesNoResultsProps): Promise { - const path = '/2/searches/noResults'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getSearchesNoResults`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the latest update time of the analytics API for a given index. If the index has been recently created and/or no search has been performed yet the updated time will be null. - * - * @summary Get latest update time of the analytics API. - * @param getStatus - The getStatus object. - * @param getStatus.index - The index name to target. - */ - function getStatus({ index }: GetStatusProps): Promise { - const path = '/2/status'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getStatus`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top countries. Limited to the 1000 most frequent ones. - * - * @summary Returns top countries. - * @param getTopCountries - The getTopCountries object. - * @param getTopCountries.index - The index name to target. - * @param getTopCountries.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopCountries.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopCountries.limit - Number of records to return. Limit is the size of the page. - * @param getTopCountries.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopCountries.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopCountries({ - index, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopCountriesProps): Promise { - const path = '/2/countries'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopCountries`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top filter attributes. Limited to the 1000 most used filters. - * - * @summary Returns top filter attributes. - * @param getTopFilterAttributes - The getTopFilterAttributes object. - * @param getTopFilterAttributes.index - The index name to target. - * @param getTopFilterAttributes.search - The query term to search for. Must match the exact user input. - * @param getTopFilterAttributes.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterAttributes.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterAttributes.limit - Number of records to return. Limit is the size of the page. - * @param getTopFilterAttributes.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopFilterAttributes.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopFilterAttributes({ - index, - search, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopFilterAttributesProps): Promise { - const path = '/2/filters'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopFilterAttributes`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top filters for the given attribute. Limited to the 1000 most used filters. - * - * @summary Returns top filters for the given attribute. - * @param getTopFilterForAttribute - The getTopFilterForAttribute object. - * @param getTopFilterForAttribute.attribute - The exact name of the attribute. - * @param getTopFilterForAttribute.index - The index name to target. - * @param getTopFilterForAttribute.search - The query term to search for. Must match the exact user input. - * @param getTopFilterForAttribute.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterForAttribute.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFilterForAttribute.limit - Number of records to return. Limit is the size of the page. - * @param getTopFilterForAttribute.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopFilterForAttribute.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopFilterForAttribute({ - attribute, - index, - search, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopFilterForAttributeProps): Promise { - const path = '/2/filters/{attribute}'.replace( - '{attribute}', - encodeURIComponent(String(attribute)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!attribute) { - throw new Error( - 'Parameter `attribute` is required when calling `getTopFilterForAttribute`.' - ); - } - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopFilterForAttribute`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top filters with no results. Limited to the 1000 most used filters. - * - * @summary Returns top filters with no results. - * @param getTopFiltersNoResults - The getTopFiltersNoResults object. - * @param getTopFiltersNoResults.index - The index name to target. - * @param getTopFiltersNoResults.search - The query term to search for. Must match the exact user input. - * @param getTopFiltersNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFiltersNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopFiltersNoResults.limit - Number of records to return. Limit is the size of the page. - * @param getTopFiltersNoResults.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopFiltersNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopFiltersNoResults({ - index, - search, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopFiltersNoResultsProps): Promise { - const path = '/2/filters/noResults'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopFiltersNoResults`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top hits. Limited to the 1000 most frequent ones. - * - * @summary Returns top hits. - * @param getTopHits - The getTopHits object. - * @param getTopHits.index - The index name to target. - * @param getTopHits.search - The query term to search for. Must match the exact user input. - * @param getTopHits.clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param getTopHits.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopHits.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopHits.limit - Number of records to return. Limit is the size of the page. - * @param getTopHits.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopHits.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopHits({ - index, - search, - clickAnalytics, - startDate, - endDate, - limit, - offset, - tags, - }: GetTopHitsProps): Promise< - GetTopHitsResponse | GetTopHitsResponseWithAnalytics - > { - const path = '/2/hits'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopHits`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (search !== undefined) { - queryParameters.search = search.toString(); - } - - if (clickAnalytics !== undefined) { - queryParameters.clickAnalytics = clickAnalytics.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns top searches. Limited to the 1000 most frequent ones. For each search, also returns the average number of hits returned. - * - * @summary Returns top searches. - * @param getTopSearches - The getTopSearches object. - * @param getTopSearches.index - The index name to target. - * @param getTopSearches.clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param getTopSearches.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopSearches.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getTopSearches.orderBy - Reorder the results. - * @param getTopSearches.direction - The sorting of the result. - * @param getTopSearches.limit - Number of records to return. Limit is the size of the page. - * @param getTopSearches.offset - Position of the starting record. Used for paging. 0 is the first record. - * @param getTopSearches.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getTopSearches({ - index, - clickAnalytics, - startDate, - endDate, - orderBy, - direction, - limit, - offset, - tags, - }: GetTopSearchesProps): Promise< - GetTopSearchesResponse | GetTopSearchesResponseWithAnalytics - > { - const path = '/2/searches'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getTopSearches`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (clickAnalytics !== undefined) { - queryParameters.clickAnalytics = clickAnalytics.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (orderBy !== undefined) { - queryParameters.orderBy = orderBy.toString(); - } - - if (direction !== undefined) { - queryParameters.direction = direction.toString(); - } - - if (limit !== undefined) { - queryParameters.limit = limit.toString(); - } - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the distinct count of users across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day. - * - * @summary Returns the distinct count of users across the given time range. - * @param getUsersCount - The getUsersCount object. - * @param getUsersCount.index - The index name to target. - * @param getUsersCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getUsersCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param getUsersCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - function getUsersCount({ - index, - startDate, - endDate, - tags, - }: GetUsersCountProps): Promise { - const path = '/2/users/count'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!index) { - throw new Error( - 'Parameter `index` is required when calling `getUsersCount`.' - ); - } - - if (index !== undefined) { - queryParameters.index = index.toString(); - } - - if (startDate !== undefined) { - queryParameters.startDate = startDate.toString(); - } - - if (endDate !== undefined) { - queryParameters.endDate = endDate.toString(); - } - - if (tags !== undefined) { - queryParameters.tags = tags.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - getAverageClickPosition, - getClickPositions, - getClickThroughRate, - getConversationRate, - getNoClickRate, - getNoResultsRate, - getSearchesCount, - getSearchesNoClicks, - getSearchesNoResults, - getStatus, - getTopCountries, - getTopFilterAttributes, - getTopFilterForAttribute, - getTopFiltersNoResults, - getTopHits, - getTopSearches, - getUsersCount, - }; -} - -export type AnalyticsApi = ReturnType; - -export type GetAverageClickPositionProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetClickPositionsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetClickThroughRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetConversationRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetNoClickRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetNoResultsRateProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetSearchesCountProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetSearchesNoClicksProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetSearchesNoResultsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetStatusProps = { - /** - * The index name to target. - */ - index: string; -}; - -export type GetTopCountriesProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopFilterAttributesProps = { - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopFilterForAttributeProps = { - /** - * The exact name of the attribute. - */ - attribute: string; - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopFiltersNoResultsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopHitsProps = { - /** - * The index name to target. - */ - index: string; - /** - * The query term to search for. Must match the exact user input. - */ - search?: string; - /** - * Whether to include the click-through and conversion rates for a search. - */ - clickAnalytics?: boolean; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetTopSearchesProps = { - /** - * The index name to target. - */ - index: string; - /** - * Whether to include the click-through and conversion rates for a search. - */ - clickAnalytics?: boolean; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Reorder the results. - */ - orderBy?: - | 'averageClickPosition' - | 'clickThroughRate' - | 'conversionRate' - | 'searchCount'; - /** - * The sorting of the result. - */ - direction?: 'asc' | 'desc'; - /** - * Number of records to return. Limit is the size of the page. - */ - limit?: number; - /** - * Position of the starting record. Used for paging. 0 is the first record. - */ - offset?: number; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; - -export type GetUsersCountProps = { - /** - * The index name to target. - */ - index: string; - /** - * The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - startDate?: string; - /** - * The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - */ - endDate?: string; - /** - * Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. - */ - tags?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/index.ts b/clients/algoliasearch-client-javascript/packages/client-common/index.ts deleted file mode 100644 index 3834d850e9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from './src/createAuth'; -export * from './src/createEchoRequester'; -export * from './src/createMemoryCache'; -export * from './src/createStatefulHost'; -export * from './src/createTransporter'; -export * from './src/createUserAgent'; -export * from './src/errors'; -export * from './src/getUserAgent'; -export * from './src/helpers'; -export * from './src/Response'; -export * from './src/stackTrace'; -export * from './src/types'; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/package.json b/clients/algoliasearch-client-javascript/packages/client-common/package.json deleted file mode 100644 index a995014c63..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@algolia/client-common", - "version": "5.0.0", - "description": "Common package for the Algolia JavaScript API client.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "dist/client-common.cjs.node.js", - "module": "dist/client-common.esm.node.js", - "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist/" - }, - "engines": { - "node": "^14.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts deleted file mode 100644 index bd22de7df9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/Response.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { Response } from './types'; - -export function isNetworkError({ - isTimedOut, - status, -}: Omit): boolean { - return !isTimedOut && ~~status === 0; -} - -export function isRetryable({ - isTimedOut, - status, -}: Omit): boolean { - return ( - isTimedOut || - isNetworkError({ isTimedOut, status }) || - (~~(status / 100) !== 2 && ~~(status / 100) !== 4) - ); -} - -export function isSuccess({ status }: Pick): boolean { - return ~~(status / 100) === 2; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts deleted file mode 100644 index 80bc5e1991..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createAuth.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { AuthMode } from './types'; - -export function createAuth( - appId: string, - apiKey: string, - authMode: AuthMode = 'WithinHeaders' -): { - readonly headers: () => Readonly>; - readonly queryParameters: () => Readonly>; -} { - const credentials = { - 'x-algolia-api-key': apiKey, - 'x-algolia-application-id': appId, - }; - - return { - headers(): Readonly> { - return authMode === 'WithinHeaders' ? credentials : {}; - }, - - queryParameters(): Readonly> { - return authMode === 'WithinQueryParameters' ? credentials : {}; - }, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts deleted file mode 100644 index d184c7eaa6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createEchoRequester.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { EchoResponse, EndRequest, Request, Response } from './types'; - -export type UrlParams = { - host: string; - userAgent: string; - searchParams: EchoResponse['searchParams']; -}; - -export type EchoRequesterParams = { - getUrlParams: (url: string) => UrlParams; - status?: number; -}; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createEchoRequester({ - getUrlParams, - status = 200, -}: EchoRequesterParams) { - function send( - { headers, url, connectTimeout, responseTimeout }: EndRequest, - { data, ...originalRequest }: Request - ): Promise { - const { host, searchParams, userAgent } = getUrlParams(url); - const originalData = - data && Object.entries(data).length > 0 ? data : undefined; - - return Promise.resolve({ - content: JSON.stringify({ - ...originalRequest, - host, - headers, - connectTimeout, - responseTimeout, - userAgent: userAgent ? encodeURI(userAgent) : undefined, - searchParams, - data: originalData, - }), - isTimedOut: false, - status, - }); - } - - return { send }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts deleted file mode 100644 index 2f7af183d6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createMemoryCache.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Cache } from './types'; - -export function createMemoryCache(): Cache { - let cache: Record = {}; - - return { - async get( - key: Record | string, - defaultValue: () => Promise - ): Promise { - const keyAsString = JSON.stringify(key); - - if (keyAsString in cache) { - return Promise.resolve(cache[keyAsString]); - } - - return await defaultValue(); - }, - - set( - key: Record | string, - value: TValue - ): Promise { - cache[JSON.stringify(key)] = value; - - return Promise.resolve(value); - }, - - delete(key: Record | string): Promise { - delete cache[JSON.stringify(key)]; - - return Promise.resolve(); - }, - - clear(): Promise { - cache = {}; - - return Promise.resolve(); - }, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts deleted file mode 100644 index e69f7a285f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createStatefulHost.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Host, StatefulHost } from './types'; - -// By default, API Clients at Algolia have expiration delay of 5 mins. -// In the JavaScript client, we have 2 mins. -const EXPIRATION_DELAY = 2 * 60 * 1000; - -export function createStatefulHost( - host: Host, - status: StatefulHost['status'] = 'up' -): StatefulHost { - const lastUpdate = Date.now(); - - function isUp(): boolean { - return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY; - } - - function isTimedout(): boolean { - return status === 'timedout' && Date.now() - lastUpdate <= EXPIRATION_DELAY; - } - - return { ...host, status, lastUpdate, isUp, isTimedout }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts deleted file mode 100644 index 6f298796c2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createTransporter.ts +++ /dev/null @@ -1,226 +0,0 @@ -import { isRetryable, isSuccess } from './Response'; -import { createStatefulHost } from './createStatefulHost'; -import { RetryError } from './errors'; -import { - deserializeFailure, - deserializeSuccess, - serializeData, - serializeHeaders, - serializeUrl, -} from './helpers'; -import { - stackTraceWithoutCredentials, - stackFrameWithoutCredentials, -} from './stackTrace'; -import type { - EndRequest, - Host, - Request, - RequestOptions, - Response, - StackFrame, - TransporterOptions, - Transporter, -} from './types'; - -type RetryableOptions = { - hosts: Host[]; - getTimeout: (retryCount: number, timeout: number) => number; -}; - -export function createTransporter({ - hosts, - hostsCache, - baseHeaders, - baseQueryParameters, - userAgent, - timeouts, - requester, -}: TransporterOptions): Transporter { - async function createRetryableOptions( - compatibleHosts: Host[] - ): Promise { - const statefulHosts = await Promise.all( - compatibleHosts.map((compatibleHost) => { - return hostsCache.get(compatibleHost, () => { - return Promise.resolve(createStatefulHost(compatibleHost)); - }); - }) - ); - const hostsUp = statefulHosts.filter((host) => host.isUp()); - const hostsTimeouted = statefulHosts.filter((host) => host.isTimedout()); - - // Note, we put the hosts that previously timeouted on the end of the list. - const hostsAvailable = [...hostsUp, ...hostsTimeouted]; - const compatibleHostsAvailable = - hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts; - - return { - hosts: compatibleHostsAvailable, - getTimeout(timeoutsCount: number, baseTimeout: number): number { - /** - * Imagine that you have 4 hosts, if timeouts will increase - * on the following way: 1 (timeouted) > 4 (timeouted) > 5 (200). - * - * Note that, the very next request, we start from the previous timeout. - * - * 5 (timeouted) > 6 (timeouted) > 7 ... - * - * This strategy may need to be reviewed, but is the strategy on the our - * current v3 version. - */ - const timeoutMultiplier = - hostsTimeouted.length === 0 && timeoutsCount === 0 - ? 1 - : hostsTimeouted.length + 3 + timeoutsCount; - - return timeoutMultiplier * baseTimeout; - }, - }; - } - - async function retryableRequest( - request: Request, - requestOptions: RequestOptions - ): Promise { - const stackTrace: StackFrame[] = []; - const isRead = request.method === 'GET'; - - /** - * First we prepare the payload that do not depend from hosts. - */ - const data = serializeData(request, requestOptions); - const headers = serializeHeaders(baseHeaders, requestOptions); - const method = request.method; - - // On `GET`, the data is proxied to query parameters. - const dataQueryParameters: Record = isRead - ? { - ...request.data, - ...requestOptions.data, - } - : {}; - - const queryParameters = { - 'x-algolia-agent': userAgent.value, - ...baseQueryParameters, - ...dataQueryParameters, - ...requestOptions.queryParameters, - }; - - let timeoutsCount = 0; - - const retry = async ( - retryableHosts: Host[], - getTimeout: (timeoutsCount: number, timeout: number) => number - ): Promise => { - /** - * We iterate on each host, until there is no host left. - */ - const host = retryableHosts.pop(); - if (host === undefined) { - throw new RetryError(stackTraceWithoutCredentials(stackTrace)); - } - - let responseTimeout = requestOptions.timeout; - if (responseTimeout === undefined) { - responseTimeout = isRead ? timeouts.read : timeouts.write; - } - - const payload: EndRequest = { - data, - headers, - method, - url: serializeUrl(host, request.path, queryParameters), - connectTimeout: getTimeout(timeoutsCount, timeouts.connect), - responseTimeout: getTimeout(timeoutsCount, responseTimeout), - }; - - /** - * The stackFrame is pushed to the stackTrace so we - * can have information about onRetry and onFailure - * decisions. - */ - const pushToStackTrace = (response: Response): StackFrame => { - const stackFrame: StackFrame = { - request: payload, - response, - host, - triesLeft: retryableHosts.length, - }; - - stackTrace.push(stackFrame); - - return stackFrame; - }; - - const response = await requester.send(payload, request); - - if (isRetryable(response)) { - const stackFrame = pushToStackTrace(response); - - // If response is a timeout, we increase the number of timeouts so we can increase the timeout later. - if (response.isTimedOut) { - timeoutsCount++; - } - /** - * Failures are individually sent to the logger, allowing - * the end user to debug / store stack frames even - * when a retry error does not happen. - */ - // eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter - console.log( - 'Retryable failure', - stackFrameWithoutCredentials(stackFrame) - ); - - /** - * We also store the state of the host in failure cases. If the host, is - * down it will remain down for the next 2 minutes. In a timeout situation, - * this host will be added end of the list of hosts on the next request. - */ - await hostsCache.set( - host, - createStatefulHost(host, response.isTimedOut ? 'timedout' : 'down') - ); - - return retry(retryableHosts, getTimeout); - } - - if (isSuccess(response)) { - return deserializeSuccess(response); - } - - pushToStackTrace(response); - throw deserializeFailure(response, stackTrace); - }; - - /** - * Finally, for each retryable host perform request until we got a non - * retryable response. Some notes here: - * - * 1. The reverse here is applied so we can apply a `pop` later on => more performant. - * 2. We also get from the retryable options a timeout multiplier that is tailored - * for the current context. - */ - const compatibleHosts = hosts.filter( - (host) => - host.accept === 'readWrite' || - (isRead ? host.accept === 'read' : host.accept === 'write') - ); - const options = await createRetryableOptions(compatibleHosts); - - return retry([...options.hosts].reverse(), options.getTimeout); - } - - return { - hostsCache, - requester, - timeouts, - userAgent, - baseHeaders, - baseQueryParameters, - hosts, - request: retryableRequest, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts deleted file mode 100644 index 915a9c63ef..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/createUserAgent.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { UserAgentOptions, UserAgent } from './types'; - -export function createUserAgent(version: string): UserAgent { - const userAgent = { - value: `Algolia for JavaScript (${version})`, - add(options: UserAgentOptions): UserAgent { - const addedUserAgent = `; ${options.segment}${ - options.version !== undefined ? ` (${options.version})` : '' - }`; - - if (userAgent.value.indexOf(addedUserAgent) === -1) { - userAgent.value = `${userAgent.value}${addedUserAgent}`; - } - - return userAgent; - }, - }; - - return userAgent; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts deleted file mode 100644 index a02f3004ad..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/errors.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { Response, StackFrame } from './types'; - -class ErrorWithStackTrace extends Error { - stackTrace: StackFrame[]; - - constructor(message: string, stackTrace: StackFrame[]) { - super(message); - // the array and object should be frozen to reflect the stackTrace at the time of the error - this.stackTrace = stackTrace; - } -} - -export class RetryError extends ErrorWithStackTrace { - constructor(stackTrace: StackFrame[]) { - super( - 'Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', - stackTrace - ); - } -} - -export class ApiError extends ErrorWithStackTrace { - status: number; - - constructor(message: string, status: number, stackTrace: StackFrame[]) { - super(message, stackTrace); - this.status = status; - } -} - -export class DeserializationError extends Error { - response: Response; - - constructor(message: string, response: Response) { - super(message); - this.response = response; - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts deleted file mode 100644 index 1f91ebb1b8..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/getUserAgent.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { createUserAgent } from './createUserAgent'; -import type { UserAgentOptions, UserAgent } from './types'; - -export type GetUserAgent = { - userAgents: UserAgentOptions[]; - client: string; - version: string; -}; - -export function getUserAgent({ - userAgents, - client, - version, -}: GetUserAgent): UserAgent { - const defaultUserAgent = createUserAgent(version).add({ - segment: client, - version, - }); - - userAgents.forEach((userAgent) => defaultUserAgent.add(userAgent)); - - return defaultUserAgent; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts deleted file mode 100644 index 0bde126a2f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/helpers.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { ApiError, DeserializationError } from './errors'; -import type { - Headers, - Host, - Request, - RequestOptions, - Response, - StackFrame, -} from './types'; - -export function shuffle(array: TData[]): TData[] { - const shuffledArray = array; - - for (let c = array.length - 1; c > 0; c--) { - const b = Math.floor(Math.random() * (c + 1)); - const a = array[c]; - - shuffledArray[c] = array[b]; - shuffledArray[b] = a; - } - - return shuffledArray; -} - -export function serializeUrl( - host: Host, - path: string, - queryParameters: Readonly> -): string { - const queryParametersAsString = serializeQueryParameters(queryParameters); - let url = `${host.protocol}://${host.url}/${ - path.charAt(0) === '/' ? path.substr(1) : path - }`; - - if (queryParametersAsString.length) { - url += `?${queryParametersAsString}`; - } - - return url; -} - -export function serializeQueryParameters( - parameters: Readonly> -): string { - const isObjectOrArray = (value: any): boolean => - Object.prototype.toString.call(value) === '[object Object]' || - Object.prototype.toString.call(value) === '[object Array]'; - - return Object.keys(parameters) - .map( - (key) => - `${key}=${ - isObjectOrArray(parameters[key]) - ? JSON.stringify(parameters[key]) - : parameters[key] - }` - ) - .join('&'); -} - -export function serializeData( - request: Request, - requestOptions: RequestOptions -): string | undefined { - if ( - request.method === 'GET' || - (request.data === undefined && requestOptions.data === undefined) - ) { - return undefined; - } - - const data = Array.isArray(request.data) - ? request.data - : { ...request.data, ...requestOptions.data }; - - return JSON.stringify(data); -} - -export function serializeHeaders( - baseHeaders: Headers, - requestOptions: RequestOptions -): Headers { - const headers: Headers = { - ...baseHeaders, - ...requestOptions.headers, - }; - const serializedHeaders: Headers = {}; - - Object.keys(headers).forEach((header) => { - const value = headers[header]; - serializedHeaders[header.toLowerCase()] = value; - }); - - return serializedHeaders; -} - -export function deserializeSuccess(response: Response): TObject { - try { - return JSON.parse(response.content); - } catch (e) { - throw new DeserializationError((e as Error).message, response); - } -} - -export function deserializeFailure( - { content, status }: Response, - stackFrame: StackFrame[] -): Error { - let message = content; - try { - message = JSON.parse(content).message; - } catch (e) { - // .. - } - return new ApiError(message, status, stackFrame); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts deleted file mode 100644 index 14750a54f2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/stackTrace.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { StackFrame } from './types'; - -export function stackTraceWithoutCredentials( - stackTrace: StackFrame[] -): StackFrame[] { - return stackTrace.map((stackFrame) => - stackFrameWithoutCredentials(stackFrame) - ); -} - -export function stackFrameWithoutCredentials( - stackFrame: StackFrame -): StackFrame { - const modifiedHeaders: Record = stackFrame.request.headers[ - 'x-algolia-api-key' - ] - ? { 'x-algolia-api-key': '*****' } - : {}; - - return { - ...stackFrame, - request: { - ...stackFrame.request, - headers: { - ...stackFrame.request.headers, - ...modifiedHeaders, - }, - }, - }; -} diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts deleted file mode 100644 index ad35ba9c90..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Cache.ts +++ /dev/null @@ -1,27 +0,0 @@ -export type Cache = { - /** - * Gets the value of the given `key`. - */ - get: ( - key: Record | string, - defaultValue: () => Promise - ) => Promise; - - /** - * Sets the given value with the given `key`. - */ - set: ( - key: Record | string, - value: TValue - ) => Promise; - - /** - * Deletes the given `key`. - */ - delete: (key: Record | string) => Promise; - - /** - * Clears the cache. - */ - clear: () => Promise; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts deleted file mode 100644 index 1ee437db11..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/CreateClient.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Host } from './Host'; -import type { Requester } from './Requester'; -import type { Timeouts, UserAgentOptions } from './Transporter'; - -export type AuthMode = 'WithinHeaders' | 'WithinQueryParameters'; - -export type CreateClientOptions = { - appId: string; - apiKey: string; - requester: Requester; - timeouts: Timeouts; - userAgents: UserAgentOptions[]; - hosts?: Host[]; - authMode?: AuthMode; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts deleted file mode 100644 index 6c314e4591..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Host.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type Host = { - url: string; - accept: 'read' | 'readWrite' | 'write'; - protocol: 'http' | 'https'; -}; - -export type StatefulHost = Host & { - status: 'down' | 'timedout' | 'up'; - lastUpdate: number; - isUp: () => boolean; - isTimedout: () => boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts deleted file mode 100644 index cac301d9a4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Requester.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Headers } from './Transporter'; - -export type Method = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT'; - -export type Request = { - method: Method; - path: string; - data?: Record; -}; - -export type EndRequest = { - method: Method; - url: string; - connectTimeout: number; - responseTimeout: number; - headers: Headers; - data?: string; -}; - -export type Response = { - content: string; - isTimedOut: boolean; - status: number; -}; - -export type Requester = { - /** - * Sends the given `request` to the server. - */ - send: (request: EndRequest, originalRequest: Request) => Promise; -}; - -export type EchoResponse = Request & { - connectTimeout: number; - host: string; - headers: Headers; - responseTimeout: number; - searchParams?: Record; - userAgent?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts deleted file mode 100644 index d49ebf17cd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/Transporter.ts +++ /dev/null @@ -1,162 +0,0 @@ -import type { Cache } from './Cache'; -import type { Host } from './Host'; -import type { Request, Requester, EndRequest, Response } from './Requester'; - -export type Headers = Record; - -export type QueryParameters = Record; - -export type RequestOptions = { - /** - * Custom timeout for the request. Note that, in normal situacions - * the given timeout will be applied. But the transporter layer may - * increase this timeout if there is need for it. - */ - timeout?: number; - - /** - * Custom headers for the request. This headers are - * going to be merged the transporter headers. - */ - headers?: Headers; - - /** - * Custom query parameters for the request. This query parameters are - * going to be merged the transporter query parameters. - */ - queryParameters: QueryParameters; - data?: Record; -}; - -export type StackFrame = { - request: EndRequest; - response: Response; - host: Host; - triesLeft: number; -}; - -export type UserAgentOptions = { - /** - * The segment. Usually the integration name. - */ - readonly segment: string; - - /** - * The version. Usually the integration version. - */ - readonly version?: string; -}; - -export type UserAgent = { - /** - * The raw value of the user agent. - */ - value: string; - - /** - * Mutates the current user agent ading the given user agent options. - */ - readonly add: (options: UserAgentOptions) => UserAgent; -}; - -export type Timeouts = { - connect: number; - read: number; - write: number; -}; - -export type TransporterOptions = { - /** - * The cache of the hosts. Usually used to persist - * the state of the host when its down. - */ - hostsCache: Cache; - - /** - * The underlying requester used. Should differ - * depending of the enviroment where the client - * will be used. - */ - requester: Requester; - - /** - * The timeouts used by the requester. The transporter - * layer may increase this timeouts as defined on the - * retry strategy. - */ - timeouts: Timeouts; - - /** - * The hosts used by the requester. - */ - hosts: Host[]; - - /** - * The headers used by the requester. The transporter - * layer may add some extra headers during the request - * for the user agent, and others. - */ - baseHeaders: Headers; - - /** - * The query parameters used by the requester. The transporter - * layer may add some extra headers during the request - * for the user agent, and others. - */ - baseQueryParameters: QueryParameters; - - /** - * The user agent used. Sent on query parameters. - */ - userAgent: UserAgent; -}; - -export type Transporter = { - /** - * The cache of the hosts. Usually used to persist - * the state of the host when its down. - */ - hostsCache: Cache; - - /** - * The underlying requester used. Should differ - * depending of the enviroment where the client - * will be used. - */ - requester: Requester; - - /** - * The timeouts used by the requester. The transporter - * layer may increase this timeouts as defined on the - * retry strategy. - */ - timeouts: Timeouts; - - /** - * The user agent used. Sent on query parameters. - */ - userAgent: UserAgent; - - /** - * The headers used on each request. - */ - baseHeaders: Headers; - - /** - * The query parameters used on each request. - */ - baseQueryParameters: QueryParameters; - - /** - * The hosts used by the retry strategy. - */ - hosts: Host[]; - - /** - * Performs a read request using read hosts. - */ - request: ( - request: Request, - requestOptions: RequestOptions - ) => Promise; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts deleted file mode 100644 index ecfac34168..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/types/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './Cache'; -export * from './CreateClient'; -export * from './Host'; -export * from './Requester'; -export * from './Transporter'; diff --git a/clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json deleted file mode 100644 index e14af78d72..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-common/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src", "index.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/.gitignore b/clients/algoliasearch-client-javascript/packages/client-insights/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts deleted file mode 100644 index 7a84056553..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/builds/browser.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createInsightsApi } from '../src/insightsApi'; -import type { InsightsApi, Region } from '../src/insightsApi'; - -export * from '../src/insightsApi'; - -export function insightsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): InsightsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createInsightsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts deleted file mode 100644 index 294a12f533..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/builds/node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createInsightsApi } from '../src/insightsApi'; -import type { InsightsApi, Region } from '../src/insightsApi'; - -export * from '../src/insightsApi'; - -export function insightsApi( - appId: string, - apiKey: string, - region?: Region, - options?: { requester?: Requester; hosts?: Host[] } -): InsightsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createInsightsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-insights/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/index.js b/clients/algoliasearch-client-javascript/packages/client-insights/index.js deleted file mode 100644 index 948691cc65..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-insights.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts deleted file mode 100644 index 9260226fba..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvent.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Insights event. - */ -export type InsightEvent = { - /** - * An eventType can be a click, a conversion, or a view. - */ - eventType: InsightEventEventType; - /** - * A user-defined string used to categorize events. - */ - eventName: string; - /** - * Name of the targeted index. - */ - index: string; - /** - * A user identifier. Depending if the user is logged-in or not, several strategies can be used from a sessionId to a technical identifier. - */ - userToken: string; - /** - * Time of the event expressed in milliseconds since the Unix epoch. - */ - timestamp?: number; - /** - * Algolia queryID. This is required when an event is tied to a search. - */ - queryID?: string; - /** - * An array of index objectID. Limited to 20 objects. An event can’t have both objectIDs and filters at the same time. - */ - objectIDs?: string[]; - /** - * An array of filters. Limited to 10 filters. An event can’t have both objectIDs and filters at the same time. - */ - filters?: string[]; - /** - * Position of the click in the list of Algolia search results. This field is required if a queryID is provided. One position must be provided for each objectID. - */ - positions?: number[]; -}; - -export type InsightEventEventType = 'click' | 'conversion' | 'view'; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts deleted file mode 100644 index 69728810b2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/insightEvents.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { InsightEvent } from './insightEvent'; - -/** - * Object containing the events sent. - */ -export type InsightEvents = { - /** - * Array of events sent. - */ - events: InsightEvent[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/models.ts deleted file mode 100644 index d1fe221e33..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/models.ts +++ /dev/null @@ -1,260 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { ErrorBase } from './errorBase'; -import { InsightEvent } from './insightEvent'; -import { InsightEvents } from './insightEvents'; -import { PushEventsResponse } from './pushEventsResponse'; - -export * from './errorBase'; -export * from './insightEvent'; -export * from './insightEvents'; -export * from './pushEventsResponse'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = { - 'InsightEvent.EventTypeEnum': InsightEvent.EventTypeEnum, -}; - -const typeMap: { [index: string]: any } = { - ErrorBase, - InsightEvent, - InsightEvents, - PushEventsResponse, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts deleted file mode 100644 index ed9b5dd044..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/model/pushEventsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type PushEventsResponse = { - /** - * A message confirming the event push. - */ - message: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/package.json b/clients/algoliasearch-client-javascript/packages/client-insights/package.json deleted file mode 100644 index fcbad3b920..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-insights", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-insights", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-insights.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-insights.umd.browser.js", - "unpkg": "dist/client-insights.umd.browser.js", - "browser": "dist/client-insights.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts b/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts deleted file mode 100644 index 92a4f2ea0c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsApi.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { InsightEvents } from '../model/insightEvents'; -import type { PushEventsResponse } from '../model/pushEventsResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region?: Region): Host[] { - const regionHost = region ? `.${region}.` : '.'; - - return [ - { - url: `insights${regionHost}algolia.io`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createInsightsApi( - options: CreateClientOptions & { region?: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Insights', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * This command pushes an array of events. - * - * @summary Pushes an array of events. - * @param insightEvents - The insightEvents object. - */ - function pushEvents( - insightEvents: InsightEvents - ): Promise { - const path = '/1/events'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!insightEvents) { - throw new Error( - 'Parameter `insightEvents` is required when calling `pushEvents`.' - ); - } - - if (!insightEvents.events) { - throw new Error( - 'Parameter `insightEvents.events` is required when calling `pushEvents`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: insightEvents, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, pushEvents }; -} - -export type InsightsApi = ReturnType; diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-insights/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/.gitignore b/clients/algoliasearch-client-javascript/packages/client-personalization/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts deleted file mode 100644 index 1504ff76a2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createPersonalizationApi } from '../src/personalizationApi'; -import type { PersonalizationApi, Region } from '../src/personalizationApi'; - -export * from '../src/personalizationApi'; - -export function personalizationApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): PersonalizationApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts deleted file mode 100644 index 675a54f521..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/builds/node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createPersonalizationApi } from '../src/personalizationApi'; -import type { PersonalizationApi, Region } from '../src/personalizationApi'; - -export * from '../src/personalizationApi'; - -export function personalizationApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): PersonalizationApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createPersonalizationApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-personalization/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/index.js b/clients/algoliasearch-client-javascript/packages/client-personalization/index.js deleted file mode 100644 index cca98d437f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-personalization.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts deleted file mode 100644 index 49717f3f25..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/deleteUserProfileResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type DeleteUserProfileResponse = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; - /** - * A date until which the data can safely be considered as deleted for the given user. Any data received after the deletedUntil date will start building a new user profile. - */ - deletedUntil: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts deleted file mode 100644 index 277ce92eb9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/eventScoring.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type EventScoring = { - /** - * The score for the event. - */ - score: number; - /** - * The name of the event. - */ - eventName: string; - /** - * The type of the event. - */ - eventType: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts deleted file mode 100644 index ae2c9d1b5e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/facetScoring.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type FacetScoring = { - /** - * The score for the event. - */ - score: number; - /** - * The name of the facet. - */ - facetName: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts deleted file mode 100644 index 0ab1c96114..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/getUserTokenResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetUserTokenResponse = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; - /** - * Date of last event update. (ISO-8601 format). - */ - lastEventAt: string; - /** - * The userToken scores. - */ - scores: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/models.ts deleted file mode 100644 index 57bd33935b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/models.ts +++ /dev/null @@ -1,267 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { DeleteUserProfileResponse } from './deleteUserProfileResponse'; -import { ErrorBase } from './errorBase'; -import { EventScoring } from './eventScoring'; -import { FacetScoring } from './facetScoring'; -import { GetUserTokenResponse } from './getUserTokenResponse'; -import { PersonalizationStrategyParams } from './personalizationStrategyParams'; -import { SetPersonalizationStrategyResponse } from './setPersonalizationStrategyResponse'; - -export * from './deleteUserProfileResponse'; -export * from './errorBase'; -export * from './eventScoring'; -export * from './facetScoring'; -export * from './getUserTokenResponse'; -export * from './personalizationStrategyParams'; -export * from './setPersonalizationStrategyResponse'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = {}; - -const typeMap: { [index: string]: any } = { - DeleteUserProfileResponse, - ErrorBase, - EventScoring, - FacetScoring, - GetUserTokenResponse, - PersonalizationStrategyParams, - SetPersonalizationStrategyResponse, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts deleted file mode 100644 index 0bcbab7e6e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/personalizationStrategyParams.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { EventScoring } from './eventScoring'; -import type { FacetScoring } from './facetScoring'; - -export type PersonalizationStrategyParams = { - /** - * Scores associated with the events. - */ - eventScoring: EventScoring[]; - /** - * Scores associated with the facets. - */ - facetScoring: FacetScoring[]; - /** - * The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled). - */ - personalizationImpact: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts deleted file mode 100644 index 4eaa97be65..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/model/setPersonalizationStrategyResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type SetPersonalizationStrategyResponse = { - /** - * A message confirming the strategy update. - */ - message: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/package.json b/clients/algoliasearch-client-javascript/packages/client-personalization/package.json deleted file mode 100644 index 0942608fb3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-personalization", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-personalization", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-personalization.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-personalization.umd.browser.js", - "unpkg": "dist/client-personalization.umd.browser.js", - "browser": "dist/client-personalization.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts deleted file mode 100644 index ceeeff0aab..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationApi.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { DeleteUserProfileResponse } from '../model/deleteUserProfileResponse'; -import type { GetUserTokenResponse } from '../model/getUserTokenResponse'; -import type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams'; -import type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'eu' | 'us'; - -function getDefaultHosts(region: Region): Host[] { - return [ - { - url: `personalization.${region}.algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createPersonalizationApi( - options: CreateClientOptions & { region: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Personalization', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours before for the deletion request to be fully processed. - * - * @summary Delete the user profile and all its associated data. - * @param deleteUserProfile - The deleteUserProfile object. - * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. - */ - function deleteUserProfile({ - userToken, - }: DeleteUserProfileProps): Promise { - const path = '/1/profiles/{userToken}'.replace( - '{userToken}', - encodeURIComponent(String(userToken)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userToken) { - throw new Error( - 'Parameter `userToken` is required when calling `deleteUserProfile`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * The strategy contains information on the events and facets that impact user profiles and personalized search results. - * - * @summary Get the current personalization strategy. - */ - function getPersonalizationStrategy(): Promise { - const path = '/1/strategies/personalization'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. - * - * @summary Get the user profile built from Personalization strategy. - * @param getUserTokenProfile - The getUserTokenProfile object. - * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. - */ - function getUserTokenProfile({ - userToken, - }: GetUserTokenProfileProps): Promise { - const path = '/1/profiles/personalization/{userToken}'.replace( - '{userToken}', - encodeURIComponent(String(userToken)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userToken) { - throw new Error( - 'Parameter `userToken` is required when calling `getUserTokenProfile`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * A strategy defines the events and facets that impact user profiles and personalized search results. - * - * @summary Set a new personalization strategy. - * @param personalizationStrategyParams - The personalizationStrategyParams object. - */ - function setPersonalizationStrategy( - personalizationStrategyParams: PersonalizationStrategyParams - ): Promise { - const path = '/1/strategies/personalization'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!personalizationStrategyParams) { - throw new Error( - 'Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.' - ); - } - - if (!personalizationStrategyParams.eventScoring) { - throw new Error( - 'Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.' - ); - } - if (!personalizationStrategyParams.facetScoring) { - throw new Error( - 'Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.' - ); - } - if (!personalizationStrategyParams.personalizationImpact) { - throw new Error( - 'Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: personalizationStrategyParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - deleteUserProfile, - getPersonalizationStrategy, - getUserTokenProfile, - setPersonalizationStrategy, - }; -} - -export type PersonalizationApi = ReturnType; - -export type DeleteUserProfileProps = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; -}; - -export type GetUserTokenProfileProps = { - /** - * UserToken representing the user for which to fetch the Personalization profile. - */ - userToken: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/.gitignore b/clients/algoliasearch-client-javascript/packages/client-predict/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts deleted file mode 100644 index 86adb2976f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/builds/browser.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createPredictApi } from '../src/predictApi'; -import type { PredictApi } from '../src/predictApi'; - -export * from '../src/predictApi'; - -export function predictApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): PredictApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createPredictApi({ - appId, - apiKey, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts deleted file mode 100644 index 9737dc6884..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/builds/node.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createPredictApi } from '../src/predictApi'; -import type { PredictApi } from '../src/predictApi'; - -export * from '../src/predictApi'; - -export function predictApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): PredictApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createPredictApi({ - appId, - apiKey, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-predict/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/index.js b/clients/algoliasearch-client-javascript/packages/client-predict/index.js deleted file mode 100644 index d4ebe8f164..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-predict.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts deleted file mode 100644 index e8187169b1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/affinities.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type Affinities = { - name?: string; - value?: string; - probability?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts deleted file mode 100644 index 58ebd054ad..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/fetchUserProfileResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Predictions } from './predictions'; -import type { Properties } from './properties'; -import type { Segments } from './segments'; - -export type FetchUserProfileResponse = { - user: string; - predictions?: Predictions; - properties?: Properties; - segments?: Segments; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts deleted file mode 100644 index 2fe71efd34..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/funnelStage.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type FunnelStage = { - name?: string; - probability?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/models.ts deleted file mode 100644 index 3ab3326c4c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/models.ts +++ /dev/null @@ -1,282 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { Affinities } from './affinities'; -import { ErrorBase } from './errorBase'; -import { FetchUserProfileResponse } from './fetchUserProfileResponse'; -import { FunnelStage } from './funnelStage'; -import { Params } from './params'; -import { Predictions } from './predictions'; -import { PredictionsAffinities } from './predictionsAffinities'; -import { PredictionsFunnelStage } from './predictionsFunnelStage'; -import { PredictionsOrderValue } from './predictionsOrderValue'; -import { Properties } from './properties'; -import { Segments } from './segments'; - -export * from './affinities'; -export * from './errorBase'; -export * from './fetchUserProfileResponse'; -export * from './funnelStage'; -export * from './params'; -export * from './predictions'; -export * from './predictionsAffinities'; -export * from './predictionsFunnelStage'; -export * from './predictionsOrderValue'; -export * from './properties'; -export * from './segments'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = { - 'Params.ModelsToRetrieveEnum': Params.ModelsToRetrieveEnum, - 'Params.TypesToRetrieveEnum': Params.TypesToRetrieveEnum, -}; - -const typeMap: { [index: string]: any } = { - Affinities, - ErrorBase, - FetchUserProfileResponse, - FunnelStage, - Params, - Predictions, - PredictionsAffinities, - PredictionsFunnelStage, - PredictionsOrderValue, - Properties, - Segments, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts deleted file mode 100644 index ebcae4a6f8..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Object with models and types to retrieve. - */ -export type Params = { - /** - * List with model types for which to retrieve predictions. - */ - modelsToRetrieve?: ParamsModelsToRetrieve[]; - /** - * List with types to be retrieved. - */ - typesToRetrieve?: ParamsTypesToRetrieve[]; -}; - -export type ParamsModelsToRetrieve = - | 'affinities' - | 'funnel_stage' - | 'order_value'; - -export type ParamsTypesToRetrieve = 'properties' | 'segments'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts deleted file mode 100644 index 632247b07d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { PredictionsAffinities } from './predictionsAffinities'; -import type { PredictionsFunnelStage } from './predictionsFunnelStage'; -import type { PredictionsOrderValue } from './predictionsOrderValue'; - -export type Predictions = { - funnel_stage?: PredictionsFunnelStage; - order_value?: PredictionsOrderValue; - affinities?: PredictionsAffinities; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts deleted file mode 100644 index 2f9c9060be..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsAffinities.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Affinities } from './affinities'; - -/** - * Prediction for the **affinities** model. - */ -export type PredictionsAffinities = { - value?: Affinities[]; - lastUpdatedAt?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts deleted file mode 100644 index 9a653c5399..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsFunnelStage.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { FunnelStage } from './funnelStage'; - -/** - * Prediction for the **funnel_stage** model. - */ -export type PredictionsFunnelStage = { - value?: FunnelStage[]; - lastUpdatedAt?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts deleted file mode 100644 index 2180dacb5f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/predictionsOrderValue.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Prediction for the **order_value** model. - */ -export type PredictionsOrderValue = { - value?: number; - lastUpdatedAt?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts deleted file mode 100644 index e8c8dbe7eb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/properties.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Properties for the user profile. - */ -export type Properties = { - /** - * Raw user properties (key-value pairs). - */ - raw?: Record; - /** - * Computed user properties (key-value pairs). - */ - computed?: Record; - /** - * Custom user properties (key-value pairs). - */ - custom?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts deleted file mode 100644 index a05df5cf46..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/segments.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Segments that the user belongs to. - */ -export type Segments = { - /** - * List of computed segments IDs. - */ - computed?: string[]; - /** - * List of custom segments IDs. - */ - custom?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/package.json b/clients/algoliasearch-client-javascript/packages/client-predict/package.json deleted file mode 100644 index b3bae9d24c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-predict", - "version": "0.0.1", - "description": "JavaScript client for @algolia/client-predict", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-predict.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-predict.umd.browser.js", - "unpkg": "dist/client-predict.umd.browser.js", - "browser": "dist/client-predict.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts b/clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts deleted file mode 100644 index 4370f36e9b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/src/predictApi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { FetchUserProfileResponse } from '../model/fetchUserProfileResponse'; -import type { Params } from '../model/params'; - -export const apiClientVersion = '0.0.1'; - -function getDefaultHosts(): Host[] { - return [ - { - url: 'predict-api-oslcbws3zq-ew.a.run.app', - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createPredictApi(options: CreateClientOptions) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Predict', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Get predictions, properties (raw, computed or custom) and segments (computed or custom) for a user profile. - * - * @summary Get user profile. - * @param fetchUserProfile - The fetchUserProfile object. - * @param fetchUserProfile.userID - User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). - * @param fetchUserProfile.params - The params object. - */ - function fetchUserProfile({ - userID, - params, - }: FetchUserProfileProps): Promise { - const path = '/1/users/{userID}/fetch'.replace( - '{userID}', - encodeURIComponent(String(userID)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userID) { - throw new Error( - 'Parameter `userID` is required when calling `fetchUserProfile`.' - ); - } - - if (!params) { - throw new Error( - 'Parameter `params` is required when calling `fetchUserProfile`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: params, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, fetchUserProfile }; -} - -export type PredictApi = ReturnType; - -export type FetchUserProfileProps = { - /** - * User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). - */ - userID: string; - params: Params; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-predict/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.gitignore b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts deleted file mode 100644 index 6eaf109907..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createQuerySuggestionsApi } from '../src/querySuggestionsApi'; -import type { QuerySuggestionsApi, Region } from '../src/querySuggestionsApi'; - -export * from '../src/querySuggestionsApi'; - -export function querySuggestionsApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): QuerySuggestionsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createQuerySuggestionsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts deleted file mode 100644 index 0b890d2707..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/builds/node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createQuerySuggestionsApi } from '../src/querySuggestionsApi'; -import type { QuerySuggestionsApi, Region } from '../src/querySuggestionsApi'; - -export * from '../src/querySuggestionsApi'; - -export function querySuggestionsApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): QuerySuggestionsApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createQuerySuggestionsApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js deleted file mode 100644 index 4b29b9aafd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-query-suggestions.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts deleted file mode 100644 index 37c585d5b4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/indexName.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type IndexName = { - /** - * Index name to target. - */ - indexName: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts deleted file mode 100644 index 1dac57b5d2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/logFile.ts +++ /dev/null @@ -1,20 +0,0 @@ -export type LogFile = { - /** - * Date and time of creation of the record. - */ - timestamp: string; - /** - * Type of the record, can be one of three values (INFO, SKIP or ERROR). - */ - level: LogFileLevel; - /** - * Detailed description of what happened. - */ - message: string; - /** - * Indicates the hierarchy of the records. For example, a record with contextLevel=1 belongs to a preceding record with contextLevel=0. - */ - contextLevel: number; -}; - -export type LogFileLevel = 'ERROR' | 'INFO' | 'SKIP'; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/models.ts deleted file mode 100644 index 1c4bd580af..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/models.ts +++ /dev/null @@ -1,281 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { ErrorBase } from './errorBase'; -import { IndexName } from './indexName'; -import { LogFile } from './logFile'; -import { QuerySuggestionsIndex } from './querySuggestionsIndex'; -import { QuerySuggestionsIndexParam } from './querySuggestionsIndexParam'; -import { QuerySuggestionsIndexWithIndexParam } from './querySuggestionsIndexWithIndexParam'; -import { SourceIndex } from './sourceIndex'; -import { SourceIndexExternal } from './sourceIndexExternal'; -import { SourceIndiceWithReplicas } from './sourceIndiceWithReplicas'; -import { Status } from './status'; -import { SucessResponse } from './sucessResponse'; - -export * from './errorBase'; -export * from './indexName'; -export * from './logFile'; -export * from './querySuggestionsIndex'; -export * from './querySuggestionsIndexParam'; -export * from './querySuggestionsIndexWithIndexParam'; -export * from './sourceIndex'; -export * from './sourceIndexExternal'; -export * from './sourceIndiceWithReplicas'; -export * from './status'; -export * from './sucessResponse'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = { - 'LogFile.LevelEnum': LogFile.LevelEnum, -}; - -const typeMap: { [index: string]: any } = { - ErrorBase, - IndexName, - LogFile, - QuerySuggestionsIndex, - QuerySuggestionsIndexParam, - QuerySuggestionsIndexWithIndexParam, - SourceIndex, - SourceIndexExternal, - SourceIndiceWithReplicas, - Status, - SucessResponse, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts deleted file mode 100644 index 74ce2d5475..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndex.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { SourceIndiceWithReplicas } from './sourceIndiceWithReplicas'; - -export type QuerySuggestionsIndex = { - /** - * Index name to target. - */ - indexName: string; - /** - * List of source indices used to generate a Query Suggestions index. - */ - sourceIndices: SourceIndiceWithReplicas[]; - /** - * De-duplicate singular and plural suggestions. For example, let\'s say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. - */ - languages: string[]; - /** - * List of words and patterns to exclude from the Query Suggestions index. - */ - exclude: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts deleted file mode 100644 index dfb47b2070..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexParam.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { SourceIndex } from './sourceIndex'; - -export type QuerySuggestionsIndexParam = { - /** - * List of source indices used to generate a Query Suggestions index. - */ - sourceIndices: SourceIndex[]; - /** - * De-duplicate singular and plural suggestions. For example, let\'s say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. - */ - languages?: string[]; - /** - * List of words and patterns to exclude from the Query Suggestions index. - */ - exclude?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts deleted file mode 100644 index cd9ba12854..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/querySuggestionsIndexWithIndexParam.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { IndexName } from './indexName'; -import type { QuerySuggestionsIndexParam } from './querySuggestionsIndexParam'; - -export type QuerySuggestionsIndexWithIndexParam = IndexName & - QuerySuggestionsIndexParam; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts deleted file mode 100644 index 7a2450b90c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndex.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { SourceIndexExternal } from './sourceIndexExternal'; - -export type SourceIndex = { - /** - * Source index name. - */ - indexName: string; - /** - * List of analytics tags to filter the popular searches per tag. - */ - analyticsTags?: string[]; - /** - * List of facets to define as categories for the query suggestions. - */ - facets?: Array>; - /** - * Minimum number of hits (e.g., matching records in the source index) to generate a suggestions. - */ - minHits?: number; - /** - * Minimum number of required letters for a suggestion to remain. - */ - minLetters?: number; - /** - * List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC). - */ - generate?: string[][]; - /** - * List of external indices to use to generate custom Query Suggestions. - */ - external?: SourceIndexExternal[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts deleted file mode 100644 index d334668c52..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndexExternal.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type SourceIndexExternal = { - /** - * The suggestion you would like to add. - */ - query: string; - /** - * The measure of the suggestion relative popularity. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts deleted file mode 100644 index 0c3601e84a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sourceIndiceWithReplicas.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { SourceIndexExternal } from './sourceIndexExternal'; - -/** - * Source indice with replicas used to generate a Query Suggestions index. - */ -export type SourceIndiceWithReplicas = { - /** - * True if the Query Suggestions index is a replicas. - */ - replicas: boolean; - /** - * Source index name. - */ - indexName: string; - /** - * List of analytics tags to filter the popular searches per tag. - */ - analyticsTags: string[]; - /** - * List of facets to define as categories for the query suggestions. - */ - facets: Array>; - /** - * Minimum number of hits (e.g., matching records in the source index) to generate a suggestions. - */ - minHits: number; - /** - * Minimum number of required letters for a suggestion to remain. - */ - minLetters: number; - /** - * List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC). - */ - generate: string[][]; - /** - * List of external indices to use to generate custom Query Suggestions. - */ - external: SourceIndexExternal[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts deleted file mode 100644 index 1e2048b9d0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/status.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type Status = { - /** - * The targeted index name. - */ - indexName: string; - /** - * True if the Query Suggestions index is running. - */ - isRunning: boolean; - /** - * Date and time of the last build. - */ - lastBuiltAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts deleted file mode 100644 index 841e28fdb3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/model/sucessResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type SucessResponse = { - /** - * The status code. - */ - status: number; - /** - * Message of the response. - */ - message: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json deleted file mode 100644 index 833bdf09a0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-query-suggestions", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-query-suggestions", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-query-suggestions.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-query-suggestions.umd.browser.js", - "unpkg": "dist/client-query-suggestions.umd.browser.js", - "browser": "dist/client-query-suggestions.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts deleted file mode 100644 index 7b96119a8c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsApi.ts +++ /dev/null @@ -1,344 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { LogFile } from '../model/logFile'; -import type { QuerySuggestionsIndex } from '../model/querySuggestionsIndex'; -import type { QuerySuggestionsIndexParam } from '../model/querySuggestionsIndexParam'; -import type { QuerySuggestionsIndexWithIndexParam } from '../model/querySuggestionsIndexWithIndexParam'; -import type { Status } from '../model/status'; -import type { SucessResponse } from '../model/sucessResponse'; - -export const apiClientVersion = '5.0.0'; - -export type Region = 'eu' | 'us'; - -function getDefaultHosts(region: Region): Host[] { - return [ - { - url: `query-suggestions.${region}.algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createQuerySuggestionsApi( - options: CreateClientOptions & { region: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'QuerySuggestions', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Create a configuration of a Query Suggestions index. There\'s a limit of 100 configurations per application. - * - * @summary Create a configuration of a Query Suggestions index. - * @param querySuggestionsIndexWithIndexParam - The querySuggestionsIndexWithIndexParam object. - */ - function createConfig( - querySuggestionsIndexWithIndexParam: QuerySuggestionsIndexWithIndexParam - ): Promise { - const path = '/1/configs'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!querySuggestionsIndexWithIndexParam) { - throw new Error( - 'Parameter `querySuggestionsIndexWithIndexParam` is required when calling `createConfig`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: querySuggestionsIndexWithIndexParam, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete a configuration of a Query Suggestion\'s index. By deleting a configuraton, you stop all updates to the underlying query suggestion index. Note that when doing this, the underlying index does not change - existing suggestions remain untouched. - * - * @summary Delete a configuration of a Query Suggestion\'s index. - * @param deleteConfig - The deleteConfig object. - * @param deleteConfig.indexName - The index in which to perform the request. - */ - function deleteConfig({ - indexName, - }: DeleteConfigProps): Promise { - const path = '/1/configs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteConfig`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get all the configurations of Query Suggestions. For each index, you get a block of JSON with a list of its configuration settings. - * - * @summary Get all the configurations of Query Suggestions. - */ - function getAllConfigs(): Promise { - const path = '/1/configs'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the configuration of a single Query Suggestions index. - * - * @summary Get the configuration of a single Query Suggestions index. - * @param getConfig - The getConfig object. - * @param getConfig.indexName - The index in which to perform the request. - */ - function getConfig({ - indexName, - }: GetConfigProps): Promise { - const path = '/1/configs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getConfig`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the status of a Query Suggestion\'s index. The status includes whether the Query Suggestions index is currently in the process of being built, and the last build time. - * - * @summary Get the status of a Query Suggestion\'s index. - * @param getConfigStatus - The getConfigStatus object. - * @param getConfigStatus.indexName - The index in which to perform the request. - */ - function getConfigStatus({ - indexName, - }: GetConfigStatusProps): Promise { - const path = '/1/configs/{indexName}/status'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getConfigStatus`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the log file of the last build of a single Query Suggestion index. - * - * @summary Get the log file of the last build of a single Query Suggestion index. - * @param getLogFile - The getLogFile object. - * @param getLogFile.indexName - The index in which to perform the request. - */ - function getLogFile({ indexName }: GetLogFileProps): Promise { - const path = '/1/logs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getLogFile`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Update the configuration of a Query Suggestions index. - * - * @summary Update the configuration of a Query Suggestions index. - * @param updateConfig - The updateConfig object. - * @param updateConfig.indexName - The index in which to perform the request. - * @param updateConfig.querySuggestionsIndexParam - The querySuggestionsIndexParam object. - */ - function updateConfig({ - indexName, - querySuggestionsIndexParam, - }: UpdateConfigProps): Promise { - const path = '/1/configs/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `updateConfig`.' - ); - } - - if (!querySuggestionsIndexParam) { - throw new Error( - 'Parameter `querySuggestionsIndexParam` is required when calling `updateConfig`.' - ); - } - - if (!querySuggestionsIndexParam.sourceIndices) { - throw new Error( - 'Parameter `querySuggestionsIndexParam.sourceIndices` is required when calling `updateConfig`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: querySuggestionsIndexParam, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - createConfig, - deleteConfig, - getAllConfigs, - getConfig, - getConfigStatus, - getLogFile, - updateConfig, - }; -} - -export type QuerySuggestionsApi = ReturnType; - -export type DeleteConfigProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetConfigProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetConfigStatusProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetLogFileProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type UpdateConfigProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - querySuggestionsIndexParam: QuerySuggestionsIndexParam; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/.gitignore b/clients/algoliasearch-client-javascript/packages/client-search/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts deleted file mode 100644 index e1a5131532..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/builds/browser.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createSearchApi } from '../src/searchApi'; -import type { SearchApi } from '../src/searchApi'; - -export * from '../src/searchApi'; - -export function searchApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): SearchApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createSearchApi({ - appId, - apiKey, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts deleted file mode 100644 index 9f3a39c78f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createSearchApi } from '../src/searchApi'; -import type { SearchApi } from '../src/searchApi'; - -export * from '../src/searchApi'; - -export function searchApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): SearchApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createSearchApi({ - appId, - apiKey, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-search/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-search/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-search/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/index.js b/clients/algoliasearch-client-javascript/packages/client-search/index.js deleted file mode 100644 index bd9ffc6c0a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-search.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/action.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/action.ts deleted file mode 100644 index 7f1a4fb16b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/action.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Type of operation. - */ - -export type Action = - | 'addObject' - | 'clear' - | 'delete' - | 'deleteObject' - | 'partialUpdateObject' - | 'partialUpdateObjectNoCreate' - | 'updateObject'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts deleted file mode 100644 index 10dfae24e7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/addApiKeyResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type AddApiKeyResponse = { - /** - * Key string. - */ - key: string; - /** - * Date of creation (ISO-8601 format). - */ - createdAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts deleted file mode 100644 index 80d51f78be..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/anchoring.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. - */ - -export type Anchoring = 'contains' | 'endsWith' | 'is' | 'startsWith'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts deleted file mode 100644 index 4dff62ed0e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/apiKey.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Api Key object. - */ -export type ApiKey = { - /** - * Set of permissions associated with the key. - */ - acl: ApiKeyAcl[]; - /** - * A comment used to identify a key more easily in the dashboard. It is not interpreted by the API. - */ - description?: string; - /** - * Restrict this new API key to a list of indices or index patterns. If the list is empty, all indices are allowed. - */ - indexes?: string[]; - /** - * Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. - */ - maxHitsPerQuery?: number; - /** - * Maximum number of API calls per hour allowed from a given IP address or a user token. - */ - maxQueriesPerIPPerHour?: number; - /** - * URL-encoded query string. Force some query parameters to be applied for each query made with this API key. - */ - queryParameters?: string; - /** - * Restrict this new API key to specific referers. If empty or blank, defaults to all referers. - */ - referers?: string[]; - /** - * Validity limit for this key in seconds. The key will automatically be removed after this period of time. - */ - validity?: number; -}; - -export type ApiKeyAcl = - | 'addObject' - | 'analytics' - | 'browse' - | 'deleteIndex' - | 'deleteObject' - | 'editSettings' - | 'listIndexes' - | 'logs' - | 'personalization' - | 'recommendation' - | 'search' - | 'seeUnretrievableAttributes' - | 'settings' - | 'usage'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts deleted file mode 100644 index 638f8f37d3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/assignUserIdParams.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Assign userID parameters. - */ -export type AssignUserIdParams = { - /** - * Name of the cluster. - */ - cluster: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts deleted file mode 100644 index ae2749c171..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/automaticFacetFilter.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Automatic facet Filter. - */ -export type AutomaticFacetFilter = { - /** - * Attribute to filter on. This must match a facet placeholder in the Rule\'s pattern. - */ - facet: string; - /** - * Score for the filter. Typically used for optional or disjunctive filters. - */ - score?: number; - /** - * Whether the filter is disjunctive (true) or conjunctive (false). - */ - disjunctive?: boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts deleted file mode 100644 index 206e1dc700..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseBrowseResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type BaseBrowseResponse = { - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. - */ - cursor: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts deleted file mode 100644 index 36e8463b2f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseIndexSettings.ts +++ /dev/null @@ -1,50 +0,0 @@ -export type BaseIndexSettings = { - /** - * Creates replicas, exact copies of an index. - */ - replicas?: string[]; - /** - * Set the maximum number of hits accessible via pagination. - */ - paginationLimitedTo?: number; - /** - * A list of words for which you want to turn off typo tolerance. - */ - disableTypoToleranceOnWords?: string[]; - /** - * Specify on which attributes to apply transliteration. - */ - attributesToTransliterate?: string[]; - /** - * List of attributes on which to do a decomposition of camel case words. - */ - camelCaseAttributes?: string[]; - /** - * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. - */ - decompoundedAttributes?: Record; - /** - * Sets the languages at the index level for language-specific processing such as tokenization and normalization. - */ - indexLanguages?: string[]; - /** - * Whether promoted results should match the filters of the current search, except for geographic filters. - */ - filterPromotes?: boolean; - /** - * List of attributes on which you want to disable prefix matching. - */ - disablePrefixOnAttributes?: string[]; - /** - * Enables compression of large integer arrays. - */ - allowCompressionOfIntegerArray?: boolean; - /** - * List of numeric attributes that can be used as numerical filters. - */ - numericAttributesForFiltering?: string[]; - /** - * Lets you store custom data in your indices. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts deleted file mode 100644 index 8bf1730be7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts +++ /dev/null @@ -1,130 +0,0 @@ -export type BaseSearchParams = { - /** - * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. - */ - similarQuery?: string; - /** - * Filter the query with numeric, facet and/or tag filters. - */ - filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; - /** - * Determines how to calculate the total score for filtering. - */ - sumOrFiltersScores?: boolean; - /** - * Retrieve facets and their facet values. - */ - facets?: string[]; - /** - * Maximum number of facet values to return for each facet during a regular search. - */ - maxValuesPerFacet?: number; - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - */ - facetingAfterDistinct?: boolean; - /** - * Controls how facet values are fetched. - */ - sortFacetValuesBy?: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Specify the offset of the first hit to return. - */ - offset?: number; - /** - * Set the number of hits to retrieve (used only with offset). - */ - length?: number; - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - */ - aroundLatLng?: string; - /** - * Search for entries around a given location automatically computed from the requester\'s IP address. - */ - aroundLatLngViaIP?: boolean; - /** - * Define the maximum radius for a geo search (in meters). - */ - aroundRadius?: number | string | null; - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - */ - aroundPrecision?: number; - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. - */ - minimumAroundRadius?: number; - /** - * Search inside a rectangular area (in geo coordinates). - */ - insideBoundingBox?: number[]; - /** - * Search inside a polygon (in geo coordinates). - */ - insidePolygon?: number[]; - /** - * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. - */ - naturalLanguages?: string[]; - /** - * Enables contextual rules. - */ - ruleContexts?: string[]; - /** - * Define the impact of the Personalization feature. - */ - personalizationImpact?: number; - /** - * Associates a certain user token with the current search. - */ - userToken?: string; - /** - * Retrieve detailed ranking information. - */ - getRankingInfo?: boolean; - /** - * Enable the Click Analytics feature. - */ - clickAnalytics?: boolean; - /** - * Whether the current query will be taken into account in the Analytics. - */ - analytics?: boolean; - /** - * List of tags to apply to the query for analytics purposes. - */ - analyticsTags?: string[]; - /** - * Whether to include or exclude a query from the processing-time percentile computation. - */ - percentileComputation?: boolean; - /** - * Whether this search should participate in running AB tests. - */ - enableABTest?: boolean; - /** - * Whether this search should use AI Re-Ranking. - */ - enableReRanking?: boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts deleted file mode 100644 index 358556c692..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponse.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type { BaseSearchResponseFacetsStats } from './baseSearchResponseFacetsStats'; - -export type BaseSearchResponse = { - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. - */ - abTestID?: number; - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. - */ - abTestVariantID?: number; - /** - * The computed geo location. - */ - aroundLatLng?: string; - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. - */ - automaticRadius?: string; - /** - * Whether the facet count is exhaustive or approximate. - */ - exhaustiveFacetsCount?: boolean; - /** - * Indicate if the nbHits count was exhaustive or approximate. - */ - exhaustiveNbHits: boolean; - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled). - */ - exhaustiveTypo: boolean; - /** - * A mapping of each facet name to the corresponding facet counts. - */ - facets?: { [key: string]: { [key: string]: string } }; - /** - * Statistics for numerical facets. - */ - facets_stats?: { [key: string]: BaseSearchResponseFacetsStats }; - /** - * Set the number of hits per page. - */ - hitsPerPage: number; - /** - * Index name used for the query. - */ - index?: string; - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn\'t always the index used by the query. - */ - indexUsed?: string; - /** - * Used to return warnings about the query. - */ - message?: string; - /** - * Number of hits that the search query matched. - */ - nbHits: number; - /** - * Number of pages available for the current query. - */ - nbPages: number; - /** - * The number of hits selected and sorted by the relevant sort algorithm. - */ - nbSortedHits?: number; - /** - * Specify the page to retrieve. - */ - page: number; - /** - * A url-encoded string of all search parameters. - */ - params: string; - /** - * The query string that will be searched, after normalization. - */ - parsedQuery?: string; - /** - * Time the server took to process the request, in milliseconds. - */ - processingTimeMS: number; - /** - * The text to search in the index. - */ - query: string; - /** - * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. - */ - queryAfterRemoval?: string; - /** - * Actual host name of the server that processed the request. - */ - serverUsed?: string; - /** - * Lets you store custom data in your indices. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts deleted file mode 100644 index 4c4ceb7bc7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchResponseFacetsStats.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type BaseSearchResponseFacetsStats = { - /** - * The minimum value in the result set. - */ - min?: number; - /** - * The maximum value in the result set. - */ - max?: number; - /** - * The average facet value in the result set. - */ - avg?: number; - /** - * The sum of all values in the result set. - */ - sum?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts deleted file mode 100644 index 96a6c0756a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchAssignUserIdsParams.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Assign userID parameters. - */ -export type BatchAssignUserIdsParams = { - /** - * Name of the cluster. - */ - cluster: string; - /** - * UserIDs to assign. Note you cannot move users with this method. - */ - users: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts deleted file mode 100644 index 03a9a91be6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesParams.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { BatchDictionaryEntriesRequest } from './batchDictionaryEntriesRequest'; - -/** - * The `batchDictionaryEntries` parameters. - */ -export type BatchDictionaryEntriesParams = { - /** - * When `true`, start the batch by removing all the custom entries from the dictionary. - */ - clearExistingDictionaryEntries?: boolean; - /** - * List of operations to batch. Each operation is described by an `action` and a `body`. - */ - requests: BatchDictionaryEntriesRequest[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts deleted file mode 100644 index 49ec3569cd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchDictionaryEntriesRequest.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { DictionaryAction } from './dictionaryAction'; -import type { DictionaryEntry } from './dictionaryEntry'; - -export type BatchDictionaryEntriesRequest = { - action: DictionaryAction; - body: DictionaryEntry; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts deleted file mode 100644 index c0c9a64003..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Operation } from './operation'; - -/** - * The `multipleBatch` parameters. - */ -export type BatchParams = { - requests?: Operation[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts deleted file mode 100644 index 28521ba212..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type BatchResponse = { - /** - * TaskID of the task to wait for. - */ - taskID?: number; - /** - * List of objectID. - */ - objectIDs?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts deleted file mode 100644 index 60cd949a70..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/batchWriteParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Operation } from './operation'; - -/** - * The `batch` parameters. - */ -export type BatchWriteParams = { - requests?: Operation[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts deleted file mode 100644 index 8296b9eaff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/browseRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type BrowseRequest = { - /** - * Search parameters as URL-encoded query string. - */ - params?: string; - /** - * Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. - */ - cursor?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts deleted file mode 100644 index 16cf063b37..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/browseResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseBrowseResponse } from './baseBrowseResponse'; -import type { BaseSearchResponse } from './baseSearchResponse'; -import type { SearchHits } from './searchHits'; - -export type BrowseResponse = BaseBrowseResponse & - BaseSearchResponse & - SearchHits; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts deleted file mode 100644 index 58bb215b56..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/builtInOperation.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * To update an attribute without pushing the entire record, you can use these built-in operations. - */ -export type BuiltInOperation = { - /** - * The operation to apply on the attribute. - */ - _operation: BuiltInOperationOperation; - /** - * The right-hand side argument to the operation, for example, increment or decrement step, value to add or remove. - */ - value: string; -}; - -export type BuiltInOperationOperation = - | 'Add' - | 'AddUnique' - | 'Decrement' - | 'Increment' - | 'IncrementFrom' - | 'IncrementSet' - | 'Remove'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts deleted file mode 100644 index 41db9a3cc1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/condition.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Anchoring } from './anchoring'; - -export type Condition = { - /** - * Query pattern syntax. - */ - pattern?: string; - anchoring?: Anchoring; - /** - * Whether the pattern matches on plurals, synonyms, and typos. - */ - alternatives?: boolean; - /** - * Rule context format: [A-Za-z0-9_-]+). - */ - context?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts deleted file mode 100644 index d738256a8e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/consequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { ConsequenceHide } from './consequenceHide'; -import type { ConsequenceParams } from './consequenceParams'; -import type { Promote } from './promote'; - -/** - * Consequence of the Rule. - */ -export type Consequence = { - params?: ConsequenceParams; - /** - * Objects to promote as hits. - */ - promote?: Promote[]; - /** - * Only use in combination with the promote consequence. When true, promoted results will be restricted to match the filters of the current search. When false, the promoted results will show up regardless of the filters. - */ - filterPromotes?: boolean; - /** - * Objects to hide from hits. Each object must contain an objectID field. By default, you can hide up to 50 items per rule. - */ - hide?: ConsequenceHide[]; - /** - * Custom JSON object that will be appended to the userData array in the response. This object isn\'t interpreted by the API. It\'s limited to 1kB of minified JSON. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts deleted file mode 100644 index 28f87c9c0c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceHide.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Unique identifier of the object to hide. - */ -export type ConsequenceHide = { - /** - * Unique identifier of the object. - */ - objectID: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts deleted file mode 100644 index af531bb25a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/consequenceParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import type { Params } from './params'; - -export type ConsequenceParams = BaseSearchParams & - IndexSettingsAsSearchParams & - Params; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts deleted file mode 100644 index 186db3e688..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtObject.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type CreatedAtObject = { - /** - * Date of creation (ISO-8601 format). - */ - createdAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts deleted file mode 100644 index 5338cfa832..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/createdAtResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * The response with a createdAt timestamp. - */ -export type CreatedAtResponse = { - /** - * Date of creation (ISO-8601 format). - */ - createdAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts deleted file mode 100644 index 37e9753738..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteApiKeyResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type DeleteApiKeyResponse = { - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts deleted file mode 100644 index 0777b09e59..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/deleteSourceResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type DeleteSourceResponse = { - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts deleted file mode 100644 index 865074e606..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/deletedAtResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The response with a taskID and a deletedAt timestamp. - */ -export type DeletedAtResponse = { - /** - * TaskID of the task to wait for. - */ - taskID: number; - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts deleted file mode 100644 index cd9ad65e77..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryAction.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Actions to perform. - */ - -export type DictionaryAction = 'addEntry' | 'deleteEntry'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts deleted file mode 100644 index 4fd672ddbe..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { DictionaryEntryState } from './dictionaryEntryState'; - -/** - * A dictionary entry. - */ -export type DictionaryEntry = { - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * Language ISO code supported by the dictionary (e.g., \"en\" for English). - */ - language: string; - /** - * The word of the dictionary entry. - */ - word?: string; - /** - * The words of the dictionary entry. - */ - words?: string[]; - /** - * A decomposition of the word of the dictionary entry. - */ - decomposition?: string[]; - state?: DictionaryEntryState; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts deleted file mode 100644 index 676ad575c2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntryState.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * The state of the dictionary entry. - */ - -export type DictionaryEntryState = 'disabled' | 'enabled'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts deleted file mode 100644 index 1f1ba5ea7e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryLanguage.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Custom entries for a dictionary. - */ -export type DictionaryLanguage = { - /** - * When nbCustomEntries is set to 0, the user didn\'t customize the dictionary. The dictionary is still supported with standard, Algolia-provided entries. - */ - nbCustomEntires?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts deleted file mode 100644 index e1a831126e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionarySettingsParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { StandardEntries } from './standardEntries'; - -/** - * Disable the builtin Algolia entries for a type of dictionary per language. - */ -export type DictionarySettingsParams = { - disableStandardEntries: StandardEntries; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts deleted file mode 100644 index 98419546a7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getDictionarySettingsResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { StandardEntries } from './standardEntries'; - -export type GetDictionarySettingsResponse = { - disableStandardEntries: StandardEntries; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts deleted file mode 100644 index 40a3d8adf9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { GetLogsResponseLogs } from './getLogsResponseLogs'; - -export type GetLogsResponse = { - logs: GetLogsResponseLogs[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts deleted file mode 100644 index 6afe67dc1d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseInnerQueries.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type GetLogsResponseInnerQueries = { - /** - * Index targeted by the query. - */ - index_name?: string; - /** - * User identifier. - */ - user_token?: string; - /** - * QueryID for the given query. - */ - query_id?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts deleted file mode 100644 index 67ec3593a7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getLogsResponseLogs.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { GetLogsResponseInnerQueries } from './getLogsResponseInnerQueries'; - -export type GetLogsResponseLogs = { - /** - * Timestamp in ISO-8601 format. - */ - timestamp: string; - /** - * HTTP method of the perfomed request. - */ - method: string; - /** - * HTTP response code. - */ - answer_code: string; - /** - * Request body. Truncated after 1000 characters. - */ - query_body: string; - /** - * Answer body. Truncated after 1000 characters. - */ - answer: string; - /** - * Request URL. - */ - url: string; - /** - * IP of the client which perfomed the request. - */ - ip: string; - /** - * Request Headers (API Key is obfuscated). - */ - query_headers: string; - /** - * SHA1 signature of the log entry. - */ - sha1: string; - /** - * Number of API calls. - */ - nb_api_calls: string; - /** - * Processing time for the query. It doesn\'t include network time. - */ - processing_time_ms: string; - /** - * Index targeted by the query. - */ - index?: string; - /** - * Query parameters sent with the request. - */ - query_params?: string; - /** - * Number of hits returned for the query. - */ - query_nb_hits?: string; - /** - * Array of all performed queries for the given request. - */ - inner_queries?: GetLogsResponseInnerQueries[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts deleted file mode 100644 index 439032130c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { MultipleGetObjectsParams } from './multipleGetObjectsParams'; - -/** - * The `getObjects` parameters. - */ -export type GetObjectsParams = { - requests?: MultipleGetObjectsParams[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts deleted file mode 100644 index 1c33d6608c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getObjectsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type GetObjectsResponse = { - /** - * List of results fetched. - */ - results?: Array>; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts deleted file mode 100644 index a08aabf7a1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getTaskResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type GetTaskResponse = { - status: GetTaskResponseStatus; -}; - -export type GetTaskResponseStatus = 'notPublished' | 'published'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts deleted file mode 100644 index 58171c3bca..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/getTopUserIdsResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { UserId } from './userId'; - -/** - * Array of userIDs and clusters. - */ -export type GetTopUserIdsResponse = { - /** - * Mapping of cluster names to top users. - */ - topUsers: Array<{ [key: string]: UserId[] }>; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts deleted file mode 100644 index a878792c6d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/highlightResult.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Highlighted attributes. - */ -export type HighlightResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: HighlightResultMatchLevel; - /** - * List of words from the query that matched the object. - */ - matchedWords?: string[]; - /** - * Whether the entire attribute value is highlighted. - */ - fullyHighlighted?: boolean; -}; - -export type HighlightResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts deleted file mode 100644 index 54c8913308..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/hit.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { HighlightResult } from './highlightResult'; -import type { RankingInfo } from './rankingInfo'; -import type { SnippetResult } from './snippetResult'; - -/** - * A single hit. - */ -export type Hit = { - /** - * Unique identifier of the object. - */ - objectID: string; - _highlightResult?: HighlightResult; - _snippetResult?: SnippetResult; - _rankingInfo?: RankingInfo; - _distinctSeqID?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts deleted file mode 100644 index 056199bbd2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettings.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseIndexSettings } from './baseIndexSettings'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; - -export type IndexSettings = BaseIndexSettings & IndexSettingsAsSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts deleted file mode 100644 index 00a227aa03..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/indexSettingsAsSearchParams.ts +++ /dev/null @@ -1,209 +0,0 @@ -export type IndexSettingsAsSearchParams = { - /** - * The complete list of attributes used for searching. - */ - searchableAttributes?: string[]; - /** - * The complete list of attributes that will be used for faceting. - */ - attributesForFaceting?: string[]; - /** - * List of attributes that can\'t be retrieved at query time. - */ - unretrievableAttributes?: string[]; - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - */ - attributesToRetrieve?: string[]; - /** - * Restricts a given query to look in only a subset of your searchable attributes. - */ - restrictSearchableAttributes?: string[]; - /** - * Controls how Algolia should sort your results. - */ - ranking?: string[]; - /** - * Specifies the custom ranking criterion. - */ - customRanking?: string[]; - /** - * Controls the relevancy threshold below which less relevant results aren\'t included in the results. - */ - relevancyStrictness?: number; - /** - * List of attributes to highlight. - */ - attributesToHighlight?: string[]; - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - */ - attributesToSnippet?: string[]; - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - */ - highlightPreTag?: string; - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - */ - highlightPostTag?: string; - /** - * String used as an ellipsis indicator when a snippet is truncated. - */ - snippetEllipsisText?: string; - /** - * Restrict highlighting and snippeting to items that matched the query. - */ - restrictHighlightAndSnippetArrays?: boolean; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. - */ - minWordSizefor1Typo?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. - */ - minWordSizefor2Typos?: number; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ - typoTolerance?: IndexSettingsAsSearchParamsTypoTolerance; - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - */ - allowTyposOnNumericTokens?: boolean; - /** - * List of attributes on which you want to disable typo tolerance. - */ - disableTypoToleranceOnAttributes?: string[]; - /** - * Control which separators are indexed. - */ - separatorsToIndex?: string; - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - */ - ignorePlurals?: string; - /** - * Removes stop (common) words from the query before executing it. - */ - removeStopWords?: string; - /** - * List of characters that the engine shouldn\'t automatically normalize. - */ - keepDiacriticsOnCharacters?: string; - /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. - */ - queryLanguages?: string[]; - /** - * Splits compound words into their composing atoms in the query. - */ - decompoundQuery?: boolean; - /** - * Whether Rules should be globally enabled. - */ - enableRules?: boolean; - /** - * Enable the Personalization feature. - */ - enablePersonalization?: boolean; - /** - * Controls if and how query words are interpreted as prefixes. - */ - queryType?: IndexSettingsAsSearchParamsQueryType; - /** - * Selects a strategy to remove words from the query when it doesn\'t match any hits. - */ - removeWordsIfNoResults?: IndexSettingsAsSearchParamsRemoveWordsIfNoResults; - /** - * Enables the advanced query syntax. - */ - advancedSyntax?: boolean; - /** - * A list of words that should be considered as optional when found in the query. - */ - optionalWords?: string[]; - /** - * List of attributes on which you want to disable the exact ranking criterion. - */ - disableExactOnAttributes?: string[]; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ - exactOnSingleWordQuery?: IndexSettingsAsSearchParamsExactOnSingleWordQuery; - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - */ - alternativesAsExact?: IndexSettingsAsSearchParamsAlternativesAsExact[]; - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled. - */ - advancedSyntaxFeatures?: IndexSettingsAsSearchParamsAdvancedSyntaxFeatures[]; - /** - * Enables de-duplication or grouping of results. - */ - distinct?: number; - /** - * Whether to take into account an index\'s synonyms for a particular search. - */ - synonyms?: boolean; - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. - */ - replaceSynonymsInHighlight?: boolean; - /** - * Precision of the proximity ranking criterion. - */ - minProximity?: number; - /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. - */ - responseFields?: string[]; - /** - * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. - */ - maxFacetHits?: number; - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. - */ - attributeCriteriaComputedByMinProximity?: boolean; - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - */ - renderingContent?: Record; -}; - -export type IndexSettingsAsSearchParamsTypoTolerance = - | 'false' - | 'min' - | 'strict' - | 'true'; - -export type IndexSettingsAsSearchParamsQueryType = - | 'prefixAll' - | 'prefixLast' - | 'prefixNone'; - -export type IndexSettingsAsSearchParamsRemoveWordsIfNoResults = - | 'allOptional' - | 'firstWords' - | 'lastWords' - | 'none'; - -export type IndexSettingsAsSearchParamsExactOnSingleWordQuery = - | 'attribute' - | 'none' - | 'word'; - -export type IndexSettingsAsSearchParamsAlternativesAsExact = - | 'ignorePlurals' - | 'multiWordsSynonym' - | 'singleWordSynonym'; - -export type IndexSettingsAsSearchParamsAdvancedSyntaxFeatures = - | 'exactPhrase' - | 'excludeWords'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts deleted file mode 100644 index b5c963c297..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/indice.ts +++ /dev/null @@ -1,46 +0,0 @@ -export type Indice = { - /** - * Index name. - */ - name: string; - /** - * Index creation date. An empty string means that the index has no records. - */ - createdAt: string; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; - /** - * Number of records contained in the index. - */ - entries: number; - /** - * Number of bytes of the index in minified format. - */ - dataSize: number; - /** - * Number of bytes of the index binary file. - */ - fileSize: number; - /** - * Last build time. - */ - lastBuildTimeS: number; - /** - * Number of pending indexing operations. This value is deprecated and should not be used. - */ - numberOfPendingTask?: number; - /** - * A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. - */ - pendingTask: boolean; - /** - * Only present if the index is a replica. Contains the name of the related primary index. - */ - primary?: string; - /** - * Only present if the index is a primary index with replicas. Contains the names of all linked replicas. - */ - replicas?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/key.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/key.ts deleted file mode 100644 index d85de7bdd2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/key.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ApiKey } from './apiKey'; -import type { CreatedAtObject } from './createdAtObject'; - -export type Key = ApiKey & CreatedAtObject; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts deleted file mode 100644 index 618cea65a3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/languages.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { DictionaryLanguage } from './dictionaryLanguage'; - -/** - * A dictionary language. - */ -export type Languages = { - plurals: DictionaryLanguage | null; - stopwords: DictionaryLanguage | null; - compounds: DictionaryLanguage | null; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts deleted file mode 100644 index 4a3b978db4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listApiKeysResponse.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Key } from './key'; - -export type ListApiKeysResponse = { - /** - * List of api keys. - */ - keys: Key[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts deleted file mode 100644 index 245e8b9d00..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listClustersResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Array of clusters. - */ -export type ListClustersResponse = { - /** - * Mapping of cluster names to top users. - */ - topUsers: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts deleted file mode 100644 index c89d4922ff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listIndicesResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Indice } from './indice'; - -export type ListIndicesResponse = { - /** - * List of the fetched indices. - */ - items?: Indice[]; - /** - * Number of pages. - */ - nbPages?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts deleted file mode 100644 index c0d9d9c1a9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/listUserIdsResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { UserId } from './userId'; - -/** - * UserIDs data. - */ -export type ListUserIdsResponse = { - /** - * List of userIDs. - */ - userIDs: UserId[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/models.ts deleted file mode 100644 index 77ec5fbfeb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/models.ts +++ /dev/null @@ -1,613 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { Action } from './action'; -import { AddApiKeyResponse } from './addApiKeyResponse'; -import { Anchoring } from './anchoring'; -import { ApiKey } from './apiKey'; -import { AssignUserIdParams } from './assignUserIdParams'; -import { AutomaticFacetFilter } from './automaticFacetFilter'; -import { BaseBrowseResponse } from './baseBrowseResponse'; -import { BaseIndexSettings } from './baseIndexSettings'; -import { BaseSearchParams } from './baseSearchParams'; -import { BaseSearchResponse } from './baseSearchResponse'; -import { BaseSearchResponseFacetsStats } from './baseSearchResponseFacetsStats'; -import { BatchAssignUserIdsParams } from './batchAssignUserIdsParams'; -import { BatchDictionaryEntriesParams } from './batchDictionaryEntriesParams'; -import { BatchDictionaryEntriesRequest } from './batchDictionaryEntriesRequest'; -import { BatchParams } from './batchParams'; -import { BatchResponse } from './batchResponse'; -import { BatchWriteParams } from './batchWriteParams'; -import { BrowseRequest } from './browseRequest'; -import { BrowseResponse } from './browseResponse'; -import { BuiltInOperation } from './builtInOperation'; -import { Condition } from './condition'; -import { Consequence } from './consequence'; -import { ConsequenceHide } from './consequenceHide'; -import { ConsequenceParams } from './consequenceParams'; -import { CreatedAtObject } from './createdAtObject'; -import { CreatedAtResponse } from './createdAtResponse'; -import { DeleteApiKeyResponse } from './deleteApiKeyResponse'; -import { DeleteSourceResponse } from './deleteSourceResponse'; -import { DeletedAtResponse } from './deletedAtResponse'; -import { DictionaryAction } from './dictionaryAction'; -import { DictionaryEntry } from './dictionaryEntry'; -import { DictionaryEntryState } from './dictionaryEntryState'; -import { DictionaryLanguage } from './dictionaryLanguage'; -import { DictionarySettingsParams } from './dictionarySettingsParams'; -import { ErrorBase } from './errorBase'; -import { GetDictionarySettingsResponse } from './getDictionarySettingsResponse'; -import { GetLogsResponse } from './getLogsResponse'; -import { GetLogsResponseInnerQueries } from './getLogsResponseInnerQueries'; -import { GetLogsResponseLogs } from './getLogsResponseLogs'; -import { GetObjectsParams } from './getObjectsParams'; -import { GetObjectsResponse } from './getObjectsResponse'; -import { GetTaskResponse } from './getTaskResponse'; -import { GetTopUserIdsResponse } from './getTopUserIdsResponse'; -import { HighlightResult } from './highlightResult'; -import { Hit } from './hit'; -import { IndexSettings } from './indexSettings'; -import { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import { Indice } from './indice'; -import { Key } from './key'; -import { Languages } from './languages'; -import { ListApiKeysResponse } from './listApiKeysResponse'; -import { ListClustersResponse } from './listClustersResponse'; -import { ListIndicesResponse } from './listIndicesResponse'; -import { ListUserIdsResponse } from './listUserIdsResponse'; -import { MultipleBatchResponse } from './multipleBatchResponse'; -import { MultipleGetObjectsParams } from './multipleGetObjectsParams'; -import { MultipleQueries } from './multipleQueries'; -import { MultipleQueriesParams } from './multipleQueriesParams'; -import { MultipleQueriesResponse } from './multipleQueriesResponse'; -import { MultipleQueriesStrategy } from './multipleQueriesStrategy'; -import { MultipleQueriesType } from './multipleQueriesType'; -import { Operation } from './operation'; -import { OperationIndexParams } from './operationIndexParams'; -import { OperationType } from './operationType'; -import { Params } from './params'; -import { Promote } from './promote'; -import { RankingInfo } from './rankingInfo'; -import { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; -import { RemoveUserIdResponse } from './removeUserIdResponse'; -import { ReplaceSourceResponse } from './replaceSourceResponse'; -import { RequiredSearchParams } from './requiredSearchParams'; -import { Rule } from './rule'; -import { SaveObjectResponse } from './saveObjectResponse'; -import { SaveSynonymResponse } from './saveSynonymResponse'; -import { ScopeType } from './scopeType'; -import { SearchDictionaryEntriesParams } from './searchDictionaryEntriesParams'; -import { SearchForFacetValuesRequest } from './searchForFacetValuesRequest'; -import { SearchForFacetValuesResponse } from './searchForFacetValuesResponse'; -import { SearchForFacetValuesResponseFacetHits } from './searchForFacetValuesResponseFacetHits'; -import { SearchHits } from './searchHits'; -import { SearchParams } from './searchParams'; -import { SearchParamsObject } from './searchParamsObject'; -import { SearchParamsString } from './searchParamsString'; -import { SearchResponse } from './searchResponse'; -import { SearchRulesParams } from './searchRulesParams'; -import { SearchRulesResponse } from './searchRulesResponse'; -import { SearchSynonymsResponse } from './searchSynonymsResponse'; -import { SearchUserIdsParams } from './searchUserIdsParams'; -import { SearchUserIdsResponse } from './searchUserIdsResponse'; -import { SearchUserIdsResponseHighlightResult } from './searchUserIdsResponseHighlightResult'; -import { SearchUserIdsResponseHits } from './searchUserIdsResponseHits'; -import { SnippetResult } from './snippetResult'; -import { Source } from './source'; -import { StandardEntries } from './standardEntries'; -import { SynonymHit } from './synonymHit'; -import { SynonymHitHighlightResult } from './synonymHitHighlightResult'; -import { SynonymType } from './synonymType'; -import { TimeRange } from './timeRange'; -import { UpdateApiKeyResponse } from './updateApiKeyResponse'; -import { UpdatedAtResponse } from './updatedAtResponse'; -import { UpdatedAtWithObjectIdResponse } from './updatedAtWithObjectIdResponse'; -import { UpdatedRuleResponse } from './updatedRuleResponse'; -import { UserId } from './userId'; - -export * from './action'; -export * from './addApiKeyResponse'; -export * from './anchoring'; -export * from './apiKey'; -export * from './assignUserIdParams'; -export * from './automaticFacetFilter'; -export * from './baseBrowseResponse'; -export * from './baseIndexSettings'; -export * from './baseSearchParams'; -export * from './baseSearchResponse'; -export * from './baseSearchResponseFacetsStats'; -export * from './batchAssignUserIdsParams'; -export * from './batchDictionaryEntriesParams'; -export * from './batchDictionaryEntriesRequest'; -export * from './batchParams'; -export * from './batchResponse'; -export * from './batchWriteParams'; -export * from './browseRequest'; -export * from './browseResponse'; -export * from './builtInOperation'; -export * from './condition'; -export * from './consequence'; -export * from './consequenceHide'; -export * from './consequenceParams'; -export * from './createdAtObject'; -export * from './createdAtResponse'; -export * from './deleteApiKeyResponse'; -export * from './deleteSourceResponse'; -export * from './deletedAtResponse'; -export * from './dictionaryAction'; -export * from './dictionaryEntry'; -export * from './dictionaryEntryState'; -export * from './dictionaryLanguage'; -export * from './dictionarySettingsParams'; -export * from './errorBase'; -export * from './getDictionarySettingsResponse'; -export * from './getLogsResponse'; -export * from './getLogsResponseInnerQueries'; -export * from './getLogsResponseLogs'; -export * from './getObjectsParams'; -export * from './getObjectsResponse'; -export * from './getTaskResponse'; -export * from './getTopUserIdsResponse'; -export * from './highlightResult'; -export * from './hit'; -export * from './indexSettings'; -export * from './indexSettingsAsSearchParams'; -export * from './indice'; -export * from './key'; -export * from './languages'; -export * from './listApiKeysResponse'; -export * from './listClustersResponse'; -export * from './listIndicesResponse'; -export * from './listUserIdsResponse'; -export * from './multipleBatchResponse'; -export * from './multipleGetObjectsParams'; -export * from './multipleQueries'; -export * from './multipleQueriesParams'; -export * from './multipleQueriesResponse'; -export * from './multipleQueriesStrategy'; -export * from './multipleQueriesType'; -export * from './operation'; -export * from './operationIndexParams'; -export * from './operationType'; -export * from './params'; -export * from './promote'; -export * from './rankingInfo'; -export * from './rankingInfoMatchedGeoLocation'; -export * from './removeUserIdResponse'; -export * from './replaceSourceResponse'; -export * from './requiredSearchParams'; -export * from './rule'; -export * from './saveObjectResponse'; -export * from './saveSynonymResponse'; -export * from './scopeType'; -export * from './searchDictionaryEntriesParams'; -export * from './searchForFacetValuesRequest'; -export * from './searchForFacetValuesResponse'; -export * from './searchForFacetValuesResponseFacetHits'; -export * from './searchHits'; -export * from './searchParams'; -export * from './searchParamsObject'; -export * from './searchParamsString'; -export * from './searchResponse'; -export * from './searchRulesParams'; -export * from './searchRulesResponse'; -export * from './searchSynonymsResponse'; -export * from './searchUserIdsParams'; -export * from './searchUserIdsResponse'; -export * from './searchUserIdsResponseHighlightResult'; -export * from './searchUserIdsResponseHits'; -export * from './snippetResult'; -export * from './source'; -export * from './standardEntries'; -export * from './synonymHit'; -export * from './synonymHitHighlightResult'; -export * from './synonymType'; -export * from './timeRange'; -export * from './updateApiKeyResponse'; -export * from './updatedAtResponse'; -export * from './updatedAtWithObjectIdResponse'; -export * from './updatedRuleResponse'; -export * from './userId'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = { - Action, - Anchoring, - 'ApiKey.AclEnum': ApiKey.AclEnum, - 'BuiltInOperation.OperationEnum': BuiltInOperation.OperationEnum, - 'ConsequenceParams.TypoToleranceEnum': ConsequenceParams.TypoToleranceEnum, - 'ConsequenceParams.QueryTypeEnum': ConsequenceParams.QueryTypeEnum, - 'ConsequenceParams.RemoveWordsIfNoResultsEnum': - ConsequenceParams.RemoveWordsIfNoResultsEnum, - 'ConsequenceParams.ExactOnSingleWordQueryEnum': - ConsequenceParams.ExactOnSingleWordQueryEnum, - 'ConsequenceParams.AlternativesAsExactEnum': - ConsequenceParams.AlternativesAsExactEnum, - 'ConsequenceParams.AdvancedSyntaxFeaturesEnum': - ConsequenceParams.AdvancedSyntaxFeaturesEnum, - DictionaryAction, - DictionaryEntryState, - 'GetTaskResponse.StatusEnum': GetTaskResponse.StatusEnum, - 'HighlightResult.MatchLevelEnum': HighlightResult.MatchLevelEnum, - 'IndexSettings.TypoToleranceEnum': IndexSettings.TypoToleranceEnum, - 'IndexSettings.QueryTypeEnum': IndexSettings.QueryTypeEnum, - 'IndexSettings.RemoveWordsIfNoResultsEnum': - IndexSettings.RemoveWordsIfNoResultsEnum, - 'IndexSettings.ExactOnSingleWordQueryEnum': - IndexSettings.ExactOnSingleWordQueryEnum, - 'IndexSettings.AlternativesAsExactEnum': - IndexSettings.AlternativesAsExactEnum, - 'IndexSettings.AdvancedSyntaxFeaturesEnum': - IndexSettings.AdvancedSyntaxFeaturesEnum, - 'IndexSettingsAsSearchParams.TypoToleranceEnum': - IndexSettingsAsSearchParams.TypoToleranceEnum, - 'IndexSettingsAsSearchParams.QueryTypeEnum': - IndexSettingsAsSearchParams.QueryTypeEnum, - 'IndexSettingsAsSearchParams.RemoveWordsIfNoResultsEnum': - IndexSettingsAsSearchParams.RemoveWordsIfNoResultsEnum, - 'IndexSettingsAsSearchParams.ExactOnSingleWordQueryEnum': - IndexSettingsAsSearchParams.ExactOnSingleWordQueryEnum, - 'IndexSettingsAsSearchParams.AlternativesAsExactEnum': - IndexSettingsAsSearchParams.AlternativesAsExactEnum, - 'IndexSettingsAsSearchParams.AdvancedSyntaxFeaturesEnum': - IndexSettingsAsSearchParams.AdvancedSyntaxFeaturesEnum, - 'Key.AclEnum': Key.AclEnum, - MultipleQueriesStrategy, - MultipleQueriesType, - OperationType, - ScopeType, - 'SearchParams.TypoToleranceEnum': SearchParams.TypoToleranceEnum, - 'SearchParams.QueryTypeEnum': SearchParams.QueryTypeEnum, - 'SearchParams.RemoveWordsIfNoResultsEnum': - SearchParams.RemoveWordsIfNoResultsEnum, - 'SearchParams.ExactOnSingleWordQueryEnum': - SearchParams.ExactOnSingleWordQueryEnum, - 'SearchParams.AlternativesAsExactEnum': SearchParams.AlternativesAsExactEnum, - 'SearchParams.AdvancedSyntaxFeaturesEnum': - SearchParams.AdvancedSyntaxFeaturesEnum, - 'SearchParamsObject.TypoToleranceEnum': SearchParamsObject.TypoToleranceEnum, - 'SearchParamsObject.QueryTypeEnum': SearchParamsObject.QueryTypeEnum, - 'SearchParamsObject.RemoveWordsIfNoResultsEnum': - SearchParamsObject.RemoveWordsIfNoResultsEnum, - 'SearchParamsObject.ExactOnSingleWordQueryEnum': - SearchParamsObject.ExactOnSingleWordQueryEnum, - 'SearchParamsObject.AlternativesAsExactEnum': - SearchParamsObject.AlternativesAsExactEnum, - 'SearchParamsObject.AdvancedSyntaxFeaturesEnum': - SearchParamsObject.AdvancedSyntaxFeaturesEnum, - 'SnippetResult.MatchLevelEnum': SnippetResult.MatchLevelEnum, - SynonymType, -}; - -const typeMap: { [index: string]: any } = { - AddApiKeyResponse, - ApiKey, - AssignUserIdParams, - AutomaticFacetFilter, - BaseBrowseResponse, - BaseIndexSettings, - BaseSearchParams, - BaseSearchResponse, - BaseSearchResponseFacetsStats, - BatchAssignUserIdsParams, - BatchDictionaryEntriesParams, - BatchDictionaryEntriesRequest, - BatchParams, - BatchResponse, - BatchWriteParams, - BrowseRequest, - BrowseResponse, - BuiltInOperation, - Condition, - Consequence, - ConsequenceHide, - ConsequenceParams, - CreatedAtObject, - CreatedAtResponse, - DeleteApiKeyResponse, - DeleteSourceResponse, - DeletedAtResponse, - DictionaryEntry, - DictionaryLanguage, - DictionarySettingsParams, - ErrorBase, - GetDictionarySettingsResponse, - GetLogsResponse, - GetLogsResponseInnerQueries, - GetLogsResponseLogs, - GetObjectsParams, - GetObjectsResponse, - GetTaskResponse, - GetTopUserIdsResponse, - HighlightResult, - Hit, - IndexSettings, - IndexSettingsAsSearchParams, - Indice, - Key, - Languages, - ListApiKeysResponse, - ListClustersResponse, - ListIndicesResponse, - ListUserIdsResponse, - MultipleBatchResponse, - MultipleGetObjectsParams, - MultipleQueries, - MultipleQueriesParams, - MultipleQueriesResponse, - Operation, - OperationIndexParams, - Params, - Promote, - RankingInfo, - RankingInfoMatchedGeoLocation, - RemoveUserIdResponse, - ReplaceSourceResponse, - RequiredSearchParams, - Rule, - SaveObjectResponse, - SaveSynonymResponse, - SearchDictionaryEntriesParams, - SearchForFacetValuesRequest, - SearchForFacetValuesResponse, - SearchForFacetValuesResponseFacetHits, - SearchHits, - SearchParams, - SearchParamsObject, - SearchParamsString, - SearchResponse, - SearchRulesParams, - SearchRulesResponse, - SearchSynonymsResponse, - SearchUserIdsParams, - SearchUserIdsResponse, - SearchUserIdsResponseHighlightResult, - SearchUserIdsResponseHits, - SnippetResult, - Source, - StandardEntries, - SynonymHit, - SynonymHitHighlightResult, - TimeRange, - UpdateApiKeyResponse, - UpdatedAtResponse, - UpdatedAtWithObjectIdResponse, - UpdatedRuleResponse, - UserId, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts deleted file mode 100644 index 09863f02bd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type MultipleBatchResponse = { - /** - * List of tasksIDs per index. - */ - taskID?: Record; - /** - * List of objectID. - */ - objectIDs?: string[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts deleted file mode 100644 index 0779eac6d1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleGetObjectsParams.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * GetObjects operation on an index. - */ -export type MultipleGetObjectsParams = { - /** - * List of attributes to retrieve. By default, all retrievable attributes are returned. - */ - attributesToRetrieve?: string[]; - /** - * ID of the object within that index. - */ - objectID: string; - /** - * Name of the index containing the object. - */ - indexName: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts deleted file mode 100644 index 1096b0c8fa..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { MultipleQueriesType } from './multipleQueriesType'; - -export type MultipleQueries = { - /** - * The Algolia index name. - */ - indexName: string; - /** - * The text to search in the index. - */ - query?: string; - type?: MultipleQueriesType; - /** - * The `facet` name. - */ - facet?: string; - /** - * A query string of search parameters. - */ - params?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts deleted file mode 100644 index eef22ed29f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { MultipleQueries } from './multipleQueries'; -import type { MultipleQueriesStrategy } from './multipleQueriesStrategy'; - -export type MultipleQueriesParams = { - requests: MultipleQueries[]; - strategy?: MultipleQueriesStrategy; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts deleted file mode 100644 index 7d96feba7b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SearchResponse } from './searchResponse'; - -export type MultipleQueriesResponse = { - results?: SearchResponse[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts deleted file mode 100644 index 5090359e8e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts +++ /dev/null @@ -1 +0,0 @@ -export type MultipleQueriesStrategy = 'none' | 'stopIfEnoughMatches'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts deleted file mode 100644 index cd27b91929..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Perform a search query with `default`, will search for facet values if `facet` is given. - */ - -export type MultipleQueriesType = 'default' | 'facet'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts deleted file mode 100644 index bc80b8fbbd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/operation.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Action } from './action'; - -export type Operation = { - action?: Action; - /** - * Arguments to the operation (depends on the type of the operation). - */ - body?: Record; - /** - * Index to target for this operation. - */ - indexName?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts deleted file mode 100644 index 90da3e1e22..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/operationIndexParams.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { OperationType } from './operationType'; -import type { ScopeType } from './scopeType'; - -export type OperationIndexParams = { - operation: OperationType; - /** - * The Algolia index name. - */ - destination: string; - /** - * Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. - */ - scope?: ScopeType[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts deleted file mode 100644 index 9d7bab7040..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/operationType.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Type of operation to perform (move or copy). - */ - -export type OperationType = 'copy' | 'move'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/params.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/params.ts deleted file mode 100644 index 59c91f2bc1..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/params.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { AutomaticFacetFilter } from './automaticFacetFilter'; - -/** - * Additional search parameters. Any valid search parameter is allowed. - */ -export type Params = { - /** - * Query string. - */ - query?: string; - /** - * Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern. - */ - automaticFacetFilters?: AutomaticFacetFilter[]; - /** - * Same syntax as automaticFacetFilters, but the engine treats the filters as optional. - */ - automaticOptionalFacetFilters?: AutomaticFacetFilter[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts deleted file mode 100644 index 915ad295da..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/promote.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Object to promote as hits. - */ -export type Promote = { - /** - * Unique identifier of the object to promote. - */ - objectID?: string; - /** - * Array of unique identifiers of the objects to promote. - */ - objectIDs?: string[]; - /** - * The position to promote the objects to (zero-based). If you pass objectIDs, the objects are placed at this position as a group. For example, if you pass four objectIDs to position 0, the objects take the first four positions. - */ - position: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts deleted file mode 100644 index c14a767726..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; - -export type RankingInfo = { - /** - * This field is reserved for advanced usage. - */ - filters?: number; - /** - * Position of the most important matched attribute in the attributes to index list. - */ - firstMatchedWord?: number; - /** - * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). - */ - geoDistance?: number; - /** - * Precision used when computing the geo distance, in meters. - */ - geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; - /** - * Number of exactly matched words. - */ - nbExactWords?: number; - /** - * Number of typos encountered when matching the record. - */ - nbTypos?: number; - /** - * Present and set to true if a Rule promoted the hit. - */ - promoted?: boolean; - /** - * When the query contains more than one word, the sum of the distances between matched words (in meters). - */ - proximityDistance?: number; - /** - * Custom ranking for the object, expressed as a single integer value. - */ - userScore?: number; - /** - * Number of matched words, including prefixes and typos. - */ - word?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts deleted file mode 100644 index bc9ce84718..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfoMatchedGeoLocation.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type RankingInfoMatchedGeoLocation = { - /** - * Latitude of the matched location. - */ - lat?: number; - /** - * Longitude of the matched location. - */ - lng?: number; - /** - * Distance between the matched location and the search location (in meters). - */ - distance?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts deleted file mode 100644 index 8326ce561d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/removeUserIdResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RemoveUserIdResponse = { - /** - * Date of deletion (ISO-8601 format). - */ - deletedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts deleted file mode 100644 index 6800a2a53f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/replaceSourceResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type ReplaceSourceResponse = { - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts deleted file mode 100644 index e65265a403..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rule.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { Condition } from './condition'; -import type { Consequence } from './consequence'; -import type { TimeRange } from './timeRange'; - -/** - * Rule object. - */ -export type Rule = { - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule. - */ - conditions?: Condition[]; - consequence: Consequence; - /** - * This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It\'s not interpreted by the API. - */ - description?: string; - /** - * Whether the Rule is enabled. Disabled Rules remain in the index, but aren\'t applied at query time. - */ - enabled?: boolean; - /** - * By default, Rules are permanently valid. When validity periods are specified, the Rule applies only during those periods; it\'s ignored the rest of the time. The list must not be empty. - */ - validity?: TimeRange[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts deleted file mode 100644 index 03a99554e4..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/saveObjectResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type SaveObjectResponse = { - createdAt?: string; - /** - * TaskID of the task to wait for. - */ - taskID?: number; - /** - * Unique identifier of the object. - */ - objectID?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts deleted file mode 100644 index 5c83340b46..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/saveSynonymResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type SaveSynonymResponse = { - /** - * TaskID of the task to wait for. - */ - taskID: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; - /** - * ObjectID of the inserted object. - */ - id: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts deleted file mode 100644 index ea19044f2d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/scopeType.ts +++ /dev/null @@ -1 +0,0 @@ -export type ScopeType = 'rules' | 'settings' | 'synonyms'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts deleted file mode 100644 index 4f9b7a158f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchDictionaryEntriesParams.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * The `searchDictionaryEntries` parameters. - */ -export type SearchDictionaryEntriesParams = { - /** - * The text to search in the index. - */ - query: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; - /** - * Language ISO code supported by the dictionary (e.g., \"en\" for English). - */ - language?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts deleted file mode 100644 index f7147f3d3e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type SearchForFacetValuesRequest = { - /** - * Search parameters as URL-encoded query string. - */ - params?: string; - /** - * Text to search inside the facet\'s values. - */ - facetQuery?: string; - /** - * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. - */ - maxFacetHits?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts deleted file mode 100644 index 971b0f6b56..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SearchForFacetValuesResponseFacetHits } from './searchForFacetValuesResponseFacetHits'; - -export type SearchForFacetValuesResponse = { - facetHits: SearchForFacetValuesResponseFacetHits[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts deleted file mode 100644 index 08b3ae166a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchForFacetValuesResponseFacetHits.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type SearchForFacetValuesResponseFacetHits = { - /** - * Raw value of the facet. - */ - value: string; - /** - * Markup text with occurrences highlighted. - */ - highlighted: string; - /** - * How many objects contain this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the counts may not be exhaustive. - */ - count: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts deleted file mode 100644 index ca99c320ef..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchHits.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Hit } from './hit'; - -export type SearchHits = { - hits?: Hit[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts deleted file mode 100644 index b1675283bb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParams.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { SearchParamsObject } from './searchParamsObject'; -import type { SearchParamsString } from './searchParamsString'; - -export type SearchParams = SearchParamsObject | SearchParamsString; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts deleted file mode 100644 index ad8f80c073..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsObject.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import type { RequiredSearchParams } from './requiredSearchParams'; - -export type SearchParamsObject = BaseSearchParams & - IndexSettingsAsSearchParams & - RequiredSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts deleted file mode 100644 index 3aff58347d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchParamsString.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type SearchParamsString = { - /** - * Search parameters as URL-encoded query string. - */ - params?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts deleted file mode 100644 index 369e1d297c..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchResponse.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseSearchResponse } from './baseSearchResponse'; -import type { SearchHits } from './searchHits'; - -export type SearchResponse = BaseSearchResponse & SearchHits; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts deleted file mode 100644 index afa60a07d7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesParams.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Anchoring } from './anchoring'; - -/** - * Parameters for the search. - */ -export type SearchRulesParams = { - /** - * Full text query. - */ - query?: string; - anchoring?: Anchoring; - /** - * Restricts matches to contextual rules with a specific context (exact match). - */ - context?: string; - /** - * Requested page (zero-based). - */ - page?: number; - /** - * Maximum number of hits in a page. Minimum is 1, maximum is 1000. - */ - hitsPerPage?: number; - /** - * When specified, restricts matches to rules with a specific enabled status. When absent (default), all rules are retrieved, regardless of their enabled status. - */ - enabled?: boolean; - /** - * A mapping of requestOptions to send along with the request. - */ - requestOptions?: Array>; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts deleted file mode 100644 index ce4f100e43..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchRulesResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Rule } from './rule'; - -export type SearchRulesResponse = { - /** - * Fetched rules. - */ - hits: Rule[]; - /** - * Number of fetched rules. - */ - nbHits: number; - /** - * Current page. - */ - page: number; - /** - * Number of pages. - */ - nbPages: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts deleted file mode 100644 index b50c74feac..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchSynonymsResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { SynonymHit } from './synonymHit'; - -export type SearchSynonymsResponse = { - /** - * Array of synonym objects. - */ - hits: SynonymHit[]; - /** - * Number of hits that the search query matched. - */ - nbHits: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts deleted file mode 100644 index 6611c71619..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsParams.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * OK. - */ -export type SearchUserIdsParams = { - /** - * Query to search. The search is a prefix search with typoTolerance. Use empty query to retrieve all users. - */ - query: string; - /** - * Name of the cluster. - */ - clusterName?: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts deleted file mode 100644 index 6434c679b6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { SearchUserIdsResponseHits } from './searchUserIdsResponseHits'; - -/** - * UserIDs data. - */ -export type SearchUserIdsResponse = { - /** - * List of user object matching the query. - */ - hits: SearchUserIdsResponseHits[]; - /** - * Number of hits that the search query matched. - */ - nbHits: number; - /** - * Specify the page to retrieve. - */ - page: number; - /** - * Maximum number of hits in a page. Minimum is 1, maximum is 1000. - */ - hitsPerPage: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts deleted file mode 100644 index 6f575186df..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHighlightResult.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { HighlightResult } from './highlightResult'; - -export type SearchUserIdsResponseHighlightResult = { - userID: HighlightResult; - clusterName: HighlightResult; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts deleted file mode 100644 index cc24f82cf0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/searchUserIdsResponseHits.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { SearchUserIdsResponseHighlightResult } from './searchUserIdsResponseHighlightResult'; - -export type SearchUserIdsResponseHits = { - /** - * UserID of the user. - */ - userID: string; - /** - * Name of the cluster. - */ - clusterName: string; - /** - * Number of records in the cluster. - */ - nbRecords: number; - /** - * Data size taken by all the users assigned to the cluster. - */ - dataSize: number; - /** - * UserID of the requested user. Same as userID. - */ - objectID: string; - _highlightResult: SearchUserIdsResponseHighlightResult; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts deleted file mode 100644 index 0f8d17bc3d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/snippetResult.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type SnippetResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: SnippetResultMatchLevel; -}; - -export type SnippetResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/source.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/source.ts deleted file mode 100644 index 79813c184a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/source.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The source. - */ -export type Source = { - /** - * The IP range of the source. - */ - source: string; - /** - * The description of the source. - */ - description?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts deleted file mode 100644 index f7b9e505bf..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/standardEntries.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Map of language ISO code supported by the dictionary (e.g., \"en\" for English) to a boolean value. - */ -export type StandardEntries = { - /** - * Language ISO code. - */ - plurals?: { [key: string]: boolean } | null; - /** - * Language ISO code. - */ - stopwords?: { [key: string]: boolean } | null; - /** - * Language ISO code. - */ - compounds?: { [key: string]: boolean } | null; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts deleted file mode 100644 index 2bbe5dbe11..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHit.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { SynonymHitHighlightResult } from './synonymHitHighlightResult'; -import type { SynonymType } from './synonymType'; - -/** - * Synonym object. - */ -export type SynonymHit = { - /** - * Unique identifier of the synonym object to be created or updated. - */ - objectID: string; - type: SynonymType; - /** - * Words or phrases to be considered equivalent. - */ - synonyms?: string[]; - /** - * Word or phrase to appear in query strings (for onewaysynonym). - */ - input?: string; - /** - * Word or phrase to appear in query strings (for altcorrection1 and altcorrection2). - */ - word?: string; - /** - * Words to be matched in records. - */ - corrections?: string[]; - /** - * Token to be put inside records. - */ - placeholder?: string; - /** - * List of query words that will match the token. - */ - replacements?: string[]; - _highlightResult?: SynonymHitHighlightResult; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts deleted file mode 100644 index 6d47548143..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymHitHighlightResult.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { HighlightResult } from './highlightResult'; - -/** - * Highlighted results. - */ -export type SynonymHitHighlightResult = { - type?: HighlightResult; - synonyms?: HighlightResult[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts deleted file mode 100644 index f7a6b44452..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/synonymType.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Type of the synonym object. - */ - -export type SynonymType = - | 'altcorrection1' - | 'altcorrection2' - | 'onewaysynonym' - | 'placeholder' - | 'synonym'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts deleted file mode 100644 index 2c0a2444fd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/timeRange.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type TimeRange = { - /** - * Lower bound of the time range (Unix timestamp). - */ - from: number; - /** - * Upper bound of the time range (Unix timestamp). - */ - until: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts deleted file mode 100644 index 5bf38cb912..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updateApiKeyResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type UpdateApiKeyResponse = { - /** - * Key string. - */ - key: string; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts deleted file mode 100644 index 90755a3379..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The response with a taskID and an updatedAt timestamp. - */ -export type UpdatedAtResponse = { - /** - * TaskID of the task to wait for. - */ - taskID: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts deleted file mode 100644 index 5ace1ab507..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedAtWithObjectIdResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * The response with a taskID, an objectID and an updatedAt timestamp. - */ -export type UpdatedAtWithObjectIdResponse = { - /** - * TaskID of the task to wait for. - */ - taskID?: number; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt?: string; - /** - * Unique identifier of the object. - */ - objectID?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts deleted file mode 100644 index b47eae6e23..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/updatedRuleResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type UpdatedRuleResponse = { - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * Date of last update (ISO-8601 format). - */ - updatedAt: string; - /** - * TaskID of the task to wait for. - */ - taskID: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts deleted file mode 100644 index a79a52f2bd..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/userId.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A userID. - */ -export type UserId = { - /** - * UserID of the user. - */ - userID: string; - /** - * Cluster on which the user is assigned. - */ - clusterName: string; - /** - * Number of records belonging to the user. - */ - nbRecords: number; - /** - * Data size used by the user. - */ - dataSize: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/package.json b/clients/algoliasearch-client-javascript/packages/client-search/package.json deleted file mode 100644 index e21f555cd7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-search", - "version": "5.0.0", - "description": "JavaScript client for @algolia/client-search", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-search.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-search.umd.browser.js", - "unpkg": "dist/client-search.umd.browser.js", - "browser": "dist/client-search.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts deleted file mode 100644 index b99e6a7f89..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/src/searchApi.ts +++ /dev/null @@ -1,2932 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, - shuffle, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { AddApiKeyResponse } from '../model/addApiKeyResponse'; -import type { ApiKey } from '../model/apiKey'; -import type { AssignUserIdParams } from '../model/assignUserIdParams'; -import type { BatchAssignUserIdsParams } from '../model/batchAssignUserIdsParams'; -import type { BatchDictionaryEntriesParams } from '../model/batchDictionaryEntriesParams'; -import type { BatchParams } from '../model/batchParams'; -import type { BatchResponse } from '../model/batchResponse'; -import type { BatchWriteParams } from '../model/batchWriteParams'; -import type { BrowseRequest } from '../model/browseRequest'; -import type { BrowseResponse } from '../model/browseResponse'; -import type { BuiltInOperation } from '../model/builtInOperation'; -import type { CreatedAtResponse } from '../model/createdAtResponse'; -import type { DeleteApiKeyResponse } from '../model/deleteApiKeyResponse'; -import type { DeleteSourceResponse } from '../model/deleteSourceResponse'; -import type { DeletedAtResponse } from '../model/deletedAtResponse'; -import type { DictionarySettingsParams } from '../model/dictionarySettingsParams'; -import type { GetDictionarySettingsResponse } from '../model/getDictionarySettingsResponse'; -import type { GetLogsResponse } from '../model/getLogsResponse'; -import type { GetObjectsParams } from '../model/getObjectsParams'; -import type { GetObjectsResponse } from '../model/getObjectsResponse'; -import type { GetTaskResponse } from '../model/getTaskResponse'; -import type { GetTopUserIdsResponse } from '../model/getTopUserIdsResponse'; -import type { IndexSettings } from '../model/indexSettings'; -import type { Key } from '../model/key'; -import type { Languages } from '../model/languages'; -import type { ListApiKeysResponse } from '../model/listApiKeysResponse'; -import type { ListClustersResponse } from '../model/listClustersResponse'; -import type { ListIndicesResponse } from '../model/listIndicesResponse'; -import type { ListUserIdsResponse } from '../model/listUserIdsResponse'; -import type { MultipleBatchResponse } from '../model/multipleBatchResponse'; -import type { MultipleQueriesParams } from '../model/multipleQueriesParams'; -import type { MultipleQueriesResponse } from '../model/multipleQueriesResponse'; -import type { OperationIndexParams } from '../model/operationIndexParams'; -import type { RemoveUserIdResponse } from '../model/removeUserIdResponse'; -import type { ReplaceSourceResponse } from '../model/replaceSourceResponse'; -import type { Rule } from '../model/rule'; -import type { SaveObjectResponse } from '../model/saveObjectResponse'; -import type { SaveSynonymResponse } from '../model/saveSynonymResponse'; -import type { SearchDictionaryEntriesParams } from '../model/searchDictionaryEntriesParams'; -import type { SearchForFacetValuesRequest } from '../model/searchForFacetValuesRequest'; -import type { SearchForFacetValuesResponse } from '../model/searchForFacetValuesResponse'; -import type { SearchParams } from '../model/searchParams'; -import type { SearchResponse } from '../model/searchResponse'; -import type { SearchRulesParams } from '../model/searchRulesParams'; -import type { SearchRulesResponse } from '../model/searchRulesResponse'; -import type { SearchSynonymsResponse } from '../model/searchSynonymsResponse'; -import type { SearchUserIdsParams } from '../model/searchUserIdsParams'; -import type { SearchUserIdsResponse } from '../model/searchUserIdsResponse'; -import type { Source } from '../model/source'; -import type { SynonymHit } from '../model/synonymHit'; -import type { SynonymType } from '../model/synonymType'; -import type { UpdateApiKeyResponse } from '../model/updateApiKeyResponse'; -import type { UpdatedAtResponse } from '../model/updatedAtResponse'; -import type { UpdatedAtWithObjectIdResponse } from '../model/updatedAtWithObjectIdResponse'; -import type { UpdatedRuleResponse } from '../model/updatedRuleResponse'; -import type { UserId } from '../model/userId'; - -export const apiClientVersion = '5.0.0'; - -function getDefaultHosts(appId: string): Host[] { - return ( - [ - { - url: `${appId}-dsn.algolia.net`, - accept: 'read', - protocol: 'https', - }, - { - url: `${appId}.algolia.net`, - accept: 'write', - protocol: 'https', - }, - ] as Host[] - ).concat( - shuffle([ - { - url: `${appId}-1.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-2.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-3.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]) - ); -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createSearchApi(options: CreateClientOptions) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.appId), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Search', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Add a new API Key with specific permissions/restrictions. - * - * @summary Create a new API key. - * @param apiKey - The apiKey object. - */ - function addApiKey(apiKey: ApiKey): Promise { - const path = '/1/keys'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!apiKey) { - throw new Error( - 'Parameter `apiKey` is required when calling `addApiKey`.' - ); - } - - if (!apiKey.acl) { - throw new Error( - 'Parameter `apiKey.acl` is required when calling `addApiKey`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: apiKey, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Add or replace an object with a given object ID. If the object does not exist, it will be created. If it already exists, it will be replaced. - * - * @summary Add or replace an object with a given object ID. - * @param addOrUpdateObject - The addOrUpdateObject object. - * @param addOrUpdateObject.indexName - The index in which to perform the request. - * @param addOrUpdateObject.objectID - Unique identifier of an object. - * @param addOrUpdateObject.body - The Algolia object. - */ - function addOrUpdateObject({ - indexName, - objectID, - body, - }: AddOrUpdateObjectProps): Promise { - const path = '/1/indexes/{indexName}/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `addOrUpdateObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `addOrUpdateObject`.' - ); - } - - if (!body) { - throw new Error( - 'Parameter `body` is required when calling `addOrUpdateObject`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: body, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Add a single source to the list of allowed sources. - * - * @summary Add a single source. - * @param source - The source to add. - */ - function appendSource(source: Source): Promise { - const path = '/1/security/sources/append'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!source) { - throw new Error( - 'Parameter `source` is required when calling `appendSource`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: source, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Assign or Move a userID to a cluster. The time it takes to migrate (move) a user is proportional to the amount of data linked to the userID. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userID is directly usable. - * - * @summary Assign or Move userID. - * @param assignUserId - The assignUserId object. - * @param assignUserId.xAlgoliaUserID - UserID to assign. - * @param assignUserId.assignUserIdParams - The assignUserIdParams object. - */ - function assignUserId({ - xAlgoliaUserID, - assignUserIdParams, - }: AssignUserIdProps): Promise { - const path = '/1/clusters/mapping'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!xAlgoliaUserID) { - throw new Error( - 'Parameter `xAlgoliaUserID` is required when calling `assignUserId`.' - ); - } - - if (!assignUserIdParams) { - throw new Error( - 'Parameter `assignUserIdParams` is required when calling `assignUserId`.' - ); - } - - if (!assignUserIdParams.cluster) { - throw new Error( - 'Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.' - ); - } - - if (xAlgoliaUserID !== undefined) { - queryParameters['X-Algolia-User-ID'] = xAlgoliaUserID.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: assignUserIdParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Performs multiple write operations in a single API call. - * - * @summary Performs multiple write operations in a single API call. - * @param batch - The batch object. - * @param batch.indexName - The index in which to perform the request. - * @param batch.batchWriteParams - The batchWriteParams object. - */ - function batch({ - indexName, - batchWriteParams, - }: BatchProps): Promise { - const path = '/1/indexes/{indexName}/batch'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `batch`.' - ); - } - - if (!batchWriteParams) { - throw new Error( - 'Parameter `batchWriteParams` is required when calling `batch`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: batchWriteParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Assign multiple userIDs to a cluster. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable. - * - * @summary Batch assign userIDs. - * @param batchAssignUserIds - The batchAssignUserIds object. - * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign. - * @param batchAssignUserIds.batchAssignUserIdsParams - The batchAssignUserIdsParams object. - */ - function batchAssignUserIds({ - xAlgoliaUserID, - batchAssignUserIdsParams, - }: BatchAssignUserIdsProps): Promise { - const path = '/1/clusters/mapping/batch'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!xAlgoliaUserID) { - throw new Error( - 'Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.' - ); - } - - if (!batchAssignUserIdsParams) { - throw new Error( - 'Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.' - ); - } - - if (!batchAssignUserIdsParams.cluster) { - throw new Error( - 'Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.' - ); - } - if (!batchAssignUserIdsParams.users) { - throw new Error( - 'Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.' - ); - } - - if (xAlgoliaUserID !== undefined) { - queryParameters['X-Algolia-User-ID'] = xAlgoliaUserID.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: batchAssignUserIdsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Send a batch of dictionary entries. - * - * @summary Send a batch of dictionary entries. - * @param batchDictionaryEntries - The batchDictionaryEntries object. - * @param batchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param batchDictionaryEntries.batchDictionaryEntriesParams - The batchDictionaryEntriesParams object. - */ - function batchDictionaryEntries({ - dictionaryName, - batchDictionaryEntriesParams, - }: BatchDictionaryEntriesProps): Promise { - const path = '/1/dictionaries/{dictionaryName}/batch'.replace( - '{dictionaryName}', - encodeURIComponent(String(dictionaryName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!dictionaryName) { - throw new Error( - 'Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.' - ); - } - - if (!batchDictionaryEntriesParams) { - throw new Error( - 'Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.' - ); - } - - if (!batchDictionaryEntriesParams.requests) { - throw new Error( - 'Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: batchDictionaryEntriesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create or update a batch of Rules. - * - * @summary Batch Rules. - * @param batchRules - The batchRules object. - * @param batchRules.indexName - The index in which to perform the request. - * @param batchRules.rule - The rule object. - * @param batchRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - * @param batchRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. - */ - function batchRules({ - indexName, - rule, - forwardToReplicas, - clearExistingRules, - }: BatchRulesProps): Promise { - const path = '/1/indexes/{indexName}/rules/batch'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `batchRules`.' - ); - } - - if (!rule) { - throw new Error( - 'Parameter `rule` is required when calling `batchRules`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - if (clearExistingRules !== undefined) { - queryParameters.clearExistingRules = clearExistingRules.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: rule, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * This method allows you to retrieve all index content. It can retrieve up to 1,000 records per call and supports full text search and filters. For performance reasons, some features are not supported, including `distinct`, sorting by `typos`, `words` or `geo distance`. When there is more content to be browsed, the response contains a cursor field. This cursor has to be passed to the subsequent call to browse in order to get the next page of results. When the end of the index has been reached, the cursor field is absent from the response. - * - * @summary Retrieve all index content. - * @param browse - The browse object. - * @param browse.indexName - The index in which to perform the request. - * @param browse.browseRequest - The browseRequest object. - */ - function browse({ - indexName, - browseRequest, - }: BrowseProps): Promise { - const path = '/1/indexes/{indexName}/browse'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `browse`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: browseRequest, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove all synonyms from an index. - * - * @summary Clear all synonyms. - * @param clearAllSynonyms - The clearAllSynonyms object. - * @param clearAllSynonyms.indexName - The index in which to perform the request. - * @param clearAllSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function clearAllSynonyms({ - indexName, - forwardToReplicas, - }: ClearAllSynonymsProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/clear'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `clearAllSynonyms`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an index\'s content, but leave settings and index-specific API keys untouched. - * - * @summary Clear all objects from an index. - * @param clearObjects - The clearObjects object. - * @param clearObjects.indexName - The index in which to perform the request. - */ - function clearObjects({ - indexName, - }: ClearObjectsProps): Promise { - const path = '/1/indexes/{indexName}/clear'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `clearObjects`.' - ); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete all Rules in the index. - * - * @summary Clear Rules. - * @param clearRules - The clearRules object. - * @param clearRules.indexName - The index in which to perform the request. - * @param clearRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function clearRules({ - indexName, - forwardToReplicas, - }: ClearRulesProps): Promise { - const path = '/1/indexes/{indexName}/rules/clear'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `clearRules`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an existing API Key. - * - * @summary Delete an API key. - * @param deleteApiKey - The deleteApiKey object. - * @param deleteApiKey.key - API Key string. - */ - function deleteApiKey({ - key, - }: DeleteApiKeyProps): Promise { - const path = '/1/keys/{key}'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error( - 'Parameter `key` is required when calling `deleteApiKey`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove all objects matching a filter (including geo filters). This method enables you to delete one or more objects based on filters (numeric, facet, tag or geo queries). It doesn\'t accept empty filters or a query. - * - * @summary Delete all records matching the query. - * @param deleteBy - The deleteBy object. - * @param deleteBy.indexName - The index in which to perform the request. - * @param deleteBy.searchParams - The searchParams object. - */ - function deleteBy({ - indexName, - searchParams, - }: DeleteByProps): Promise { - const path = '/1/indexes/{indexName}/deleteByQuery'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteBy`.' - ); - } - - if (!searchParams) { - throw new Error( - 'Parameter `searchParams` is required when calling `deleteBy`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an existing index. - * - * @summary Delete index. - * @param deleteIndex - The deleteIndex object. - * @param deleteIndex.indexName - The index in which to perform the request. - */ - function deleteIndex({ - indexName, - }: DeleteIndexProps): Promise { - const path = '/1/indexes/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteIndex`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete an existing object. - * - * @summary Delete object. - * @param deleteObject - The deleteObject object. - * @param deleteObject.indexName - The index in which to perform the request. - * @param deleteObject.objectID - Unique identifier of an object. - */ - function deleteObject({ - indexName, - objectID, - }: DeleteObjectProps): Promise { - const path = '/1/indexes/{indexName}/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `deleteObject`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete the Rule with the specified objectID. - * - * @summary Delete a rule. - * @param deleteRule - The deleteRule object. - * @param deleteRule.indexName - The index in which to perform the request. - * @param deleteRule.objectID - Unique identifier of an object. - * @param deleteRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function deleteRule({ - indexName, - objectID, - forwardToReplicas, - }: DeleteRuleProps): Promise { - const path = '/1/indexes/{indexName}/rules/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteRule`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `deleteRule`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove a single source from the list of allowed sources. - * - * @summary Remove a single source. - * @param deleteSource - The deleteSource object. - * @param deleteSource.source - The IP range of the source. - */ - function deleteSource({ - source, - }: DeleteSourceProps): Promise { - const path = '/1/security/sources/{source}'.replace( - '{source}', - encodeURIComponent(String(source)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!source) { - throw new Error( - 'Parameter `source` is required when calling `deleteSource`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Delete a single synonyms set, identified by the given objectID. - * - * @summary Delete synonym. - * @param deleteSynonym - The deleteSynonym object. - * @param deleteSynonym.indexName - The index in which to perform the request. - * @param deleteSynonym.objectID - Unique identifier of an object. - * @param deleteSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function deleteSynonym({ - indexName, - objectID, - forwardToReplicas, - }: DeleteSynonymProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `deleteSynonym`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `deleteSynonym`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the permissions of an API key. - * - * @summary Get an API key. - * @param getApiKey - The getApiKey object. - * @param getApiKey.key - API Key string. - */ - function getApiKey({ key }: GetApiKeyProps): Promise { - const path = '/1/keys/{key}'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error('Parameter `key` is required when calling `getApiKey`.'); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List dictionaries supported per language. - * - * @summary List dictionaries supported per language. - */ - function getDictionaryLanguages(): Promise<{ [key: string]: Languages }> { - const path = '/1/dictionaries/*/languages'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve dictionaries settings. - * - * @summary Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. - */ - function getDictionarySettings(): Promise { - const path = '/1/dictionaries/*/settings'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Return the lastest log entries. - * - * @summary Return the lastest log entries. - * @param getLogs - The getLogs object. - * @param getLogs.offset - First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. - * @param getLogs.length - Maximum number of entries to retrieve. The maximum allowed value is 1000. - * @param getLogs.indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. - * @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved. - */ - function getLogs({ - offset, - length, - indexName, - type, - }: GetLogsProps): Promise { - const path = '/1/logs'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (offset !== undefined) { - queryParameters.offset = offset.toString(); - } - - if (length !== undefined) { - queryParameters.length = length.toString(); - } - - if (indexName !== undefined) { - queryParameters.indexName = indexName.toString(); - } - - if (type !== undefined) { - queryParameters.type = type.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve one object from the index. - * - * @summary Retrieve one object from the index. - * @param getObject - The getObject object. - * @param getObject.indexName - The index in which to perform the request. - * @param getObject.objectID - Unique identifier of an object. - * @param getObject.attributesToRetrieve - List of attributes to retrieve. If not specified, all retrievable attributes are returned. - */ - function getObject({ - indexName, - objectID, - attributesToRetrieve, - }: GetObjectProps): Promise<{ [key: string]: string }> { - const path = '/1/indexes/{indexName}/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `getObject`.' - ); - } - - if (attributesToRetrieve !== undefined) { - queryParameters.attributesToRetrieve = attributesToRetrieve.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve one or more objects, potentially from different indices, in a single API call. - * - * @summary Retrieve one or more objects. - * @param getObjectsParams - The getObjectsParams object. - */ - function getObjects( - getObjectsParams: GetObjectsParams - ): Promise { - const path = '/1/indexes/*/objects'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!getObjectsParams) { - throw new Error( - 'Parameter `getObjectsParams` is required when calling `getObjects`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: getObjectsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve the Rule with the specified objectID. - * - * @summary Get a rule. - * @param getRule - The getRule object. - * @param getRule.indexName - The index in which to perform the request. - * @param getRule.objectID - Unique identifier of an object. - */ - function getRule({ indexName, objectID }: GetRuleProps): Promise { - const path = '/1/indexes/{indexName}/rules/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getRule`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `getRule`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Retrieve settings of a given indexName. - * - * @summary Retrieve settings of a given indexName. - * @param getSettings - The getSettings object. - * @param getSettings.indexName - The index in which to perform the request. - */ - function getSettings({ - indexName, - }: GetSettingsProps): Promise { - const path = '/1/indexes/{indexName}/settings'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getSettings`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List all allowed sources. - * - * @summary List all allowed sources. - */ - function getSources(): Promise { - const path = '/1/security/sources'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Fetch a synonym object identified by its objectID. - * - * @summary Get synonym. - * @param getSynonym - The getSynonym object. - * @param getSynonym.indexName - The index in which to perform the request. - * @param getSynonym.objectID - Unique identifier of an object. - */ - function getSynonym({ - indexName, - objectID, - }: GetSynonymProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getSynonym`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `getSynonym`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Check the current status of a given task. - * - * @summary Check the current status of a given task. - * @param getTask - The getTask object. - * @param getTask.indexName - The index in which to perform the request. - * @param getTask.taskID - Unique identifier of an task. Numeric value (up to 64bits). - */ - function getTask({ - indexName, - taskID, - }: GetTaskProps): Promise { - const path = '/1/indexes/{indexName}/task/{taskID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{taskID}', encodeURIComponent(String(taskID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `getTask`.' - ); - } - - if (!taskID) { - throw new Error('Parameter `taskID` is required when calling `getTask`.'); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the top 10 userIDs with the highest number of records per cluster. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following array of userIDs and clusters. - * - * @summary Get top userID. - */ - function getTopUserIds(): Promise { - const path = '/1/clusters/mapping/top'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Returns the userID data stored in the mapping. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userID data. - * - * @summary Get userID. - * @param getUserId - The getUserId object. - * @param getUserId.userID - UserID to assign. - */ - function getUserId({ userID }: GetUserIdProps): Promise { - const path = '/1/clusters/mapping/{userID}'.replace( - '{userID}', - encodeURIComponent(String(userID)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userID) { - throw new Error( - 'Parameter `userID` is required when calling `getUserId`.' - ); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get the status of your clusters\' migrations or user creations. Creating a large batch of users or migrating your multi-cluster may take quite some time. This method lets you retrieve the status of the migration, so you can know when it\'s done. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable. - * - * @summary Has pending mappings. - * @param hasPendingMappings - The hasPendingMappings object. - * @param hasPendingMappings.getClusters - Whether to get clusters or not. - */ - function hasPendingMappings({ - getClusters, - }: HasPendingMappingsProps): Promise { - const path = '/1/clusters/mapping/pending'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (getClusters !== undefined) { - queryParameters.getClusters = getClusters.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List API keys, along with their associated rights. - * - * @summary Get the full list of API Keys. - */ - function listApiKeys(): Promise { - const path = '/1/keys'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List the clusters available in a multi-clusters setup for a single appID. Upon success, the response is 200 OK and contains the following clusters. - * - * @summary List clusters. - */ - function listClusters(): Promise { - const path = '/1/clusters'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List existing indexes from an application. - * - * @summary List existing indexes. - * @param listIndices - The listIndices object. - * @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - function listIndices({ - page, - }: ListIndicesProps): Promise { - const path = '/1/indexes'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * List the userIDs assigned to a multi-clusters appID. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userIDs data. - * - * @summary List userIDs. - * @param listUserIds - The listUserIds object. - * @param listUserIds.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * @param listUserIds.hitsPerPage - Maximum number of objects to retrieve. - */ - function listUserIds({ - page, - hitsPerPage, - }: ListUserIdsProps): Promise { - const path = '/1/clusters/mapping'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - if (hitsPerPage !== undefined) { - queryParameters.hitsPerPage = hitsPerPage.toString(); - } - - const request: Request = { - method: 'GET', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Perform multiple write operations, potentially targeting multiple indices, in a single API call. - * - * @summary Perform multiple write operations. - * @param batchParams - The batchParams object. - */ - function multipleBatch( - batchParams: BatchParams - ): Promise { - const path = '/1/indexes/*/batch'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!batchParams) { - throw new Error( - 'Parameter `batchParams` is required when calling `multipleBatch`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: batchParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get search results for the given requests. - * - * @summary Get search results for the given requests. - * @param multipleQueriesParams - The multipleQueriesParams object. - */ - function multipleQueries( - multipleQueriesParams: MultipleQueriesParams - ): Promise { - const path = '/1/indexes/*/queries'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!multipleQueriesParams) { - throw new Error( - 'Parameter `multipleQueriesParams` is required when calling `multipleQueries`.' - ); - } - - if (!multipleQueriesParams.requests) { - throw new Error( - 'Parameter `multipleQueriesParams.requests` is required when calling `multipleQueries`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: multipleQueriesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Peforms a copy or a move operation on a index. - * - * @summary Copy/move index. - * @param operationIndex - The operationIndex object. - * @param operationIndex.indexName - The index in which to perform the request. - * @param operationIndex.operationIndexParams - The operationIndexParams object. - */ - function operationIndex({ - indexName, - operationIndexParams, - }: OperationIndexProps): Promise { - const path = '/1/indexes/{indexName}/operation'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `operationIndex`.' - ); - } - - if (!operationIndexParams) { - throw new Error( - 'Parameter `operationIndexParams` is required when calling `operationIndex`.' - ); - } - - if (!operationIndexParams.operation) { - throw new Error( - 'Parameter `operationIndexParams.operation` is required when calling `operationIndex`.' - ); - } - if (!operationIndexParams.destination) { - throw new Error( - 'Parameter `operationIndexParams.destination` is required when calling `operationIndex`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: operationIndexParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Update one or more attributes of an existing object. This method lets you update only a part of an existing object, either by adding new attributes or updating existing ones. You can partially update several objects in a single method call. If the index targeted by this operation doesn\'t exist yet, it\'s automatically created. - * - * @summary Partially update an object. - * @param partialUpdateObject - The partialUpdateObject object. - * @param partialUpdateObject.indexName - The index in which to perform the request. - * @param partialUpdateObject.objectID - Unique identifier of an object. - * @param partialUpdateObject.stringBuiltInOperation - List of attributes to update. - * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet. - */ - function partialUpdateObject({ - indexName, - objectID, - stringBuiltInOperation, - createIfNotExists, - }: PartialUpdateObjectProps): Promise { - const path = '/1/indexes/{indexName}/{objectID}/partial' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `partialUpdateObject`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `partialUpdateObject`.' - ); - } - - if (!stringBuiltInOperation) { - throw new Error( - 'Parameter `stringBuiltInOperation` is required when calling `partialUpdateObject`.' - ); - } - - if (createIfNotExists !== undefined) { - queryParameters.createIfNotExists = createIfNotExists.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: stringBuiltInOperation, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Remove a userID and its associated data from the multi-clusters. Upon success, the response is 200 OK and a task is created to remove the userID data and mapping. - * - * @summary Remove userID. - * @param removeUserId - The removeUserId object. - * @param removeUserId.userID - UserID to assign. - */ - function removeUserId({ - userID, - }: RemoveUserIdProps): Promise { - const path = '/1/clusters/mapping/{userID}'.replace( - '{userID}', - encodeURIComponent(String(userID)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!userID) { - throw new Error( - 'Parameter `userID` is required when calling `removeUserId`.' - ); - } - - const request: Request = { - method: 'DELETE', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Replace all allowed sources. - * - * @summary Replace all allowed sources. - * @param replaceSources - The replaceSources object. - * @param replaceSources.source - The sources to allow. - */ - function replaceSources({ - source, - }: ReplaceSourcesProps): Promise { - const path = '/1/security/sources'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!source) { - throw new Error( - 'Parameter `source` is required when calling `replaceSources`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: source, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Restore a deleted API key, along with its associated rights. - * - * @summary Restore an API key. - * @param restoreApiKey - The restoreApiKey object. - * @param restoreApiKey.key - API Key string. - */ - function restoreApiKey({ - key, - }: RestoreApiKeyProps): Promise { - const path = '/1/keys/{key}/restore'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error( - 'Parameter `key` is required when calling `restoreApiKey`.' - ); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Add an object to the index, automatically assigning it an object ID. - * - * @summary Add an object to the index. - * @param saveObject - The saveObject object. - * @param saveObject.indexName - The index in which to perform the request. - * @param saveObject.body - The Algolia record. - */ - function saveObject({ - indexName, - body, - }: SaveObjectProps): Promise { - const path = '/1/indexes/{indexName}'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveObject`.' - ); - } - - if (!body) { - throw new Error( - 'Parameter `body` is required when calling `saveObject`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: body, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create or update the Rule with the specified objectID. - * - * @summary Save/Update a rule. - * @param saveRule - The saveRule object. - * @param saveRule.indexName - The index in which to perform the request. - * @param saveRule.objectID - Unique identifier of an object. - * @param saveRule.rule - The rule object. - * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function saveRule({ - indexName, - objectID, - rule, - forwardToReplicas, - }: SaveRuleProps): Promise { - const path = '/1/indexes/{indexName}/rules/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveRule`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `saveRule`.' - ); - } - - if (!rule) { - throw new Error('Parameter `rule` is required when calling `saveRule`.'); - } - - if (!rule.objectID) { - throw new Error( - 'Parameter `rule.objectID` is required when calling `saveRule`.' - ); - } - if (!rule.consequence) { - throw new Error( - 'Parameter `rule.consequence` is required when calling `saveRule`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'PUT', - path, - data: rule, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create a new synonym object or update the existing synonym object with the given object ID. - * - * @summary Save synonym. - * @param saveSynonym - The saveSynonym object. - * @param saveSynonym.indexName - The index in which to perform the request. - * @param saveSynonym.objectID - Unique identifier of an object. - * @param saveSynonym.synonymHit - The synonymHit object. - * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function saveSynonym({ - indexName, - objectID, - synonymHit, - forwardToReplicas, - }: SaveSynonymProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/{objectID}' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{objectID}', encodeURIComponent(String(objectID))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveSynonym`.' - ); - } - - if (!objectID) { - throw new Error( - 'Parameter `objectID` is required when calling `saveSynonym`.' - ); - } - - if (!synonymHit) { - throw new Error( - 'Parameter `synonymHit` is required when calling `saveSynonym`.' - ); - } - - if (!synonymHit.objectID) { - throw new Error( - 'Parameter `synonymHit.objectID` is required when calling `saveSynonym`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'PUT', - path, - data: synonymHit, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Create/update multiple synonym objects at once, potentially replacing the entire list of synonyms if replaceExistingSynonyms is true. - * - * @summary Save a batch of synonyms. - * @param saveSynonyms - The saveSynonyms object. - * @param saveSynonyms.indexName - The index in which to perform the request. - * @param saveSynonyms.synonymHit - The synonymHit object. - * @param saveSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - * @param saveSynonyms.replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request. - */ - function saveSynonyms({ - indexName, - synonymHit, - forwardToReplicas, - replaceExistingSynonyms, - }: SaveSynonymsProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/batch'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `saveSynonyms`.' - ); - } - - if (!synonymHit) { - throw new Error( - 'Parameter `synonymHit` is required when calling `saveSynonyms`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - if (replaceExistingSynonyms !== undefined) { - queryParameters.replaceExistingSynonyms = - replaceExistingSynonyms.toString(); - } - - const request: Request = { - method: 'POST', - path, - data: synonymHit, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Get search results. - * - * @summary Get search results. - * @param search - The search object. - * @param search.indexName - The index in which to perform the request. - * @param search.searchParams - The searchParams object. - */ - function search({ - indexName, - searchParams, - }: SearchProps): Promise { - const path = '/1/indexes/{indexName}/query'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `search`.' - ); - } - - if (!searchParams) { - throw new Error( - 'Parameter `searchParams` is required when calling `search`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search the dictionary entries. - * - * @summary Search the dictionary entries. - * @param searchDictionaryEntries - The searchDictionaryEntries object. - * @param searchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param searchDictionaryEntries.searchDictionaryEntriesParams - The searchDictionaryEntriesParams object. - */ - function searchDictionaryEntries({ - dictionaryName, - searchDictionaryEntriesParams, - }: SearchDictionaryEntriesProps): Promise { - const path = '/1/dictionaries/{dictionaryName}/search'.replace( - '{dictionaryName}', - encodeURIComponent(String(dictionaryName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!dictionaryName) { - throw new Error( - 'Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.' - ); - } - - if (!searchDictionaryEntriesParams) { - throw new Error( - 'Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.' - ); - } - - if (!searchDictionaryEntriesParams.query) { - throw new Error( - 'Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchDictionaryEntriesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search for values of a given facet, optionally restricting the returned values to those contained in objects matching other search criteria. - * - * @summary Search for values of a given facet. - * @param searchForFacetValues - The searchForFacetValues object. - * @param searchForFacetValues.indexName - The index in which to perform the request. - * @param searchForFacetValues.facetName - The facet name. - * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object. - */ - function searchForFacetValues({ - indexName, - facetName, - searchForFacetValuesRequest, - }: SearchForFacetValuesProps): Promise { - const path = '/1/indexes/{indexName}/facets/{facetName}/query' - .replace('{indexName}', encodeURIComponent(String(indexName))) - .replace('{facetName}', encodeURIComponent(String(facetName))); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `searchForFacetValues`.' - ); - } - - if (!facetName) { - throw new Error( - 'Parameter `facetName` is required when calling `searchForFacetValues`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchForFacetValuesRequest, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search for rules matching various criteria. - * - * @summary Search for rules. - * @param searchRules - The searchRules object. - * @param searchRules.indexName - The index in which to perform the request. - * @param searchRules.searchRulesParams - The searchRulesParams object. - */ - function searchRules({ - indexName, - searchRulesParams, - }: SearchRulesProps): Promise { - const path = '/1/indexes/{indexName}/rules/search'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `searchRules`.' - ); - } - - if (!searchRulesParams) { - throw new Error( - 'Parameter `searchRulesParams` is required when calling `searchRules`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchRulesParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search or browse all synonyms, optionally filtering them by type. - * - * @summary Get all synonyms that match a query. - * @param searchSynonyms - The searchSynonyms object. - * @param searchSynonyms.indexName - The index in which to perform the request. - * @param searchSynonyms.query - Search for specific synonyms matching this string. - * @param searchSynonyms.type - Only search for specific types of synonyms. - * @param searchSynonyms.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * @param searchSynonyms.hitsPerPage - Maximum number of objects to retrieve. - */ - function searchSynonyms({ - indexName, - query, - type, - page, - hitsPerPage, - }: SearchSynonymsProps): Promise { - const path = '/1/indexes/{indexName}/synonyms/search'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `searchSynonyms`.' - ); - } - - if (query !== undefined) { - queryParameters.query = query.toString(); - } - - if (type !== undefined) { - queryParameters.type = type.toString(); - } - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - if (hitsPerPage !== undefined) { - queryParameters.hitsPerPage = hitsPerPage.toString(); - } - - const request: Request = { - method: 'POST', - path, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Search for userIDs. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds propagate to the different clusters. To keep updates moving quickly, the index of userIDs isn\'t built synchronously with the mapping. Instead, the index is built once every 12h, at the same time as the update of userID usage. For example, when you perform a modification like adding or moving a userID, the search will report an outdated value until the next rebuild of the mapping, which takes place every 12h. Upon success, the response is 200 OK and contains the following userIDs data. - * - * @summary Search userID. - * @param searchUserIdsParams - The searchUserIdsParams object. - */ - function searchUserIds( - searchUserIdsParams: SearchUserIdsParams - ): Promise { - const path = '/1/clusters/mapping/search'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!searchUserIdsParams) { - throw new Error( - 'Parameter `searchUserIdsParams` is required when calling `searchUserIds`.' - ); - } - - if (!searchUserIdsParams.query) { - throw new Error( - 'Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: searchUserIdsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Set dictionary settings. - * - * @summary Set dictionary settings. - * @param dictionarySettingsParams - The dictionarySettingsParams object. - */ - function setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams - ): Promise { - const path = '/1/dictionaries/*/settings'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!dictionarySettingsParams) { - throw new Error( - 'Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.' - ); - } - - if (!dictionarySettingsParams.disableStandardEntries) { - throw new Error( - 'Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: dictionarySettingsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * - * @summary Update settings of a given indexName. - * @param setSettings - The setSettings object. - * @param setSettings.indexName - The index in which to perform the request. - * @param setSettings.indexSettings - The indexSettings object. - * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - */ - function setSettings({ - indexName, - indexSettings, - forwardToReplicas, - }: SetSettingsProps): Promise { - const path = '/1/indexes/{indexName}/settings'.replace( - '{indexName}', - encodeURIComponent(String(indexName)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!indexName) { - throw new Error( - 'Parameter `indexName` is required when calling `setSettings`.' - ); - } - - if (!indexSettings) { - throw new Error( - 'Parameter `indexSettings` is required when calling `setSettings`.' - ); - } - - if (forwardToReplicas !== undefined) { - queryParameters.forwardToReplicas = forwardToReplicas.toString(); - } - - const request: Request = { - method: 'PUT', - path, - data: indexSettings, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - /** - * Replace every permission of an existing API key. - * - * @summary Update an API key. - * @param updateApiKey - The updateApiKey object. - * @param updateApiKey.key - API Key string. - * @param updateApiKey.apiKey - The apiKey object. - */ - function updateApiKey({ - key, - apiKey, - }: UpdateApiKeyProps): Promise { - const path = '/1/keys/{key}'.replace( - '{key}', - encodeURIComponent(String(key)) - ); - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!key) { - throw new Error( - 'Parameter `key` is required when calling `updateApiKey`.' - ); - } - - if (!apiKey) { - throw new Error( - 'Parameter `apiKey` is required when calling `updateApiKey`.' - ); - } - - if (!apiKey.acl) { - throw new Error( - 'Parameter `apiKey.acl` is required when calling `updateApiKey`.' - ); - } - - const request: Request = { - method: 'PUT', - path, - data: apiKey, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { - addUserAgent, - addApiKey, - addOrUpdateObject, - appendSource, - assignUserId, - batch, - batchAssignUserIds, - batchDictionaryEntries, - batchRules, - browse, - clearAllSynonyms, - clearObjects, - clearRules, - deleteApiKey, - deleteBy, - deleteIndex, - deleteObject, - deleteRule, - deleteSource, - deleteSynonym, - getApiKey, - getDictionaryLanguages, - getDictionarySettings, - getLogs, - getObject, - getObjects, - getRule, - getSettings, - getSources, - getSynonym, - getTask, - getTopUserIds, - getUserId, - hasPendingMappings, - listApiKeys, - listClusters, - listIndices, - listUserIds, - multipleBatch, - multipleQueries, - operationIndex, - partialUpdateObject, - removeUserId, - replaceSources, - restoreApiKey, - saveObject, - saveRule, - saveSynonym, - saveSynonyms, - search, - searchDictionaryEntries, - searchForFacetValues, - searchRules, - searchSynonyms, - searchUserIds, - setDictionarySettings, - setSettings, - updateApiKey, - }; -} - -export type SearchApi = ReturnType; - -export type AddOrUpdateObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * The Algolia object. - */ - body: Record; -}; - -export type AssignUserIdProps = { - /** - * UserID to assign. - */ - xAlgoliaUserID: string; - assignUserIdParams: AssignUserIdParams; -}; - -export type BatchProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - batchWriteParams: BatchWriteParams; -}; - -export type BatchAssignUserIdsProps = { - /** - * UserID to assign. - */ - xAlgoliaUserID: string; - batchAssignUserIdsParams: BatchAssignUserIdsParams; -}; - -export type BatchDictionaryEntriesProps = { - /** - * The dictionary to search in. - */ - dictionaryName: 'compounds' | 'plurals' | 'stopwords'; - batchDictionaryEntriesParams: BatchDictionaryEntriesParams; -}; - -export type BatchRulesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - rule: Rule[]; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; - /** - * When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. - */ - clearExistingRules?: boolean; -}; - -export type BrowseProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - browseRequest?: BrowseRequest; -}; - -export type ClearAllSynonymsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type ClearObjectsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type ClearRulesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type DeleteApiKeyProps = { - /** - * API Key string. - */ - key: string; -}; - -export type DeleteByProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - searchParams: SearchParams; -}; - -export type DeleteIndexProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type DeleteObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; -}; - -export type DeleteRuleProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type DeleteSourceProps = { - /** - * The IP range of the source. - */ - source: string; -}; - -export type DeleteSynonymProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type GetApiKeyProps = { - /** - * API Key string. - */ - key: string; -}; - -export type GetLogsProps = { - /** - * First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. - */ - offset?: number; - /** - * Maximum number of entries to retrieve. The maximum allowed value is 1000. - */ - length?: number; - /** - * Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. - */ - indexName?: string; - /** - * Type of log entries to retrieve. When omitted, all log entries are retrieved. - */ - type?: 'all' | 'build' | 'error' | 'query'; -}; - -export type GetObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * List of attributes to retrieve. If not specified, all retrievable attributes are returned. - */ - attributesToRetrieve?: string[]; -}; - -export type GetRuleProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; -}; - -export type GetSettingsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; -}; - -export type GetSynonymProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; -}; - -export type GetTaskProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an task. Numeric value (up to 64bits). - */ - taskID: number; -}; - -export type GetUserIdProps = { - /** - * UserID to assign. - */ - userID: string; -}; - -export type HasPendingMappingsProps = { - /** - * Whether to get clusters or not. - */ - getClusters?: boolean; -}; - -export type ListIndicesProps = { - /** - * Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - page?: number; -}; - -export type ListUserIdsProps = { - /** - * Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - page?: number; - /** - * Maximum number of objects to retrieve. - */ - hitsPerPage?: number; -}; - -export type OperationIndexProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - operationIndexParams: OperationIndexParams; -}; - -export type PartialUpdateObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - /** - * List of attributes to update. - */ - stringBuiltInOperation: Array<{ [key: string]: BuiltInOperation | string }>; - /** - * Creates the record if it does not exist yet. - */ - createIfNotExists?: boolean; -}; - -export type RemoveUserIdProps = { - /** - * UserID to assign. - */ - userID: string; -}; - -export type ReplaceSourcesProps = { - /** - * The sources to allow. - */ - source: Source[]; -}; - -export type RestoreApiKeyProps = { - /** - * API Key string. - */ - key: string; -}; - -export type SaveObjectProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * The Algolia record. - */ - body: Record; -}; - -export type SaveRuleProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - rule: Rule; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type SaveSynonymProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Unique identifier of an object. - */ - objectID: string; - synonymHit: SynonymHit; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type SaveSynonymsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - synonymHit: SynonymHit[]; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; - /** - * Replace all synonyms of the index with the ones sent with this request. - */ - replaceExistingSynonyms?: boolean; -}; - -export type SearchProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - searchParams: SearchParams; -}; - -export type SearchDictionaryEntriesProps = { - /** - * The dictionary to search in. - */ - dictionaryName: 'compounds' | 'plurals' | 'stopwords'; - searchDictionaryEntriesParams: SearchDictionaryEntriesParams; -}; - -export type SearchForFacetValuesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * The facet name. - */ - facetName: string; - searchForFacetValuesRequest?: SearchForFacetValuesRequest; -}; - -export type SearchRulesProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - searchRulesParams: SearchRulesParams; -}; - -export type SearchSynonymsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - /** - * Search for specific synonyms matching this string. - */ - query?: string; - /** - * Only search for specific types of synonyms. - */ - type?: SynonymType; - /** - * Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - */ - page?: number; - /** - * Maximum number of objects to retrieve. - */ - hitsPerPage?: number; -}; - -export type SetSettingsProps = { - /** - * The index in which to perform the request. - */ - indexName: string; - indexSettings: IndexSettings; - /** - * When true, changes are also propagated to replicas of the given indexName. - */ - forwardToReplicas?: boolean; -}; - -export type UpdateApiKeyProps = { - /** - * API Key string. - */ - key: string; - apiKey: ApiKey; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/.gitignore b/clients/algoliasearch-client-javascript/packages/client-sources/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts deleted file mode 100644 index bcb97284f6..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/builds/browser.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createSourcesApi } from '../src/sourcesApi'; -import type { SourcesApi, Region } from '../src/sourcesApi'; - -export * from '../src/sourcesApi'; - -export function sourcesApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): SourcesApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createSourcesApi({ - appId, - apiKey, - region, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts deleted file mode 100644 index ec0d2c7b87..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/builds/node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createSourcesApi } from '../src/sourcesApi'; -import type { SourcesApi, Region } from '../src/sourcesApi'; - -export * from '../src/sourcesApi'; - -export function sourcesApi( - appId: string, - apiKey: string, - region: Region, - options?: { requester?: Requester; hosts?: Host[] } -): SourcesApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - if (!region) { - throw new Error('`region` is missing.'); - } - - return createSourcesApi({ - appId, - apiKey, - region, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/git_push.sh b/clients/algoliasearch-client-javascript/packages/client-sources/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/index.js b/clients/algoliasearch-client-javascript/packages/client-sources/index.js deleted file mode 100644 index 220e589629..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/client-sources.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/models.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/models.ts deleted file mode 100644 index edc5b31b3a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/models.ts +++ /dev/null @@ -1,274 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { ErrorBase } from './errorBase'; -import { PostIngestUrlResponse } from './postIngestUrlResponse'; -import { PostURLJob } from './postURLJob'; -import { PostURLJobAuth } from './postURLJobAuth'; -import { PostURLJobInput } from './postURLJobInput'; -import { PostURLJobTarget } from './postURLJobTarget'; -import { Task } from './task'; - -export * from './errorBase'; -export * from './postIngestUrlResponse'; -export * from './postURLJob'; -export * from './postURLJobAuth'; -export * from './postURLJobInput'; -export * from './postURLJobTarget'; -export * from './task'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = { - 'PostURLJob.TypeEnum': PostURLJob.TypeEnum, - 'PostURLJobAuth.TypeEnum': PostURLJobAuth.TypeEnum, - 'PostURLJobInput.MethodEnum': PostURLJobInput.MethodEnum, - 'PostURLJobTarget.TypeEnum': PostURLJobTarget.TypeEnum, - 'PostURLJobTarget.OperationEnum': PostURLJobTarget.OperationEnum, - 'Task.TypeEnum': Task.TypeEnum, -}; - -const typeMap: { [index: string]: any } = { - ErrorBase, - PostIngestUrlResponse, - PostURLJob, - PostURLJobAuth, - PostURLJobInput, - PostURLJobTarget, - Task, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts deleted file mode 100644 index 98a0c3c1ba..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postIngestUrlResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Task } from './task'; - -export type PostIngestUrlResponse = { - task: Task; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts deleted file mode 100644 index cb99c27493..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJob.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { PostURLJobInput } from './postURLJobInput'; -import type { PostURLJobTarget } from './postURLJobTarget'; - -/** - * Object containing a URL job. - */ -export type PostURLJob = { - /** - * The type of the file to ingest. - */ - type: PostURLJobType; - /** - * The name of the column that hold the unique identifier. - */ - uniqueIDColumn?: string; - input: PostURLJobInput; - target: PostURLJobTarget; -}; - -export type PostURLJobType = 'csv'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts deleted file mode 100644 index b28e166959..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobAuth.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * The authentication scheme for the URL that will be fetched. - */ -export type PostURLJobAuth = { - /** - * The type of authentication to use. - */ - type: PostURLJobAuthType; - /** - * The login to use for Basic Auth. - */ - login: string; - /** - * The password to use for Basic Auth. - */ - password: string; -}; - -export type PostURLJobAuthType = 'basic'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts deleted file mode 100644 index 7a51e0dfc5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobInput.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { PostURLJobAuth } from './postURLJobAuth'; - -/** - * The input of the job. - */ -export type PostURLJobInput = { - /** - * The URL of the file to ingest. - */ - url: string; - /** - * The HTTP method that will be used to fetch the URL. - */ - method?: PostURLJobInputMethod; - auth?: PostURLJobAuth; -}; - -export type PostURLJobInputMethod = 'GET' | 'POST'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts deleted file mode 100644 index c9a3aae9c9..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/postURLJobTarget.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * The target of the job. - */ -export type PostURLJobTarget = { - /** - * The product to target. - */ - type: PostURLJobTargetType; - /** - * The index name of the product. - */ - indexName: string; - /** - * The type of operation to execute. - */ - operation: PostURLJobTargetOperation; -}; - -export type PostURLJobTargetType = 'search'; - -export type PostURLJobTargetOperation = 'replace'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts b/clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts deleted file mode 100644 index 8c07b1a8dc..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/model/task.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * A task object. - */ -export type Task = { - /** - * The id of the task. - */ - id: string; - /** - * The type of the task executed. - */ - type: TaskType; -}; - -export type TaskType = 'csv'; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/package.json b/clients/algoliasearch-client-javascript/packages/client-sources/package.json deleted file mode 100644 index 8e805ae6d2..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/client-sources", - "version": "0.0.1", - "description": "JavaScript client for @algolia/client-sources", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/client-sources.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/client-sources.umd.browser.js", - "unpkg": "dist/client-sources.umd.browser.js", - "browser": "dist/client-sources.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts b/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts deleted file mode 100644 index 2f2b15887f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesApi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { PostIngestUrlResponse } from '../model/postIngestUrlResponse'; -import type { PostURLJob } from '../model/postURLJob'; - -export const apiClientVersion = '0.0.1'; - -export type Region = 'de' | 'us'; - -function getDefaultHosts(region: Region): Host[] { - return [ - { - url: `data.${region}.algolia.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createSourcesApi( - options: CreateClientOptions & { region: Region } -) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.region), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Sources', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Add an ingestion job that will fetch data from an URL. - * - * @summary Create a new ingestion job via URL. - * @param postURLJob - The postURLJob object. - */ - function postIngestUrl( - postURLJob: PostURLJob - ): Promise { - const path = '/1/ingest/url'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!postURLJob) { - throw new Error( - 'Parameter `postURLJob` is required when calling `postIngestUrl`.' - ); - } - - if (!postURLJob.type) { - throw new Error( - 'Parameter `postURLJob.type` is required when calling `postIngestUrl`.' - ); - } - if (!postURLJob.input) { - throw new Error( - 'Parameter `postURLJob.input` is required when calling `postIngestUrl`.' - ); - } - if (!postURLJob.target) { - throw new Error( - 'Parameter `postURLJob.target` is required when calling `postIngestUrl`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: postURLJob, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, postIngestUrl }; -} - -export type SourcesApi = ReturnType; diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-sources/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/.gitignore b/clients/algoliasearch-client-javascript/packages/recommend/.gitignore deleted file mode 100644 index 149b576547..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore b/clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts deleted file mode 100644 index 290c99347f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/builds/browser.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createXhrRequester } from '@algolia/requester-browser-xhr'; - -import { createRecommendApi } from '../src/recommendApi'; -import type { RecommendApi } from '../src/recommendApi'; - -export * from '../src/recommendApi'; - -export function recommendApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): RecommendApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createRecommendApi({ - appId, - apiKey, - timeouts: { - connect: 1, - read: 2, - write: 30, - }, - requester: options?.requester ?? createXhrRequester(), - userAgents: [{ segment: 'Browser' }], - authMode: 'WithinQueryParameters', - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts b/clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts deleted file mode 100644 index c193589bed..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/builds/node.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Host, Requester } from '@algolia/client-common'; -import { createHttpRequester } from '@algolia/requester-node-http'; - -import { createRecommendApi } from '../src/recommendApi'; -import type { RecommendApi } from '../src/recommendApi'; - -export * from '../src/recommendApi'; - -export function recommendApi( - appId: string, - apiKey: string, - options?: { requester?: Requester; hosts?: Host[] } -): RecommendApi { - if (!appId) { - throw new Error('`appId` is missing.'); - } - - if (!apiKey) { - throw new Error('`apiKey` is missing.'); - } - - return createRecommendApi({ - appId, - apiKey, - timeouts: { - connect: 2, - read: 5, - write: 30, - }, - requester: options?.requester ?? createHttpRequester(), - userAgents: [{ segment: 'Node.js', version: process.versions.node }], - ...options, - }); -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/git_push.sh b/clients/algoliasearch-client-javascript/packages/recommend/git_push.sh deleted file mode 100644 index b151edf823..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="algolia" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="algolia" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="algoliasearch-client-javascript" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/algoliasearch-client-javascript/packages/recommend/index.d.ts b/clients/algoliasearch-client-javascript/packages/recommend/index.d.ts deleted file mode 100644 index 8b0a7c887a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-unresolved -export * from './dist/builds/node'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/index.js b/clients/algoliasearch-client-javascript/packages/recommend/index.js deleted file mode 100644 index 6ea904117a..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line import/no-commonjs,import/extensions -module.exports = require('./dist/recommend.cjs.node.js'); diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts deleted file mode 100644 index 8bf1730be7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts +++ /dev/null @@ -1,130 +0,0 @@ -export type BaseSearchParams = { - /** - * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. - */ - similarQuery?: string; - /** - * Filter the query with numeric, facet and/or tag filters. - */ - filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; - /** - * Determines how to calculate the total score for filtering. - */ - sumOrFiltersScores?: boolean; - /** - * Retrieve facets and their facet values. - */ - facets?: string[]; - /** - * Maximum number of facet values to return for each facet during a regular search. - */ - maxValuesPerFacet?: number; - /** - * Force faceting to be applied after de-duplication (via the Distinct setting). - */ - facetingAfterDistinct?: boolean; - /** - * Controls how facet values are fetched. - */ - sortFacetValuesBy?: string; - /** - * Specify the page to retrieve. - */ - page?: number; - /** - * Specify the offset of the first hit to return. - */ - offset?: number; - /** - * Set the number of hits to retrieve (used only with offset). - */ - length?: number; - /** - * Search for entries around a central geolocation, enabling a geo search within a circular area. - */ - aroundLatLng?: string; - /** - * Search for entries around a given location automatically computed from the requester\'s IP address. - */ - aroundLatLngViaIP?: boolean; - /** - * Define the maximum radius for a geo search (in meters). - */ - aroundRadius?: number | string | null; - /** - * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. - */ - aroundPrecision?: number; - /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. - */ - minimumAroundRadius?: number; - /** - * Search inside a rectangular area (in geo coordinates). - */ - insideBoundingBox?: number[]; - /** - * Search inside a polygon (in geo coordinates). - */ - insidePolygon?: number[]; - /** - * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. - */ - naturalLanguages?: string[]; - /** - * Enables contextual rules. - */ - ruleContexts?: string[]; - /** - * Define the impact of the Personalization feature. - */ - personalizationImpact?: number; - /** - * Associates a certain user token with the current search. - */ - userToken?: string; - /** - * Retrieve detailed ranking information. - */ - getRankingInfo?: boolean; - /** - * Enable the Click Analytics feature. - */ - clickAnalytics?: boolean; - /** - * Whether the current query will be taken into account in the Analytics. - */ - analytics?: boolean; - /** - * List of tags to apply to the query for analytics purposes. - */ - analyticsTags?: string[]; - /** - * Whether to include or exclude a query from the processing-time percentile computation. - */ - percentileComputation?: boolean; - /** - * Whether this search should participate in running AB tests. - */ - enableABTest?: boolean; - /** - * Whether this search should use AI Re-Ranking. - */ - enableReRanking?: boolean; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts deleted file mode 100644 index 358556c692..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponse.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type { BaseSearchResponseFacetsStats } from './baseSearchResponseFacetsStats'; - -export type BaseSearchResponse = { - /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. - */ - abTestID?: number; - /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. - */ - abTestVariantID?: number; - /** - * The computed geo location. - */ - aroundLatLng?: string; - /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. - */ - automaticRadius?: string; - /** - * Whether the facet count is exhaustive or approximate. - */ - exhaustiveFacetsCount?: boolean; - /** - * Indicate if the nbHits count was exhaustive or approximate. - */ - exhaustiveNbHits: boolean; - /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled). - */ - exhaustiveTypo: boolean; - /** - * A mapping of each facet name to the corresponding facet counts. - */ - facets?: { [key: string]: { [key: string]: string } }; - /** - * Statistics for numerical facets. - */ - facets_stats?: { [key: string]: BaseSearchResponseFacetsStats }; - /** - * Set the number of hits per page. - */ - hitsPerPage: number; - /** - * Index name used for the query. - */ - index?: string; - /** - * Index name used for the query. In the case of an A/B test, the targeted index isn\'t always the index used by the query. - */ - indexUsed?: string; - /** - * Used to return warnings about the query. - */ - message?: string; - /** - * Number of hits that the search query matched. - */ - nbHits: number; - /** - * Number of pages available for the current query. - */ - nbPages: number; - /** - * The number of hits selected and sorted by the relevant sort algorithm. - */ - nbSortedHits?: number; - /** - * Specify the page to retrieve. - */ - page: number; - /** - * A url-encoded string of all search parameters. - */ - params: string; - /** - * The query string that will be searched, after normalization. - */ - parsedQuery?: string; - /** - * Time the server took to process the request, in milliseconds. - */ - processingTimeMS: number; - /** - * The text to search in the index. - */ - query: string; - /** - * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. - */ - queryAfterRemoval?: string; - /** - * Actual host name of the server that processed the request. - */ - serverUsed?: string; - /** - * Lets you store custom data in your indices. - */ - userData?: Record; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts deleted file mode 100644 index 4c4ceb7bc7..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchResponseFacetsStats.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type BaseSearchResponseFacetsStats = { - /** - * The minimum value in the result set. - */ - min?: number; - /** - * The maximum value in the result set. - */ - max?: number; - /** - * The average facet value in the result set. - */ - avg?: number; - /** - * The sum of all values in the result set. - */ - sum?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts deleted file mode 100644 index a533aa7a15..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/errorBase.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Error. - */ -export type ErrorBase = { - message?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts deleted file mode 100644 index 4eb8d5fb8d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsParams.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { RecommendationRequest } from './recommendationRequest'; - -/** - * The `getRecommendations` parameters. - */ -export type GetRecommendationsParams = { - /** - * The `getRecommendations` requests. - */ - requests: RecommendationRequest[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts deleted file mode 100644 index 79de43ccff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RecommendationsResponse } from './recommendationsResponse'; - -export type GetRecommendationsResponse = { - results?: RecommendationsResponse[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts deleted file mode 100644 index a878792c6d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/highlightResult.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Highlighted attributes. - */ -export type HighlightResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: HighlightResultMatchLevel; - /** - * List of words from the query that matched the object. - */ - matchedWords?: string[]; - /** - * Whether the entire attribute value is highlighted. - */ - fullyHighlighted?: boolean; -}; - -export type HighlightResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts deleted file mode 100644 index 00a227aa03..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/indexSettingsAsSearchParams.ts +++ /dev/null @@ -1,209 +0,0 @@ -export type IndexSettingsAsSearchParams = { - /** - * The complete list of attributes used for searching. - */ - searchableAttributes?: string[]; - /** - * The complete list of attributes that will be used for faceting. - */ - attributesForFaceting?: string[]; - /** - * List of attributes that can\'t be retrieved at query time. - */ - unretrievableAttributes?: string[]; - /** - * This parameter controls which attributes to retrieve and which not to retrieve. - */ - attributesToRetrieve?: string[]; - /** - * Restricts a given query to look in only a subset of your searchable attributes. - */ - restrictSearchableAttributes?: string[]; - /** - * Controls how Algolia should sort your results. - */ - ranking?: string[]; - /** - * Specifies the custom ranking criterion. - */ - customRanking?: string[]; - /** - * Controls the relevancy threshold below which less relevant results aren\'t included in the results. - */ - relevancyStrictness?: number; - /** - * List of attributes to highlight. - */ - attributesToHighlight?: string[]; - /** - * List of attributes to snippet, with an optional maximum number of words to snippet. - */ - attributesToSnippet?: string[]; - /** - * The HTML string to insert before the highlighted parts in all highlight and snippet results. - */ - highlightPreTag?: string; - /** - * The HTML string to insert after the highlighted parts in all highlight and snippet results. - */ - highlightPostTag?: string; - /** - * String used as an ellipsis indicator when a snippet is truncated. - */ - snippetEllipsisText?: string; - /** - * Restrict highlighting and snippeting to items that matched the query. - */ - restrictHighlightAndSnippetArrays?: boolean; - /** - * Set the number of hits per page. - */ - hitsPerPage?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. - */ - minWordSizefor1Typo?: number; - /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. - */ - minWordSizefor2Typos?: number; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ - typoTolerance?: IndexSettingsAsSearchParamsTypoTolerance; - /** - * Whether to allow typos on numbers (\"numeric tokens\") in the query string. - */ - allowTyposOnNumericTokens?: boolean; - /** - * List of attributes on which you want to disable typo tolerance. - */ - disableTypoToleranceOnAttributes?: string[]; - /** - * Control which separators are indexed. - */ - separatorsToIndex?: string; - /** - * Treats singular, plurals, and other forms of declensions as matching terms. - */ - ignorePlurals?: string; - /** - * Removes stop (common) words from the query before executing it. - */ - removeStopWords?: string; - /** - * List of characters that the engine shouldn\'t automatically normalize. - */ - keepDiacriticsOnCharacters?: string; - /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. - */ - queryLanguages?: string[]; - /** - * Splits compound words into their composing atoms in the query. - */ - decompoundQuery?: boolean; - /** - * Whether Rules should be globally enabled. - */ - enableRules?: boolean; - /** - * Enable the Personalization feature. - */ - enablePersonalization?: boolean; - /** - * Controls if and how query words are interpreted as prefixes. - */ - queryType?: IndexSettingsAsSearchParamsQueryType; - /** - * Selects a strategy to remove words from the query when it doesn\'t match any hits. - */ - removeWordsIfNoResults?: IndexSettingsAsSearchParamsRemoveWordsIfNoResults; - /** - * Enables the advanced query syntax. - */ - advancedSyntax?: boolean; - /** - * A list of words that should be considered as optional when found in the query. - */ - optionalWords?: string[]; - /** - * List of attributes on which you want to disable the exact ranking criterion. - */ - disableExactOnAttributes?: string[]; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ - exactOnSingleWordQuery?: IndexSettingsAsSearchParamsExactOnSingleWordQuery; - /** - * List of alternatives that should be considered an exact match by the exact ranking criterion. - */ - alternativesAsExact?: IndexSettingsAsSearchParamsAlternativesAsExact[]; - /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled. - */ - advancedSyntaxFeatures?: IndexSettingsAsSearchParamsAdvancedSyntaxFeatures[]; - /** - * Enables de-duplication or grouping of results. - */ - distinct?: number; - /** - * Whether to take into account an index\'s synonyms for a particular search. - */ - synonyms?: boolean; - /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. - */ - replaceSynonymsInHighlight?: boolean; - /** - * Precision of the proximity ranking criterion. - */ - minProximity?: number; - /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. - */ - responseFields?: string[]; - /** - * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. - */ - maxFacetHits?: number; - /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. - */ - attributeCriteriaComputedByMinProximity?: boolean; - /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - */ - renderingContent?: Record; -}; - -export type IndexSettingsAsSearchParamsTypoTolerance = - | 'false' - | 'min' - | 'strict' - | 'true'; - -export type IndexSettingsAsSearchParamsQueryType = - | 'prefixAll' - | 'prefixLast' - | 'prefixNone'; - -export type IndexSettingsAsSearchParamsRemoveWordsIfNoResults = - | 'allOptional' - | 'firstWords' - | 'lastWords' - | 'none'; - -export type IndexSettingsAsSearchParamsExactOnSingleWordQuery = - | 'attribute' - | 'none' - | 'word'; - -export type IndexSettingsAsSearchParamsAlternativesAsExact = - | 'ignorePlurals' - | 'multiWordsSynonym' - | 'singleWordSynonym'; - -export type IndexSettingsAsSearchParamsAdvancedSyntaxFeatures = - | 'exactPhrase' - | 'excludeWords'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/models.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/models.ts deleted file mode 100644 index ce5318a429..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/models.ts +++ /dev/null @@ -1,322 +0,0 @@ -import type * as fs from 'fs'; - -import type localVarRequest from 'request'; - -import { BaseSearchParams } from './baseSearchParams'; -import { BaseSearchResponse } from './baseSearchResponse'; -import { BaseSearchResponseFacetsStats } from './baseSearchResponseFacetsStats'; -import { ErrorBase } from './errorBase'; -import { GetRecommendationsParams } from './getRecommendationsParams'; -import { GetRecommendationsResponse } from './getRecommendationsResponse'; -import { HighlightResult } from './highlightResult'; -import { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import { RankingInfo } from './rankingInfo'; -import { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; -import { RecommendHit } from './recommendHit'; -import { RecommendHits } from './recommendHits'; -import { RecommendationRequest } from './recommendationRequest'; -import { RecommendationsResponse } from './recommendationsResponse'; -import { RequiredSearchParams } from './requiredSearchParams'; -import { SearchParams } from './searchParams'; -import { SnippetResult } from './snippetResult'; - -export * from './baseSearchParams'; -export * from './baseSearchResponse'; -export * from './baseSearchResponseFacetsStats'; -export * from './errorBase'; -export * from './getRecommendationsParams'; -export * from './getRecommendationsResponse'; -export * from './highlightResult'; -export * from './indexSettingsAsSearchParams'; -export * from './rankingInfo'; -export * from './rankingInfoMatchedGeoLocation'; -export * from './recommendHit'; -export * from './recommendHits'; -export * from './recommendationRequest'; -export * from './recommendationsResponse'; -export * from './requiredSearchParams'; -export * from './searchParams'; -export * from './snippetResult'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = Buffer | fs.ReadStream | RequestDetailedFile | string; - -/* tslint:disable:no-unused-variable */ -const primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any', -]; - -const enumsMap: { [index: string]: any } = { - 'HighlightResult.MatchLevelEnum': HighlightResult.MatchLevelEnum, - 'IndexSettingsAsSearchParams.TypoToleranceEnum': - IndexSettingsAsSearchParams.TypoToleranceEnum, - 'IndexSettingsAsSearchParams.QueryTypeEnum': - IndexSettingsAsSearchParams.QueryTypeEnum, - 'IndexSettingsAsSearchParams.RemoveWordsIfNoResultsEnum': - IndexSettingsAsSearchParams.RemoveWordsIfNoResultsEnum, - 'IndexSettingsAsSearchParams.ExactOnSingleWordQueryEnum': - IndexSettingsAsSearchParams.ExactOnSingleWordQueryEnum, - 'IndexSettingsAsSearchParams.AlternativesAsExactEnum': - IndexSettingsAsSearchParams.AlternativesAsExactEnum, - 'IndexSettingsAsSearchParams.AdvancedSyntaxFeaturesEnum': - IndexSettingsAsSearchParams.AdvancedSyntaxFeaturesEnum, - 'RecommendationRequest.ModelEnum': RecommendationRequest.ModelEnum, - 'SearchParams.TypoToleranceEnum': SearchParams.TypoToleranceEnum, - 'SearchParams.QueryTypeEnum': SearchParams.QueryTypeEnum, - 'SearchParams.RemoveWordsIfNoResultsEnum': - SearchParams.RemoveWordsIfNoResultsEnum, - 'SearchParams.ExactOnSingleWordQueryEnum': - SearchParams.ExactOnSingleWordQueryEnum, - 'SearchParams.AlternativesAsExactEnum': SearchParams.AlternativesAsExactEnum, - 'SearchParams.AdvancedSyntaxFeaturesEnum': - SearchParams.AdvancedSyntaxFeaturesEnum, - 'SnippetResult.MatchLevelEnum': SnippetResult.MatchLevelEnum, -}; - -const typeMap: { [index: string]: any } = { - BaseSearchParams, - BaseSearchResponse, - BaseSearchResponseFacetsStats, - ErrorBase, - GetRecommendationsParams, - GetRecommendationsResponse, - HighlightResult, - IndexSettingsAsSearchParams, - RankingInfo, - RankingInfoMatchedGeoLocation, - RecommendHit, - RecommendHits, - RecommendationRequest, - RecommendationsResponse, - RequiredSearchParams, - SearchParams, - SnippetResult, -}; - -export class ObjectSerializer { - static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } - if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - if (expectedType === 'Date') { - return expectedType; - } - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - const discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } - if (data[discriminatorProperty]) { - const discriminatorType = data[discriminatorProperty]; - if (typeMap[discriminatorType]) { - return discriminatorType; // use the type given in the discriminator - } - return expectedType; // discriminator did not map to a type - } - return expectedType; // discriminator was not present (or an empty string) - } - - static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return data.toISOString(); - } - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - const attributeTypes = typeMap[type].getAttributeTypeMap(); - const instance: { [index: string]: any } = {}; - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize( - data[attributeType.name], - attributeType.type - ); - } - return instance; - } - - static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - if (type.lastIndexOf('Array<', 0) === 0) { - // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - const transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - const datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } - if (type === 'Date') { - return new Date(data); - } - if (enumsMap[type]) { - // is Enum - return data; - } - - if (!typeMap[type]) { - // dont know the type - return data; - } - const instance = new typeMap[type](); - const attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - const attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize( - data[attributeType.baseName], - attributeType.type - ); - } - return instance; - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest: ( - requestOptions: localVarRequest.Options - ) => Promise | void; -} - -export class HttpBasicAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, - password: this.password, - }; - } -} - -export class HttpBearerAuth implements Authentication { - accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = - typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers.Authorization = `Bearer ${accessToken}`; - } - } -} - -export class ApiKeyAuth implements Authentication { - apiKey: string = ''; - - constructor(private location: string, private paramName: string) {} - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == 'query') { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if ( - this.location == 'header' && - requestOptions && - requestOptions.headers - ) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if ( - this.location == 'cookie' && - requestOptions && - requestOptions.headers - ) { - if (requestOptions.headers.Cookie) { - requestOptions.headers.Cookie += `; ${ - this.paramName - }=${encodeURIComponent(this.apiKey)}`; - } else { - requestOptions.headers.Cookie = `${this.paramName}=${encodeURIComponent( - this.apiKey - )}`; - } - } - } -} - -export class OAuth implements Authentication { - accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers.Authorization = `Bearer ${this.accessToken}`; - } - } -} - -export class VoidAuth implements Authentication { - username: string = ''; - password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = ( - requestOptions: localVarRequest.Options -) => Promise | void; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts deleted file mode 100644 index c14a767726..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; - -export type RankingInfo = { - /** - * This field is reserved for advanced usage. - */ - filters?: number; - /** - * Position of the most important matched attribute in the attributes to index list. - */ - firstMatchedWord?: number; - /** - * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). - */ - geoDistance?: number; - /** - * Precision used when computing the geo distance, in meters. - */ - geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; - /** - * Number of exactly matched words. - */ - nbExactWords?: number; - /** - * Number of typos encountered when matching the record. - */ - nbTypos?: number; - /** - * Present and set to true if a Rule promoted the hit. - */ - promoted?: boolean; - /** - * When the query contains more than one word, the sum of the distances between matched words (in meters). - */ - proximityDistance?: number; - /** - * Custom ranking for the object, expressed as a single integer value. - */ - userScore?: number; - /** - * Number of matched words, including prefixes and typos. - */ - word?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts deleted file mode 100644 index bc9ce84718..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfoMatchedGeoLocation.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type RankingInfoMatchedGeoLocation = { - /** - * Latitude of the matched location. - */ - lat?: number; - /** - * Longitude of the matched location. - */ - lng?: number; - /** - * Distance between the matched location and the search location (in meters). - */ - distance?: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts deleted file mode 100644 index 188522c9c5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHit.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { HighlightResult } from './highlightResult'; -import type { RankingInfo } from './rankingInfo'; -import type { SnippetResult } from './snippetResult'; - -/** - * A Recommend hit. - */ -export type RecommendHit = { - /** - * Unique identifier of the object. - */ - objectID: string; - _highlightResult?: HighlightResult; - _snippetResult?: SnippetResult; - _rankingInfo?: RankingInfo; - _distinctSeqID?: number; - /** - * The recommendation score. - */ - _score: number; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts deleted file mode 100644 index e584f40fc0..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendHits.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RecommendHit } from './recommendHit'; - -export type RecommendHits = { - hits?: RecommendHit[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts deleted file mode 100644 index 9faca27372..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { SearchParams } from './searchParams'; - -export type RecommendationRequest = { - /** - * The Algolia index name. - */ - indexName: string; - /** - * Unique identifier of the object. - */ - objectID: string; - /** - * The recommendation model to use. - */ - model: RecommendationRequestModel; - /** - * The threshold to use when filtering recommendations by their score. - */ - threshold: number; - /** - * The max number of recommendations to retrieve. If it\'s set to 0, all the recommendations of the objectID may be returned. - */ - maxRecommendations?: number; - queryParameters?: SearchParams; - fallbackParameters?: SearchParams; -}; - -export type RecommendationRequestModel = 'bought-together' | 'related-products'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts deleted file mode 100644 index 1c6fc9ee21..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsResponse.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseSearchResponse } from './baseSearchResponse'; -import type { RecommendHits } from './recommendHits'; - -export type RecommendationsResponse = BaseSearchResponse & RecommendHits; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts deleted file mode 100644 index 127265c98f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/searchParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; -import type { RequiredSearchParams } from './requiredSearchParams'; - -export type SearchParams = BaseSearchParams & - IndexSettingsAsSearchParams & - RequiredSearchParams; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts deleted file mode 100644 index 0f8d17bc3d..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/snippetResult.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type SnippetResult = { - /** - * Markup text with occurrences highlighted. - */ - value?: string; - /** - * Indicates how well the attribute matched the search query. - */ - matchLevel?: SnippetResultMatchLevel; -}; - -export type SnippetResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/package.json b/clients/algoliasearch-client-javascript/packages/recommend/package.json deleted file mode 100644 index 773966aec5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@algolia/recommend", - "version": "5.0.0", - "description": "JavaScript client for @algolia/recommend", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "index.js", - "module": "dist/recommend.esm.node.js", - "types": "index.d.ts", - "jsdelivr": "dist/recommend.umd.browser.js", - "unpkg": "dist/recommend.umd.browser.js", - "browser": "dist/recommend.cjs.browser.js", - "scripts": { - "clean": "rm -rf ./dist" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0", - "@algolia/requester-browser-xhr": "5.0.0", - "@algolia/requester-node-http": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts b/clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts deleted file mode 100644 index 8d1b336333..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendApi.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { - createAuth, - createMemoryCache, - createTransporter, - getUserAgent, - shuffle, -} from '@algolia/client-common'; -import type { - CreateClientOptions, - Headers, - Host, - Request, -} from '@algolia/client-common'; - -import type { GetRecommendationsParams } from '../model/getRecommendationsParams'; -import type { GetRecommendationsResponse } from '../model/getRecommendationsResponse'; - -export const apiClientVersion = '5.0.0'; - -function getDefaultHosts(appId: string): Host[] { - return ( - [ - { - url: `${appId}-dsn.algolia.net`, - accept: 'read', - protocol: 'https', - }, - { - url: `${appId}.algolia.net`, - accept: 'write', - protocol: 'https', - }, - ] as Host[] - ).concat( - shuffle([ - { - url: `${appId}-1.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-2.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - { - url: `${appId}-3.algolianet.com`, - accept: 'readWrite', - protocol: 'https', - }, - ]) - ); -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function createRecommendApi(options: CreateClientOptions) { - const auth = createAuth(options.appId, options.apiKey, options.authMode); - const transporter = createTransporter({ - hosts: options?.hosts ?? getDefaultHosts(options.appId), - hostsCache: createMemoryCache(), - baseHeaders: { - 'content-type': 'application/x-www-form-urlencoded', - ...auth.headers(), - }, - baseQueryParameters: auth.queryParameters(), - userAgent: getUserAgent({ - userAgents: options.userAgents, - client: 'Recommend', - version: apiClientVersion, - }), - timeouts: options.timeouts, - requester: options.requester, - }); - - function addUserAgent(segment: string, version?: string): void { - transporter.userAgent.add({ segment, version }); - } - - /** - * Returns recommendations for a specific model and objectID. - * - * @summary Returns recommendations for a specific model and objectID. - * @param getRecommendationsParams - The getRecommendationsParams object. - */ - function getRecommendations( - getRecommendationsParams: GetRecommendationsParams - ): Promise { - const path = '/1/indexes/*/recommendations'; - const headers: Headers = { Accept: 'application/json' }; - const queryParameters: Record = {}; - - if (!getRecommendationsParams) { - throw new Error( - 'Parameter `getRecommendationsParams` is required when calling `getRecommendations`.' - ); - } - - if (!getRecommendationsParams.requests) { - throw new Error( - 'Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.' - ); - } - - const request: Request = { - method: 'POST', - path, - data: getRecommendationsParams, - }; - - return transporter.request(request, { - queryParameters, - headers, - }); - } - - return { addUserAgent, getRecommendations }; -} - -export type RecommendApi = ReturnType; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json b/clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json deleted file mode 100644 index 89b2007fbb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - }, - "include": ["src", "model", "builds/node.ts", "builds/browser.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts deleted file mode 100644 index 073e14e3d3..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './src/createXhrRequester'; -export * from './src/echoRequester'; diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json deleted file mode 100644 index d9b4584cc5..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@algolia/requester-browser-xhr", - "version": "5.0.0", - "description": "Promise-based request library for browser using xhr.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "dist/requester-browser-xhr.cjs.node.js", - "module": "dist/requester-browser-xhr.esm.node.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc", - "clean": "rm -rf dist/" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts deleted file mode 100644 index 3177907444..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/createXhrRequester.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { EndRequest, Requester, Response } from '@algolia/client-common'; - -export function createXhrRequester(): Requester { - function send(request: EndRequest): Promise { - return new Promise((resolve) => { - const baseRequester = new XMLHttpRequest(); - baseRequester.open(request.method, request.url, true); - - Object.keys(request.headers).forEach((key) => - baseRequester.setRequestHeader(key, request.headers[key]) - ); - - const createTimeout = ( - timeout: number, - content: string - ): NodeJS.Timeout => { - return setTimeout(() => { - baseRequester.abort(); - - resolve({ - status: 0, - content, - isTimedOut: true, - }); - }, timeout * 1000); - }; - - const connectTimeout = createTimeout( - request.connectTimeout, - 'Connection timeout' - ); - - let responseTimeout: NodeJS.Timeout | undefined; - - baseRequester.onreadystatechange = (): void => { - if ( - baseRequester.readyState > baseRequester.OPENED && - responseTimeout === undefined - ) { - clearTimeout(connectTimeout); - - responseTimeout = createTimeout( - request.responseTimeout, - 'Socket timeout' - ); - } - }; - - baseRequester.onerror = (): void => { - // istanbul ignore next - if (baseRequester.status === 0) { - clearTimeout(connectTimeout); - clearTimeout(responseTimeout as NodeJS.Timeout); - - resolve({ - content: baseRequester.responseText || 'Network request failed', - status: baseRequester.status, - isTimedOut: false, - }); - } - }; - - baseRequester.onload = (): void => { - clearTimeout(connectTimeout); - clearTimeout(responseTimeout as NodeJS.Timeout); - - resolve({ - content: baseRequester.responseText, - status: baseRequester.status, - isTimedOut: false, - }); - }; - - baseRequester.send(request.data); - }); - } - - return { send }; -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts deleted file mode 100644 index e6f91baaff..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/src/echoRequester.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { createEchoRequester } from '@algolia/client-common'; -import type { UrlParams } from '@algolia/client-common'; - -function getUrlParams(url: string): UrlParams { - const { host, searchParams: urlSearchParams } = new URL(url); - const userAgent = urlSearchParams.get('x-algolia-agent') || ''; - const searchParams = {}; - - for (const [k, v] of urlSearchParams) { - if (k === 'x-algolia-agent') { - continue; - } - - searchParams[k] = v; - } - - return { - host, - userAgent, - searchParams: - Object.entries(searchParams).length === 0 ? undefined : searchParams, - }; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function echoRequester(status: number = 200) { - return createEchoRequester({ getUrlParams, status }); -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json b/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json deleted file mode 100644 index e14af78d72..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-browser-xhr/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src", "index.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts b/clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts deleted file mode 100644 index d43eff3c7f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './src/echoRequester'; -export * from './src/createHttpRequester'; diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/package.json b/clients/algoliasearch-client-javascript/packages/requester-node-http/package.json deleted file mode 100644 index 22b62eafa8..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@algolia/requester-node-http", - "version": "5.0.0", - "description": "Promise-based request library for node using the native http module.", - "repository": "algolia/algoliasearch-client-javascript", - "author": "Algolia", - "license": "MIT", - "main": "dist/requester-node-http.cjs.node.js", - "module": "dist/requester-node-http.esm.node.js", - "types": "dist/index.d.ts", - "scripts": { - "clean": "rm -rf dist/" - }, - "engines": { - "node": "^14.0.0" - }, - "dependencies": { - "@algolia/client-common": "5.0.0" - }, - "devDependencies": { - "@types/node": "16.11.11", - "typescript": "4.5.4" - } -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts deleted file mode 100644 index fc8b12818b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/createHttpRequester.ts +++ /dev/null @@ -1,95 +0,0 @@ -import http from 'http'; -import https from 'https'; -import { URL } from 'url'; - -import type { EndRequest, Requester, Response } from '@algolia/client-common'; - -// Global agents allow us to reuse the TCP protocol with multiple clients -const agentOptions = { keepAlive: true }; -const httpAgent = new http.Agent(agentOptions); -const httpsAgent = new https.Agent(agentOptions); - -export function createHttpRequester(): Requester { - function send(request: EndRequest): Promise { - return new Promise((resolve) => { - let responseTimeout: NodeJS.Timeout | undefined; - // eslint-disable-next-line prefer-const -- linter thinks this is not reassigned - let connectTimeout: NodeJS.Timeout | undefined; - const url = new URL(request.url); - const path = - url.search === null ? url.pathname : `${url.pathname}${url.search}`; - const options: https.RequestOptions = { - agent: url.protocol === 'https:' ? httpsAgent : httpAgent, - hostname: url.hostname, - path, - method: request.method, - headers: request.headers, - ...(url.port !== undefined ? { port: url.port || '' } : {}), - }; - - const req = (url.protocol === 'https:' ? https : http).request( - options, - (response) => { - let contentBuffers: Buffer[] = []; - - response.on('data', (chunk) => { - contentBuffers = contentBuffers.concat(chunk); - }); - - response.on('end', () => { - clearTimeout(connectTimeout as NodeJS.Timeout); - clearTimeout(responseTimeout as NodeJS.Timeout); - - resolve({ - status: response.statusCode || 0, - content: Buffer.concat(contentBuffers).toString(), - isTimedOut: false, - }); - }); - } - ); - - const createTimeout = ( - timeout: number, - content: string - ): NodeJS.Timeout => { - return setTimeout(() => { - req.destroy(); - - resolve({ - status: 0, - content, - isTimedOut: true, - }); - }, timeout * 1000); - }; - - connectTimeout = createTimeout( - request.connectTimeout, - 'Connection timeout' - ); - - req.on('error', (error) => { - clearTimeout(connectTimeout as NodeJS.Timeout); - clearTimeout(responseTimeout!); - resolve({ status: 0, content: error.message, isTimedOut: false }); - }); - - req.once('response', () => { - clearTimeout(connectTimeout as NodeJS.Timeout); - responseTimeout = createTimeout( - request.responseTimeout, - 'Socket timeout' - ); - }); - - if (request.data !== undefined) { - req.write(request.data); - } - - req.end(); - }); - } - - return { send }; -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts b/clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts deleted file mode 100644 index 34b37584bb..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/src/echoRequester.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { URL } from 'url'; - -import { createEchoRequester } from '@algolia/client-common'; -import type { UrlParams } from '@algolia/client-common'; - -function getUrlParams(url: string): UrlParams { - const { host, searchParams: urlSearchParams } = new URL(url); - const userAgent = urlSearchParams.get('x-algolia-agent') || ''; - const searchParams = {}; - - for (const [k, v] of urlSearchParams) { - if (k === 'x-algolia-agent') { - continue; - } - - searchParams[k] = v; - } - - return { - host, - userAgent, - searchParams: - Object.entries(searchParams).length === 0 ? undefined : searchParams, - }; -} - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function echoRequester(status: number = 200) { - return createEchoRequester({ getUrlParams, status }); -} diff --git a/clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json b/clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json deleted file mode 100644 index e14af78d72..0000000000 --- a/clients/algoliasearch-client-javascript/packages/requester-node-http/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src", "index.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/clients/algoliasearch-client-javascript/rollup.config.js b/clients/algoliasearch-client-javascript/rollup.config.js deleted file mode 100644 index c00d3528bb..0000000000 --- a/clients/algoliasearch-client-javascript/rollup.config.js +++ /dev/null @@ -1,249 +0,0 @@ -import path from 'path'; - -import babel from '@rollup/plugin-babel'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import filesize from 'rollup-plugin-filesize'; -import globals from 'rollup-plugin-node-globals'; -import { terser } from 'rollup-plugin-terser'; -import ts from 'rollup-plugin-typescript2'; - -import generatorConfig from '../../openapitools.json'; - -import { version } from './version'; - -// Retrieve package to build -const client = process.env.CLIENT?.replace('@algolia/', ''); -const UTILS = ['client-common', 'requester-browser-xhr', 'requester-node-http']; - -function createLicence(name) { - return `/*! ${name}.umd.js | ${version} | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */`; -} - -function createBundlers({ output, clientPath }) { - return { - 'esm-node': { - file: `${clientPath}/dist/${output}.esm.node.js`, - format: 'es', - }, - 'esm-browser': { - file: `${clientPath}/dist/${output}.esm.browser.js`, - format: 'es', - }, - 'umd-browser': { - file: `${clientPath}/dist/${output}.umd.browser.js`, - format: 'umd', - }, - 'cjs-node': { - file: `${clientPath}/dist/${output}.cjs.node.js`, - format: 'cjs', - }, - 'cjs-browser': { - file: `${clientPath}/dist/${output}.cjs.browser.js`, - format: 'cjs', - }, - }; -} - -function getAvailableClients() { - // We default `algoliasearch` as it's not a generated client, but an aggregation of - // multiple clients. - const availableClients = ['algoliasearch']; - const generators = Object.entries( - generatorConfig['generator-cli'].generators - ); - - for (const [name, options] of generators) { - if (name.startsWith('javascript')) { - availableClients.push(options.additionalProperties.buildFile); - } - } - - return client === 'all' - ? availableClients - : availableClients.filter((availableClient) => availableClient === client); -} - -function initPackagesConfig() { - if (UTILS.includes(client)) { - const commonOptions = { - input: 'index.ts', - formats: ['cjs-node', 'esm-node'], - external: [], - dependencies: [], - }; - - const availableUtils = [ - // Common - { - ...commonOptions, - output: 'client-common', - package: 'client-common', - name: '@algolia/client-common', - }, - // Browser requester - { - ...commonOptions, - output: 'requester-browser-xhr', - package: 'requester-browser-xhr', - name: '@algolia/requester-browser-xhr', - external: ['dom'], - dependencies: ['@algolia/client-common'], - }, - // Node requester - { - ...commonOptions, - output: 'requester-node-http', - package: 'requester-node-http', - name: '@algolia/requester-node-http', - external: ['https', 'http', 'url'], - dependencies: ['@algolia/client-common'], - }, - ]; - - return client === 'all' - ? availableUtils - : availableUtils.filter( - (availableUtil) => availableUtil.package === client - ); - } - - const availableClients = getAvailableClients(); - - if (availableClients.length === 0) { - throw new Error(`No clients matching ${client}.`); - } - - return availableClients.flatMap((packageName) => { - const isAlgoliasearchClient = packageName.startsWith('algoliasearch'); - const commonConfig = { - package: packageName, - name: isAlgoliasearchClient ? packageName : `@algolia/${packageName}`, - output: packageName, - dependencies: isAlgoliasearchClient - ? [ - '@algolia/client-analytics', - '@algolia/client-common', - '@algolia/client-personalization', - '@algolia/client-search', - ] - : ['@algolia/client-common'], - external: [], - }; - const browserFormats = ['umd-browser', 'esm-browser', 'cjs-browser']; - const nodeFormats = ['cjs-node', 'esm-node']; - - return [ - { - ...commonConfig, - input: 'builds/browser.ts', - formats: browserFormats, - external: ['dom'], - dependencies: [ - ...commonConfig.dependencies, - '@algolia/requester-browser-xhr', - ], - globals: { - [packageName]: packageName, - }, - }, - { - ...commonConfig, - input: 'builds/node.ts', - dependencies: [ - ...commonConfig.dependencies, - '@algolia/requester-node-http', - ], - formats: nodeFormats, - }, - ]; - }); -} - -const packagesConfig = initPackagesConfig(); -const rollupConfig = []; - -packagesConfig.forEach((packageConfig) => { - const clientPath = path.resolve('packages', packageConfig.package); - const bundlers = createBundlers({ - output: packageConfig.output, - clientPath, - }); - - packageConfig.formats.forEach((format) => { - // Avoid generating types multiple times. - let isTypesGenerated = false; - const output = bundlers[format]; - const isUmdBuild = format === 'umd-browser'; - const isEsmBrowserBuild = format === 'esm-browser'; - - if (isUmdBuild) { - output.name = packageConfig.name; - output.banner = createLicence(packageConfig.package); - } - - const compressorPlugins = isUmdBuild ? [terser()] : []; - const transpilerPlugins = isUmdBuild - ? [ - babel({ - babelrc: false, - babelHelpers: 'runtime', - extensions: ['.ts'], - exclude: 'node_modules/**', - presets: [ - [ - '@babel/preset-env', - { - targets: { - browsers: ['> .5%', 'ie >= 11'], - }, - }, - ], - ], - plugins: ['@babel/plugin-transform-runtime'], - }), - ] - : []; - - if (isUmdBuild || isEsmBrowserBuild) { - // eslint-disable-next-line no-param-reassign - packageConfig.dependencies = []; - } - - rollupConfig.push({ - input: path.resolve(clientPath, packageConfig.input), - external: [...packageConfig.dependencies, ...packageConfig.external], - plugins: [ - globals({ - global: true, - }), - nodeResolve(), - ts({ - check: !isTypesGenerated, - tsconfig: path.resolve(clientPath, 'tsconfig.json'), - tsconfigOverride: { - compilerOptions: { - declaration: !isTypesGenerated, - declarationMap: !isTypesGenerated, - }, - }, - }), - ...transpilerPlugins, - ...compressorPlugins, - filesize({ - showMinifiedSize: false, - showGzippedSize: true, - }), - ], - output, - onwarn(msg, warn) { - if (!/Circular/.test(msg)) { - warn(msg); - } - }, - }); - - isTypesGenerated = true; - }); -}); - -export default rollupConfig; diff --git a/clients/algoliasearch-client-javascript/tsconfig.json b/clients/algoliasearch-client-javascript/tsconfig.json deleted file mode 100644 index c702d5fd26..0000000000 --- a/clients/algoliasearch-client-javascript/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "allowJs": false, - "allowSyntheticDefaultImports": true, - "declaration": true, - "esModuleInterop": true, - "lib": ["dom", "esnext", "dom.iterable", "scripthost"], - "module": "esnext", - "moduleResolution": "node", - "noImplicitAny": false, - "noImplicitThis": true, - "noLib": false, - "noUnusedLocals": true, - "outDir": "dist", - "removeComments": true, - "sourceMap": true, - "strict": true, - "suppressImplicitAnyIndexErrors": true, - "target": "esnext", - "typeRoots": ["node_modules/@types"], - "types": ["node"] - }, - "include": ["packages/**/*.ts"], - "exclude": ["dist", "node_modules"] -} \ No newline at end of file From 36609f5d0e229137c99bb062429d73578fc9395a Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 1 Mar 2022 17:40:38 +0100 Subject: [PATCH 45/69] chore: add javascript repo as submodule again --- clients/algoliasearch-client-javascript | 1 + 1 file changed, 1 insertion(+) create mode 160000 clients/algoliasearch-client-javascript diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript new file mode 160000 index 0000000000..78d8bee083 --- /dev/null +++ b/clients/algoliasearch-client-javascript @@ -0,0 +1 @@ +Subproject commit 78d8bee0838e7162c11dbb089adf3a007f6c5fdb From 020dbc631da82a26b6fa2c0a7a65f1dd06f890fc Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 09:49:13 +0100 Subject: [PATCH 46/69] chore: update reference to js repo --- clients/algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript index 78d8bee083..44ef8cc1a8 160000 --- a/clients/algoliasearch-client-javascript +++ b/clients/algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 78d8bee0838e7162c11dbb089adf3a007f6c5fdb +Subproject commit 44ef8cc1a8f287e8ee2fe0a3378245c21ae03b5e From 22a1e49b86979828f8bb84a9d3c882cf9bcb6060 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 09:51:28 +0100 Subject: [PATCH 47/69] chore: update reference to submodules --- clients/algoliasearch-client-java-2 | 2 +- clients/algoliasearch-client-php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/algoliasearch-client-java-2 b/clients/algoliasearch-client-java-2 index 0af7adf44e..98790ee0ba 160000 --- a/clients/algoliasearch-client-java-2 +++ b/clients/algoliasearch-client-java-2 @@ -1 +1 @@ -Subproject commit 0af7adf44e04b80738767827259194bf2b222015 +Subproject commit 98790ee0badc9258270e3d71a96464bd40efabdb diff --git a/clients/algoliasearch-client-php b/clients/algoliasearch-client-php index 8d78421f83..4c1c086445 160000 --- a/clients/algoliasearch-client-php +++ b/clients/algoliasearch-client-php @@ -1 +1 @@ -Subproject commit 8d78421f831b31868506e429828935c4dd1a0f23 +Subproject commit 4c1c086445c7df08fc236a456ad070b95b9f2d8f From 7edb048d0c20532c3b31f41a9164efe1bdf0574c Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 10:03:01 +0100 Subject: [PATCH 48/69] chore: fix changelog path --- scripts/release/process-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index dfe2fcf7ac..e6514043d3 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -118,7 +118,7 @@ async function processRelease(): Promise { // update changelog const changelogPath = toAbsolutePath( - `clients/${clientsConfig[lang].folder}/CHANGELOG.md` + `${clientsConfig[lang].folder}/CHANGELOG.md` ); const existingContent = (await exists(changelogPath)) ? (await fsp.readFile(changelogPath)).toString() From 3a1c4c72889cbb850eb4000961bd5dcf08d0dd19 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 10:42:45 +0100 Subject: [PATCH 49/69] chore: configure git author in submodules before commiting --- release.config.json | 6 +++++- scripts/release/process-release.ts | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/release.config.json b/release.config.json index 3365f5d02f..153e66e04e 100644 --- a/release.config.json +++ b/release.config.json @@ -8,5 +8,9 @@ "php": "next", "java": "next" }, - "defaultTargetBranch": "next" + "defaultTargetBranch": "next", + "gitAuthor": { + "name": "api-clients-bot", + "email": "bot@algolia.com" + } } diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index e6514043d3..6c1740a079 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -6,6 +6,7 @@ import execa from 'execa'; import clientsConfig from '../../clients.config.json'; import openapitools from '../../openapitools.json'; +import releaseConfig from '../../release.config.json'; import { toAbsolutePath, run, exists, getGitHubUrl } from '../common'; import { @@ -89,8 +90,8 @@ async function processRelease(): Promise { JSON.stringify(openapitools, null, 2) ); - await run('git config user.name "api-clients-bot"'); - await run('git config user.email "bot@algolia.com"'); + await run(`git config user.name "${releaseConfig.gitAuthor.name}"`); + await run(`git config user.email "${releaseConfig.gitAuthor.email}"`); // commit openapitools and changelogs await run('git add openapitools.json'); @@ -139,6 +140,12 @@ async function processRelease(): Promise { ); // commit changelog and the generated client + await run(`git config user.name "${releaseConfig.gitAuthor.name}"`, { + cwd: clientPath, + }); + await run(`git config user.email "${releaseConfig.gitAuthor.email}"`, { + cwd: clientPath, + }); await run(`git add .`, { cwd: clientPath }); if (goal === 'release') { await execa('git', ['commit', '-m', `chore: release ${nextVersion}`], { From e7da3a87dfeba26ae031f8fb1eb633a99774da87 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 10:43:20 +0100 Subject: [PATCH 50/69] chore: add debug code --- scripts/release/create-release-issue.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/release/create-release-issue.ts b/scripts/release/create-release-issue.ts index c2dc26288b..b9d4adf2fa 100755 --- a/scripts/release/create-release-issue.ts +++ b/scripts/release/create-release-issue.ts @@ -42,16 +42,18 @@ if (!process.env.GITHUB_TOKEN) { } async function createReleaseIssue(): Promise { - if ((await run('git rev-parse --abbrev-ref HEAD')) !== MAIN_BRANCH) { - throw new Error( - `You can run this script only from \`${MAIN_BRANCH}\` branch.` - ); - } + if (process.env.SKIP_VALIDATION !== 'true') { + if ((await run('git rev-parse --abbrev-ref HEAD')) !== MAIN_BRANCH) { + throw new Error( + `You can run this script only from \`${MAIN_BRANCH}\` branch.` + ); + } - if (await run('git status --porcelain')) { - throw new Error( - 'Working directory is not clean. Commit all the changes first.' - ); + if (await run('git status --porcelain')) { + throw new Error( + 'Working directory is not clean. Commit all the changes first.' + ); + } } await run(`git rev-parse --verify refs/tags/${RELEASED_TAG}`, { From 336ba6b2315a05cfc5ff9712dadbe3b94d1d2ce6 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 10:54:23 +0100 Subject: [PATCH 51/69] chore: fix client path --- scripts/release/process-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 6c1740a079..6b7c86f408 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -165,7 +165,7 @@ async function processRelease(): Promise { } // add the new reference of the submodule in the monorepo - await run(`git add clients/${clientsConfig[lang].folder}`); + await run(`git add ${clientsConfig[lang].folder}`); } await execa('git', ['commit', '-m', TEXT.commitMessage]); From 4215d667615898a1685c9361c0e9664a49514161 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 11:31:12 +0100 Subject: [PATCH 52/69] chore: make it fail-safe --- scripts/release/process-release.ts | 113 ++++++++++++++++++----------- 1 file changed, 69 insertions(+), 44 deletions(-) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 6b7c86f408..80b28a1890 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -28,29 +28,25 @@ if (!process.env.EVENT_NUMBER) { throw new Error('Environment variable `EVENT_NUMBER` does not exist.'); } -async function processRelease(): Promise { - const issueBody = JSON.parse( +function getIssueBody(): string { + return JSON.parse( execa.sync('curl', [ '-H', `Authorization: token ${process.env.GITHUB_TOKEN}`, `https://api.github.com/repos/${OWNER}/${REPO}/issues/${process.env.EVENT_NUMBER}`, ]).stdout ).body; +} - if ( - !getMarkdownSection(issueBody, TEXT.approvalHeader) - .split('\n') - .find((line) => line.startsWith(`- [x] ${TEXT.approved}`)) - ) { - throw new Error('The issue was not approved.'); - } +type VersionsToRelease = { + [lang: string]: { + current: string; + next: string; + }; +}; - const versionsToRelease: { - [lang: string]: { - current: string; - next: string; - }; - } = {}; +function getVersionsToRelease(issueBody: string): VersionsToRelease { + const versionsToRelease: VersionsToRelease = {}; getMarkdownSection(issueBody, TEXT.versionChangeHeader) .split('\n') .forEach((line) => { @@ -65,18 +61,22 @@ async function processRelease(): Promise { }; }); - const langsToUpdateRepo = getMarkdownSection( - issueBody, - TEXT.versionChangeHeader - ) + return versionsToRelease; +} + +function getLangsToUpdateRepo(issueBody: string): string[] { + return getMarkdownSection(issueBody, TEXT.versionChangeHeader) .split('\n') .map((line) => { const result = line.match(/- \[ \] (.+): v(.+) -> v(.+)/); return result?.[1]; }) - .filter(Boolean) as string[]; // e.g. ['javascript', 'php'] + .filter(Boolean) as string[]; +} - // update versions in `openapitools.json` +async function updateOpenApiTools( + versionsToRelease: VersionsToRelease +): Promise { Object.keys(openapitools['generator-cli'].generators).forEach((client) => { const lang = client.split('-')[0]; if (versionsToRelease[lang]) { @@ -89,9 +89,32 @@ async function processRelease(): Promise { toAbsolutePath('openapitools.json'), JSON.stringify(openapitools, null, 2) ); +} + +async function configureGitHubAuthor(cwd?: string): Promise { + await run(`git config user.name "${releaseConfig.gitAuthor.name}"`, { cwd }); + await run(`git config user.email "${releaseConfig.gitAuthor.email}"`, { + cwd, + }); +} - await run(`git config user.name "${releaseConfig.gitAuthor.name}"`); - await run(`git config user.email "${releaseConfig.gitAuthor.email}"`); +async function processRelease(): Promise { + const issueBody = getIssueBody(); + + if ( + !getMarkdownSection(issueBody, TEXT.approvalHeader) + .split('\n') + .find((line) => line.startsWith(`- [x] ${TEXT.approved}`)) + ) { + throw new Error('The issue was not approved.'); + } + + const versionsToRelease = getVersionsToRelease(issueBody); + const langsToUpdateRepo = getLangsToUpdateRepo(issueBody); // e.g. ['javascript', 'php'] + + await updateOpenApiTools(versionsToRelease); + + await configureGitHubAuthor(); // commit openapitools and changelogs await run('git add openapitools.json'); @@ -101,9 +124,10 @@ async function processRelease(): Promise { ...langsToUpdateRepo, ]; - for (const lang of langsToReleaseOrUpdate) { - const goal = versionsToRelease[lang] ? 'release' : 'update'; + const willReleaseLibrary = (lang: string): boolean => + Boolean(versionsToRelease[lang]); + for (const lang of langsToReleaseOrUpdate) { // prepare the submodule const clientPath = toAbsolutePath(clientsConfig[lang].folder); const targetBranch = getTargetBranch(lang); @@ -111,7 +135,7 @@ async function processRelease(): Promise { await run(`git pull origin ${targetBranch}`, { cwd: clientPath }); console.log(`Generating ${lang} client(s)...`); - await run(`yarn cli generate ${lang}`); + console.log(await run(`yarn cli generate ${lang}`)); const dateStamp = new Date().toISOString().split('T')[0]; const currentVersion = versionsToRelease[lang].current; @@ -124,12 +148,11 @@ async function processRelease(): Promise { const existingContent = (await exists(changelogPath)) ? (await fsp.readFile(changelogPath)).toString() : ''; - const changelogHeader = - goal === 'release' - ? `## [v${nextVersion}](${getGitHubUrl( - lang - )}/compare/v${currentVersion}...v${nextVersion})` - : `## ${dateStamp}`; + const changelogHeader = willReleaseLibrary(lang) + ? `## [v${nextVersion}](${getGitHubUrl( + lang + )}/compare/v${currentVersion}...v${nextVersion})` + : `## ${dateStamp}`; const newChangelog = getMarkdownSection( getMarkdownSection(issueBody, TEXT.changelogHeader), `### ${lang}` @@ -140,14 +163,9 @@ async function processRelease(): Promise { ); // commit changelog and the generated client - await run(`git config user.name "${releaseConfig.gitAuthor.name}"`, { - cwd: clientPath, - }); - await run(`git config user.email "${releaseConfig.gitAuthor.email}"`, { - cwd: clientPath, - }); + await configureGitHubAuthor(clientPath); await run(`git add .`, { cwd: clientPath }); - if (goal === 'release') { + if (willReleaseLibrary(lang)) { await execa('git', ['commit', '-m', `chore: release ${nextVersion}`], { cwd: clientPath, }); @@ -158,16 +176,23 @@ async function processRelease(): Promise { }); } - // push the commit to the submodule + // add the new reference of the submodule in the monorepo + await run(`git add ${clientsConfig[lang].folder}`); + } + + // We push commits from submodules AFTER all the generations are done. + // Otherwise, we will end up having broken release. + for (const lang of langsToReleaseOrUpdate) { + const clientPath = toAbsolutePath(clientsConfig[lang].folder); + const targetBranch = getTargetBranch(lang); + await run(`git push origin ${targetBranch}`, { cwd: clientPath }); - if (goal === 'release') { + if (willReleaseLibrary(lang)) { await run('git push --tags', { cwd: clientPath }); } - - // add the new reference of the submodule in the monorepo - await run(`git add ${clientsConfig[lang].folder}`); } + // Commit and push from the monorepo level. await execa('git', ['commit', '-m', TEXT.commitMessage]); await run(`git push`); From a89cdbf72df3943f3e88aa0ae54706ac8856bc00 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 11:52:39 +0100 Subject: [PATCH 53/69] chore: fetch tag before updating it --- scripts/release/process-release.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 80b28a1890..adad33b4c5 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -197,6 +197,7 @@ async function processRelease(): Promise { await run(`git push`); // remove old `released` tag + await run(`git fetch origin refs/tags/released:refs/tags/released`); await run(`git tag -d ${RELEASED_TAG}`); await run(`git push --delete origin ${RELEASED_TAG}`); From 43fa93ee4c395703ce6288d2c6c3dcdda58e2c89 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 14:08:30 +0100 Subject: [PATCH 54/69] chore: update reference to submodule --- clients/algoliasearch-client-javascript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript index 44ef8cc1a8..83c3b49cc7 160000 --- a/clients/algoliasearch-client-javascript +++ b/clients/algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 44ef8cc1a8f287e8ee2fe0a3378245c21ae03b5e +Subproject commit 83c3b49cc75800008cf351208224e621d8b4d120 From ecf5ae884288c314aea9dfdf1d1ff223723413a7 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 14:51:44 +0100 Subject: [PATCH 55/69] chore: fix GHA --- .github/actions/setup/action.yml | 8 ++++++++ .github/workflows/process-release.yml | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 1e155cd1ac..5a52e33e47 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -5,6 +5,14 @@ description: Setup CI environment. runs: using: composite steps: + - name: Update submodules + run: | + git config --file .gitmodules --get-regexp url | while read url; do + git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") + done + git submodule sync + git submodule update --init --recursive + - name: Install Java uses: actions/setup-java@v2 with: diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index a23cc2b8ed..2441e374e5 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -20,15 +20,6 @@ jobs: submodules: recursive token: ${{ secrets.TOKEN_RELEASE_BOT }} - - run: git checkout chore/release - - - run: | - git config --file .gitmodules --get-regexp url | while read url; do - git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") - done - git submodule sync - git submodule update --init --recursive - - name: Setup id: setup uses: ./.github/actions/setup From 59cf0d93018ab2d7e18e0c94f33aab6e1cbe9247 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 14:54:30 +0100 Subject: [PATCH 56/69] chore: fix broken GHA --- .github/actions/setup/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5a52e33e47..f821b85e6d 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -6,6 +6,8 @@ runs: using: composite steps: - name: Update submodules + id: update-submodule + shell: bash run: | git config --file .gitmodules --get-regexp url | while read url; do git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") From 8b6ae7f25ee410022cd886db21d1b09f18e3597f Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 15:04:29 +0100 Subject: [PATCH 57/69] chore: provide token as env var --- .github/actions/setup/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index f821b85e6d..d2c3adb576 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -8,9 +8,11 @@ runs: - name: Update submodules id: update-submodule shell: bash + env: + TOKEN_RELEASE_BOT: ${{ secrets.TOKEN_RELEASE_BOT }} run: | git config --file .gitmodules --get-regexp url | while read url; do - git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") + git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/$TOKEN_RELEASE_BOT:$TOKEN_RELEASE_BOT@github.com\//") done git submodule sync git submodule update --init --recursive From 8d4ba9d7576c15cf440c043db3f8f6ad657e9293 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 15:15:36 +0100 Subject: [PATCH 58/69] chore: move submodule related logic out of action.yml --- .github/actions/setup/action.yml | 12 ------------ .github/workflows/check.yml | 8 ++++++++ .github/workflows/process-release.yml | 8 ++++++++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index d2c3adb576..1e155cd1ac 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -5,18 +5,6 @@ description: Setup CI environment. runs: using: composite steps: - - name: Update submodules - id: update-submodule - shell: bash - env: - TOKEN_RELEASE_BOT: ${{ secrets.TOKEN_RELEASE_BOT }} - run: | - git config --file .gitmodules --get-regexp url | while read url; do - git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/$TOKEN_RELEASE_BOT:$TOKEN_RELEASE_BOT@github.com\//") - done - git submodule sync - git submodule update --init --recursive - - name: Install Java uses: actions/setup-java@v2 with: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8ea99aff9d..2efc59567d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,6 +23,14 @@ jobs: with: fetch-depth: 0 + - name: Update submodules + run: | + git config --file .gitmodules --get-regexp url | while read url; do + git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") + done + git submodule sync + git submodule update --init --recursive + - name: Setup id: setup uses: ./.github/actions/setup diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index 2441e374e5..a8c286c2b0 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -20,6 +20,14 @@ jobs: submodules: recursive token: ${{ secrets.TOKEN_RELEASE_BOT }} + - name: Update submodules + run: | + git config --file .gitmodules --get-regexp url | while read url; do + git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") + done + git submodule sync + git submodule update --init --recursive + - name: Setup id: setup uses: ./.github/actions/setup From 8582769a893306b9f2ee1338ee74102b3ef0bc03 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 15:27:21 +0100 Subject: [PATCH 59/69] chore: extract as actions/submodule --- .github/actions/submodule/action.yml | 20 ++++++++++++++ .github/workflows/check.yml | 38 ++++++++++++++++++++++----- .github/workflows/process-release.yml | 10 +++---- 3 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 .github/actions/submodule/action.yml diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml new file mode 100644 index 0000000000..56a090d2d9 --- /dev/null +++ b/.github/actions/submodule/action.yml @@ -0,0 +1,20 @@ +name: Submodule + +description: Update submodules + +inputs: + token: + description: GitHub Token + required: true + +runs: + steps: + - name: Update submodules + env: + GITHUB_TOKEN: ${{ inputs.token }} + run: | + git config --file .gitmodules --get-regexp url | while read url; do + git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/$GITHUB_TOKEN:$GITHUB_TOKEN@github.com\//") + done + git submodule sync + git submodule update --init --recursive diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2efc59567d..eaddee6210 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,13 +23,9 @@ jobs: with: fetch-depth: 0 - - name: Update submodules - run: | - git config --file .gitmodules --get-regexp url | while read url; do - git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") - done - git submodule sync - git submodule update --init --recursive + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} - name: Setup id: setup @@ -64,6 +60,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache uses: ./.github/actions/cache @@ -89,6 +89,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache uses: ./.github/actions/cache with: @@ -118,6 +122,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache uses: ./.github/actions/cache with: @@ -156,6 +164,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache uses: ./.github/actions/cache with: @@ -195,6 +207,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache uses: ./.github/actions/cache with: @@ -226,6 +242,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache id: restore uses: ./.github/actions/cache @@ -250,6 +270,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} + - name: Restore cache id: restore uses: ./.github/actions/cache diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index a8c286c2b0..fb2e5347bf 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -20,13 +20,9 @@ jobs: submodules: recursive token: ${{ secrets.TOKEN_RELEASE_BOT }} - - name: Update submodules - run: | - git config --file .gitmodules --get-regexp url | while read url; do - git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.TOKEN_RELEASE_BOT }}:${{ secrets.TOKEN_RELEASE_BOT }}@github.com\//") - done - git submodule sync - git submodule update --init --recursive + - uses: ./.github/actions/submodule + with: + token: $${{ secrets.TOKEN_RELEASE_BOT }} - name: Setup id: setup From 67ba9823c760927a63e38f41f4f0e0de3342ece7 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 15:30:42 +0100 Subject: [PATCH 60/69] chore: add missing properties --- .github/actions/submodule/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml index 56a090d2d9..64694d55e9 100644 --- a/.github/actions/submodule/action.yml +++ b/.github/actions/submodule/action.yml @@ -12,6 +12,8 @@ runs: - name: Update submodules env: GITHUB_TOKEN: ${{ inputs.token }} + id: update-submodules + shell: bash run: | git config --file .gitmodules --get-regexp url | while read url; do git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/$GITHUB_TOKEN:$GITHUB_TOKEN@github.com\//") From 787dbf607b77ab44da6823b3e6dd3e0a508bd952 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 15:37:12 +0100 Subject: [PATCH 61/69] chore: fix submodule action --- .github/actions/submodule/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml index 64694d55e9..854f73d765 100644 --- a/.github/actions/submodule/action.yml +++ b/.github/actions/submodule/action.yml @@ -10,13 +10,11 @@ inputs: runs: steps: - name: Update submodules - env: - GITHUB_TOKEN: ${{ inputs.token }} id: update-submodules shell: bash run: | git config --file .gitmodules --get-regexp url | while read url; do - git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/$GITHUB_TOKEN:$GITHUB_TOKEN@github.com\//") + git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ inputs.token }}:${{ inputs.token }}@github.com\//") done git submodule sync git submodule update --init --recursive From 412726053f783c17231ee1acaeeced248fa7a999 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 15:42:35 +0100 Subject: [PATCH 62/69] chore: adding composite --- .github/actions/submodule/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml index 854f73d765..b468624fbc 100644 --- a/.github/actions/submodule/action.yml +++ b/.github/actions/submodule/action.yml @@ -8,6 +8,7 @@ inputs: required: true runs: + using: composite steps: - name: Update submodules id: update-submodules From a51689b8a3764052b3961177e3e208c5b9419758 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 16:02:43 +0100 Subject: [PATCH 63/69] chore: remove unused env var --- .github/workflows/process-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index fb2e5347bf..dcc866217e 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -32,4 +32,3 @@ jobs: env: EVENT_NUMBER: ${{ github.event.issue.number }} GITHUB_TOKEN: ${{ secrets.TOKEN_RELEASE_BOT }} - RELEASE_TEST: ${{ secrets.RELEASE_TEST }} From 6d9a27ebb65d5e33fffeb5c3aa66139441b0be47 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 16:37:21 +0100 Subject: [PATCH 64/69] chore: update reference to submodule --- clients/algoliasearch-client-javascript | 2 +- yarn.lock | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/clients/algoliasearch-client-javascript b/clients/algoliasearch-client-javascript index 83c3b49cc7..ef777d6156 160000 --- a/clients/algoliasearch-client-javascript +++ b/clients/algoliasearch-client-javascript @@ -1 +1 @@ -Subproject commit 83c3b49cc75800008cf351208224e621d8b4d120 +Subproject commit ef777d615694853b99fd198c0b5de701cc943bd8 diff --git a/yarn.lock b/yarn.lock index e7e2b440aa..4e2103c9fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -615,7 +615,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-class-properties@npm:^7.16.7": +"@babel/plugin-proposal-class-properties@npm:7.16.7, @babel/plugin-proposal-class-properties@npm:^7.16.7": version: 7.16.7 resolution: "@babel/plugin-proposal-class-properties@npm:7.16.7" dependencies: @@ -3524,6 +3524,7 @@ __metadata: resolution: "algoliasearch-client-javascript@workspace:clients/algoliasearch-client-javascript" dependencies: "@babel/core": 7.17.2 + "@babel/plugin-proposal-class-properties": 7.16.7 "@babel/plugin-transform-runtime": 7.17.0 "@babel/preset-env": 7.16.11 "@babel/runtime": 7.17.2 From 4caeeec599311137d561637a99e0fa3fa452a4a1 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 16:49:57 +0100 Subject: [PATCH 65/69] docs: update submodules.md --- docs/submodules.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/submodules.md b/docs/submodules.md index f98d02ae92..aba3ff2f07 100644 --- a/docs/submodules.md +++ b/docs/submodules.md @@ -1,11 +1,11 @@ ## Add a submodule ```sh -git submodule add git@github.com:algolia/algoliasearch-client-javascript.git clients/algoliasearch-client-javascript +git submodule add git@github.com:algolia/.git clients/ -(cd clients/algoliasearch-client-javascript && git checkout -b next) +(cd clients/ && git checkout -b next) -git add clients/algoliasearch-client-javascript +git add clients/ git commit -m "chore: add submodule" ``` @@ -14,7 +14,7 @@ git commit -m "chore: add submodule" This repository does not include the actual repository of the submodule. It's just a reference. ```sh -cd clients/algoliasearch-client-javascript +cd clients/ ``` You need to checkout to a specific branch, because it's normally detached. From 08e3d43db5318a36c05eb29987e5bbdf2930cf52 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 16:54:11 +0100 Subject: [PATCH 66/69] chore: update description of GHA --- .github/actions/submodule/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml index b468624fbc..2374c3f163 100644 --- a/.github/actions/submodule/action.yml +++ b/.github/actions/submodule/action.yml @@ -1,10 +1,10 @@ name: Submodule -description: Update submodules +description: 'Update submodules because actions/checkout@v2 does not pull submodule repositories out of the box' inputs: token: - description: GitHub Token + description: 'GitHub Token (We can use personal access token with repo ACL)' required: true runs: From 751131dbf4cda4972eef459e6c6acda2b63339e0 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 17:08:57 +0100 Subject: [PATCH 67/69] chore: fix GHA lint error --- .github/actions/submodule/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml index 2374c3f163..cf828da878 100644 --- a/.github/actions/submodule/action.yml +++ b/.github/actions/submodule/action.yml @@ -1,10 +1,10 @@ name: Submodule -description: 'Update submodules because actions/checkout@v2 does not pull submodule repositories out of the box' +description: "Update submodules because actions/checkout@v2 does not pull submodule repositories out of the box" inputs: token: - description: 'GitHub Token (We can use personal access token with repo ACL)' + description: "GitHub Token (We can use personal access token with repo ACL)" required: true runs: From 3a4d70249c5fffc3af61fa4379f3ecd13df367d7 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 2 Mar 2022 17:26:42 +0100 Subject: [PATCH 68/69] chore: fix yaml lint error --- .github/actions/submodule/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/submodule/action.yml b/.github/actions/submodule/action.yml index cf828da878..88f5b04006 100644 --- a/.github/actions/submodule/action.yml +++ b/.github/actions/submodule/action.yml @@ -1,10 +1,12 @@ name: Submodule -description: "Update submodules because actions/checkout@v2 does not pull submodule repositories out of the box" +description: Update submodules +# because actions/checkout@v2 does not pull submodule repositories out of the box inputs: token: - description: "GitHub Token (We can use personal access token with repo ACL)" + # We can use personal access token with repo ACL + description: GitHub Token required: true runs: From 73391de8d4199a8363c8e9d2cb6dc901d2aae82d Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Thu, 3 Mar 2022 11:18:48 +0100 Subject: [PATCH 69/69] chore: remove debugging code --- scripts/release/create-release-issue.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/release/create-release-issue.ts b/scripts/release/create-release-issue.ts index b9d4adf2fa..c2dc26288b 100755 --- a/scripts/release/create-release-issue.ts +++ b/scripts/release/create-release-issue.ts @@ -42,18 +42,16 @@ if (!process.env.GITHUB_TOKEN) { } async function createReleaseIssue(): Promise { - if (process.env.SKIP_VALIDATION !== 'true') { - if ((await run('git rev-parse --abbrev-ref HEAD')) !== MAIN_BRANCH) { - throw new Error( - `You can run this script only from \`${MAIN_BRANCH}\` branch.` - ); - } + if ((await run('git rev-parse --abbrev-ref HEAD')) !== MAIN_BRANCH) { + throw new Error( + `You can run this script only from \`${MAIN_BRANCH}\` branch.` + ); + } - if (await run('git status --porcelain')) { - throw new Error( - 'Working directory is not clean. Commit all the changes first.' - ); - } + if (await run('git status --porcelain')) { + throw new Error( + 'Working directory is not clean. Commit all the changes first.' + ); } await run(`git rev-parse --verify refs/tags/${RELEASED_TAG}`, {