From 71470e3831b0d2adccc1e72134257e7d8d2c433e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= <20689156+shortcuts@users.noreply.github.com> Date: Tue, 4 Jan 2022 11:18:04 +0100 Subject: [PATCH] feat(js): group parameters (#46) --- .eslintrc.js | 2 - README.md | 2 +- .../model/AddOrUpdateObjectResponse.java | 130 - .../algolia/model/ClearObjectsResponse.java | 103 - .../com/algolia/model/DeleteByResponse.java | 103 - .../algolia/model/DeleteObjectResponse.java | 103 - .../model/PartialUpdateObjectResponse.java | 130 - .../com/algolia/model/SearchParams.java | 28 + .../com/algolia/model/SearchParamsObject.java | 3374 +++++++++++++++++ ...sAsString.java => SearchParamsString.java} | 12 +- .../com/algolia/search/SearchApi.java | 95 +- .../client-analytics/src/analyticsApi.ts | 750 ++-- .../src/personalizationApi.ts | 61 +- .../model/addOrUpdateObjectResponse.ts | 14 - .../client-search/model/models.ts | 3 +- .../model/partialUpdateObjectResponse.ts | 14 - .../client-search/model/searchParams.ts | 6 +- .../client-search/model/searchParamsObject.ts | 4 + ...aramsAsString.ts => searchParamsString.ts} | 2 +- .../client-search/src/searchApi.ts | 1006 +++-- .../recommend/model/getRecommendations.ts | 3 + .../recommend/src/recommendApi.ts | 22 +- playground/javascript/analytics.ts | 4 +- playground/javascript/personalization.ts | 2 +- playground/javascript/recommend.ts | 30 +- playground/javascript/search.ts | 5 +- specs/recommend/paths/getRecommendations.yml | 1 + specs/search/common/schemas/SearchParams.yml | 7 +- specs/search/paths/objects/clearObjects.yml | 2 +- specs/search/paths/objects/deleteBy.yml | 6 +- specs/search/paths/objects/partialUpdate.yml | 2 +- specs/search/paths/search/search.yml | 4 +- .../java/libraries/okhttp-gson/api.mustache | 66 +- templates/java/modelEnum.mustache | 2 +- templates/java/modelInnerEnum.mustache | 2 +- templates/java/pojo.mustache | 4 +- templates/javascript/api-single.mustache | 34 +- templates/javascript/model.mustache | 4 +- .../clients/recommend/getRecommendations.json | 126 +- tests/CTS/clients/search/addApiKey.json | 12 +- .../search/batchDictionaryEntries.json | 86 +- tests/CTS/clients/search/batchRules.json | 71 +- tests/CTS/clients/search/browse.json | 10 +- .../CTS/clients/search/clearAllSynonyms.json | 2 +- tests/CTS/clients/search/clearRules.json | 3 +- tests/CTS/clients/search/deleteApiKey.json | 2 +- tests/CTS/clients/search/deleteRule.json | 3 +- tests/CTS/clients/search/deleteSynonym.json | 2 +- tests/CTS/clients/search/getApiKey.json | 2 +- tests/CTS/clients/search/getRule.json | 3 +- tests/CTS/clients/search/getSynonym.json | 2 +- tests/CTS/clients/search/restoreApiKey.json | 2 +- tests/CTS/clients/search/saveRule.json | 35 +- tests/CTS/clients/search/saveSynonym.json | 14 +- tests/CTS/clients/search/saveSynonyms.json | 34 +- tests/CTS/clients/search/search.json | 8 +- .../search/searchDictionaryEntries.json | 18 +- .../clients/search/searchForFacetValues.json | 14 +- tests/CTS/clients/search/searchRules.json | 10 +- tests/CTS/clients/search/searchSynonyms.json | 8 +- .../clients/search/setDictionarySettings.json | 36 +- tests/CTS/clients/search/updateApiKey.json | 12 +- tests/output/javascript/recommend.test.ts | 126 +- tests/output/javascript/search.test.ts | 247 +- 64 files changed, 5348 insertions(+), 1682 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddOrUpdateObjectResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearObjectsResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteByResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteObjectResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/PartialUpdateObjectResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java rename clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/{SearchParamsAsString.java => SearchParamsString.java} (81%) delete mode 100644 clients/algoliasearch-client-javascript/client-search/model/addOrUpdateObjectResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/client-search/model/partialUpdateObjectResponse.ts create mode 100644 clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts rename clients/algoliasearch-client-javascript/client-search/model/{searchParamsAsString.ts => searchParamsString.ts} (69%) diff --git a/.eslintrc.js b/.eslintrc.js index 3c2e9e3c98..728902eaae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -66,8 +66,6 @@ module.exports = { // there's a conflict when declaring `type` and `namespaces`, even with `ignoreDeclarationMerge` 'no-redeclare': 0, '@typescript-eslint/no-redeclare': 0, - // Some endpoints have A LOT of parameters - 'max-params': 0, '@typescript-eslint/no-unused-vars': 2, 'unused-imports/no-unused-imports-ts': 2, diff --git a/README.md b/README.md index fdb4fc5d12..4ce34f43ed 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ yarn docker playground:java:search # Troubleshooting -> `Error: The operation couldn’t be completed. Unable to locate a Java Runtime.` +> `Error: The operation couldn't be completed. Unable to locate a Java Runtime.` Java is not located in your PATH, either source the right `.bash_profile`, `.zshrc`, etc. file or do the following command in this repository: diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddOrUpdateObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddOrUpdateObjectResponse.java deleted file mode 100644 index 8545d4db16..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AddOrUpdateObjectResponse.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** AddOrUpdateObjectResponse */ -public class AddOrUpdateObjectResponse { - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) - private Integer taskID; - - public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; - - @SerializedName(SERIALIZED_NAME_OBJECT_I_D) - private String objectID; - - public AddOrUpdateObjectResponse updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public AddOrUpdateObjectResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the indexing task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public AddOrUpdateObjectResponse objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Unique identifier of the object.") - 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; - } - AddOrUpdateObjectResponse addOrUpdateObjectResponse = (AddOrUpdateObjectResponse) o; - return ( - Objects.equals(this.updatedAt, addOrUpdateObjectResponse.updatedAt) && - Objects.equals(this.taskID, addOrUpdateObjectResponse.taskID) && - Objects.equals(this.objectID, addOrUpdateObjectResponse.objectID) - ); - } - - @Override - public int hashCode() { - return Objects.hash(updatedAt, taskID, objectID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddOrUpdateObjectResponse {\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .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/ClearObjectsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearObjectsResponse.java deleted file mode 100644 index 53ea48360e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearObjectsResponse.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** ClearObjectsResponse */ -public class ClearObjectsResponse { - - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) - private Integer taskID; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public ClearObjectsResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the indexing task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public ClearObjectsResponse updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ClearObjectsResponse clearObjectsResponse = (ClearObjectsResponse) o; - return ( - Objects.equals(this.taskID, clearObjectsResponse.taskID) && - Objects.equals(this.updatedAt, clearObjectsResponse.updatedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ClearObjectsResponse {\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/DeleteByResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteByResponse.java deleted file mode 100644 index 3904b3c11e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteByResponse.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** DeleteByResponse */ -public class DeleteByResponse { - - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) - private Integer taskID; - - public static final String SERIALIZED_NAME_DELETED_AT = "deletedAt"; - - @SerializedName(SERIALIZED_NAME_DELETED_AT) - private OffsetDateTime deletedAt; - - public DeleteByResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the indexing task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public DeleteByResponse deletedAt(OffsetDateTime deletedAt) { - this.deletedAt = deletedAt; - return this; - } - - /** - * Date of deletion (ISO-8601 format). - * - * @return deletedAt - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") - public OffsetDateTime getDeletedAt() { - return deletedAt; - } - - public void setDeletedAt(OffsetDateTime deletedAt) { - this.deletedAt = deletedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeleteByResponse deleteByResponse = (DeleteByResponse) o; - return ( - Objects.equals(this.taskID, deleteByResponse.taskID) && - Objects.equals(this.deletedAt, deleteByResponse.deletedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, deletedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteByResponse {\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/DeleteObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteObjectResponse.java deleted file mode 100644 index 1657474041..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteObjectResponse.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** DeleteObjectResponse */ -public class DeleteObjectResponse { - - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) - private Integer taskID; - - public static final String SERIALIZED_NAME_DELETED_AT = "deletedAt"; - - @SerializedName(SERIALIZED_NAME_DELETED_AT) - private OffsetDateTime deletedAt; - - public DeleteObjectResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the indexing task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public DeleteObjectResponse deletedAt(OffsetDateTime deletedAt) { - this.deletedAt = deletedAt; - return this; - } - - /** - * Date of deletion (ISO-8601 format). - * - * @return deletedAt - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") - public OffsetDateTime getDeletedAt() { - return deletedAt; - } - - public void setDeletedAt(OffsetDateTime deletedAt) { - this.deletedAt = deletedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeleteObjectResponse deleteObjectResponse = (DeleteObjectResponse) o; - return ( - Objects.equals(this.taskID, deleteObjectResponse.taskID) && - Objects.equals(this.deletedAt, deleteObjectResponse.deletedAt) - ); - } - - @Override - public int hashCode() { - return Objects.hash(taskID, deletedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteObjectResponse {\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/PartialUpdateObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/PartialUpdateObjectResponse.java deleted file mode 100644 index 6ec671663a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/PartialUpdateObjectResponse.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** PartialUpdateObjectResponse */ -public class PartialUpdateObjectResponse { - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) - private Integer taskID; - - public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; - - @SerializedName(SERIALIZED_NAME_OBJECT_I_D) - private String objectID; - - public PartialUpdateObjectResponse updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * Date of last update (ISO-8601 format). - * - * @return updatedAt - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public PartialUpdateObjectResponse taskID(Integer taskID) { - this.taskID = taskID; - return this; - } - - /** - * taskID of the indexing task to wait for. - * - * @return taskID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { - return taskID; - } - - public void setTaskID(Integer taskID) { - this.taskID = taskID; - } - - public PartialUpdateObjectResponse objectID(String objectID) { - this.objectID = objectID; - return this; - } - - /** - * Unique identifier of the object. - * - * @return objectID - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "Unique identifier of the object.") - 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; - } - PartialUpdateObjectResponse partialUpdateObjectResponse = (PartialUpdateObjectResponse) o; - return ( - Objects.equals(this.updatedAt, partialUpdateObjectResponse.updatedAt) && - Objects.equals(this.taskID, partialUpdateObjectResponse.taskID) && - Objects.equals(this.objectID, partialUpdateObjectResponse.objectID) - ); - } - - @Override - public int hashCode() { - return Objects.hash(updatedAt, taskID, objectID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PartialUpdateObjectResponse {\n"); - sb - .append(" updatedAt: ") - .append(toIndentedString(updatedAt)) - .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/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index 29b8d018fb..47de49da17 100644 --- 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 @@ -17,6 +17,11 @@ /** SearchParams */ public class SearchParams { + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + private String params = ""; + public static final String SERIALIZED_NAME_QUERY = "query"; @SerializedName(SERIALIZED_NAME_QUERY) @@ -764,6 +769,26 @@ public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) 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 + @ApiModelProperty(value = "Search parameters as URL-encoded query string.") + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + public SearchParams query(String query) { this.query = query; return this; @@ -2746,6 +2771,7 @@ public boolean equals(Object o) { } SearchParams searchParams = (SearchParams) o; return ( + Objects.equals(this.params, searchParams.params) && Objects.equals(this.query, searchParams.query) && Objects.equals(this.similarQuery, searchParams.similarQuery) && Objects.equals(this.filters, searchParams.filters) && @@ -2929,6 +2955,7 @@ private static boolean equalsNullable( @Override public int hashCode() { return Objects.hash( + params, query, similarQuery, filters, @@ -3020,6 +3047,7 @@ private static int hashCodeNullable(JsonNullable a) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchParams {\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" similarQuery: ") 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 new file mode 100644 index 0000000000..603d3faa5c --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java @@ -0,0 +1,3374 @@ +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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** SearchParamsObject */ +public class SearchParamsObject { + + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query = ""; + + public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) + private String similarQuery = ""; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + + @SerializedName(SERIALIZED_NAME_FILTERS) + private String filters = ""; + + public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) + private List facetFilters = null; + + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = + "optionalFilters"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) + private List optionalFilters = null; + + public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) + private List numericFilters = null; + + public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) + private List tagFilters = null; + + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = + "sumOrFiltersScores"; + + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) + private Boolean sumOrFiltersScores = false; + + public static final String SERIALIZED_NAME_FACETS = "facets"; + + @SerializedName(SERIALIZED_NAME_FACETS) + private List facets = null; + + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = + "maxValuesPerFacet"; + + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) + private Integer maxValuesPerFacet = 100; + + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = + "facetingAfterDistinct"; + + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) + private Boolean facetingAfterDistinct = false; + + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = + "sortFacetValuesBy"; + + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) + private String sortFacetValuesBy = "count"; + + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) + private Integer page = 0; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + + @SerializedName(SERIALIZED_NAME_OFFSET) + private Integer offset; + + public static final String SERIALIZED_NAME_LENGTH = "length"; + + @SerializedName(SERIALIZED_NAME_LENGTH) + private Integer length; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + private String aroundLatLng = ""; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = + "aroundLatLngViaIP"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) + private Boolean aroundLatLngViaIP = false; + + public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) + private OneOfintegerstring aroundRadius; + + public static final String SERIALIZED_NAME_AROUND_PRECISION = + "aroundPrecision"; + + @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) + private Integer aroundPrecision = 10; + + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = + "minimumAroundRadius"; + + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) + private Integer minimumAroundRadius; + + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = + "insideBoundingBox"; + + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) + private List insideBoundingBox = null; + + public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) + private List insidePolygon = null; + + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = + "naturalLanguages"; + + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) + private List naturalLanguages = null; + + public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) + private List ruleContexts = null; + + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = + "personalizationImpact"; + + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) + private Integer personalizationImpact = 100; + + public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + + @SerializedName(SERIALIZED_NAME_USER_TOKEN) + private String userToken; + + public static final String SERIALIZED_NAME_GET_RANKING_INFO = + "getRankingInfo"; + + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) + private Boolean getRankingInfo = false; + + public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) + private Boolean clickAnalytics = false; + + public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + + @SerializedName(SERIALIZED_NAME_ANALYTICS) + private Boolean analytics = true; + + public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) + private List analyticsTags = null; + + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = + "percentileComputation"; + + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) + private Boolean percentileComputation = true; + + public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) + private Boolean enableABTest = true; + + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = + "enableReRanking"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) + private Boolean enableReRanking = true; + + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + "searchableAttributes"; + + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) + private List searchableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + "attributesForFaceting"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) + private List attributesForFaceting = null; + + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + "unretrievableAttributes"; + + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) + private List unretrievableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + "attributesToRetrieve"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) + private List attributesToRetrieve = null; + + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + "restrictSearchableAttributes"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) + private List restrictSearchableAttributes = null; + + public static final String SERIALIZED_NAME_RANKING = "ranking"; + + @SerializedName(SERIALIZED_NAME_RANKING) + private List ranking = null; + + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + private List customRanking = null; + + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + "relevancyStrictness"; + + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) + private Integer relevancyStrictness = 100; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + "attributesToHighlight"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) + private List attributesToHighlight = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + "attributesToSnippet"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) + private List attributesToSnippet = null; + + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + "highlightPreTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) + private String highlightPreTag = ""; + + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + "highlightPostTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) + private String highlightPostTag = ""; + + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + "snippetEllipsisText"; + + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) + private String snippetEllipsisText = "…"; + + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + "restrictHighlightAndSnippetArrays"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + private Boolean restrictHighlightAndSnippetArrays = false; + + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + private Integer hitsPerPage = 20; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + "minWordSizefor1Typo"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) + private Integer minWordSizefor1Typo = 4; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + "minWordSizefor2Typos"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) + 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); + } + } + } + + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; + + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + "allowTyposOnNumericTokens"; + + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + private Boolean allowTyposOnNumericTokens = true; + + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + "disableTypoToleranceOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + private List disableTypoToleranceOnAttributes = null; + + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + "separatorsToIndex"; + + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) + private String separatorsToIndex = ""; + + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + private String ignorePlurals = "false"; + + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + "removeStopWords"; + + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) + private String removeStopWords = "false"; + + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + "keepDiacriticsOnCharacters"; + + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) + private String keepDiacriticsOnCharacters = ""; + + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + private List queryLanguages = null; + + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + private Boolean decompoundQuery = true; + + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + private Boolean enableRules = true; + + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + "enablePersonalization"; + + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) + 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); + } + } + } + + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + 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); + } + } + } + + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + "removeWordsIfNoResults"; + + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = + RemoveWordsIfNoResultsEnum.NONE; + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + private Boolean advancedSyntax = false; + + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + private List optionalWords = null; + + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + "disableExactOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) + 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); + } + } + } + + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + "exactOnSingleWordQuery"; + + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) + 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); + } + } + } + + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + "alternativesAsExact"; + + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) + 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); + } + } + } + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + "advancedSyntaxFeatures"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) + private List advancedSyntaxFeatures = null; + + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + + @SerializedName(SERIALIZED_NAME_DISTINCT) + private Integer distinct = 0; + + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + + @SerializedName(SERIALIZED_NAME_SYNONYMS) + private Boolean synonyms = true; + + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + "replaceSynonymsInHighlight"; + + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) + private Boolean replaceSynonymsInHighlight = false; + + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + private Integer minProximity = 1; + + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + private List responseFields = null; + + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + private Integer maxFacetHits = 10; + + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + "attributeCriteriaComputedByMinProximity"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + private Boolean attributeCriteriaComputedByMinProximity = false; + + public static final String SERIALIZED_NAME_RENDERING_CONTENT = + "renderingContent"; + + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) + private Object renderingContent = new Object(); + + public SearchParamsObject query(String query) { + this.query = query; + return this; + } + + /** + * The text to search in the index. + * + * @return query + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The text to search in the index.") + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + 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 + @ApiModelProperty( + value = "Overrides the query parameter and performs a more generic search that can be used to" + + " find \"similar\" results." + ) + 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 + @ApiModelProperty( + value = "Filter the query with numeric, facet and/or tag filters." + ) + 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 + @ApiModelProperty(value = "Filter hits by facet value.") + 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 + @ApiModelProperty( + value = "Create filters for ranking purposes, where records that match the filter are ranked" + + " higher, or lower in the case of a negative optional filter." + ) + 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 + @ApiModelProperty(value = "Filter on numeric attributes.") + 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 + @ApiModelProperty(value = "Filter hits by tags.") + 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 + @ApiModelProperty( + value = "Determines how to calculate the total score for filtering." + ) + 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 + @ApiModelProperty(value = "Retrieve facets and their facet values.") + 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 + @ApiModelProperty( + value = "Maximum number of facet values to return for each facet during a regular search." + ) + 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 + @ApiModelProperty( + value = "Force faceting to be applied after de-duplication (via the Distinct setting)." + ) + 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 + @ApiModelProperty(value = "Controls how facet values are fetched.") + 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 + @ApiModelProperty(value = "Specify the page to retrieve.") + 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 + @ApiModelProperty(value = "Specify the offset of the first hit to return.") + 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 + @ApiModelProperty( + value = "Set the number of hits to retrieve (used only with offset)." + ) + 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 + @ApiModelProperty( + value = "Search for entries around a central geolocation, enabling a geo search within a circular" + + " area." + ) + 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 + @ApiModelProperty( + value = "Search for entries around a given location automatically computed from the requester's" + + " IP address." + ) + 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 + @ApiModelProperty( + value = "Define the maximum radius for a geo search (in meters)." + ) + 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 + @ApiModelProperty( + value = "Precision of geo search (in meters), to add grouping by geo location to the ranking" + + " formula." + ) + 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 + @ApiModelProperty( + value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." + ) + 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 + @ApiModelProperty( + value = "Search inside a rectangular area (in geo coordinates)." + ) + 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 + @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") + 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 + @ApiModelProperty( + value = "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." + ) + 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 + @ApiModelProperty(value = "Enables contextual rules.") + 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 + @ApiModelProperty(value = "Define the impact of the Personalization feature.") + 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 + @ApiModelProperty( + value = "Associates a certain user token with the current search." + ) + 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 + @ApiModelProperty(value = "Retrieve detailed ranking information.") + 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 + @ApiModelProperty(value = "Enable the Click Analytics feature.") + 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 + @ApiModelProperty( + value = "Whether the current query will be taken into account in the Analytics." + ) + 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 + @ApiModelProperty( + value = "List of tags to apply to the query for analytics purposes." + ) + 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 + @ApiModelProperty( + value = "Whether to include or exclude a query from the processing-time percentile computation." + ) + 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 + @ApiModelProperty( + value = "Whether this search should participate in running AB tests." + ) + 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 + @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") + public Boolean getEnableReRanking() { + return enableReRanking; + } + + public void setEnableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + } + + 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 + @ApiModelProperty( + value = "The complete list of attributes used for searching." + ) + 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 + @ApiModelProperty( + value = "The complete list of attributes that will be used for faceting." + ) + 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 + @ApiModelProperty( + value = "List of attributes that can't be retrieved at query time." + ) + 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 + @ApiModelProperty( + value = "This parameter controls which attributes to retrieve and which not to retrieve." + ) + 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 + @ApiModelProperty( + value = "Restricts a given query to look in only a subset of your searchable attributes." + ) + 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 + @ApiModelProperty(value = "Controls how Algolia should sort your results.") + 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 + @ApiModelProperty(value = "Specifies the custom ranking criterion.") + 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 + @ApiModelProperty( + value = "Controls the relevancy threshold below which less relevant results aren't included in" + + " the results." + ) + 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 + @ApiModelProperty(value = "List of attributes to highlight.") + 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 + @ApiModelProperty( + value = "List of attributes to snippet, with an optional maximum number of words to snippet." + ) + 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 + @ApiModelProperty( + value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + + " results." + ) + 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 + @ApiModelProperty( + value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + + " results." + ) + 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 + @ApiModelProperty( + value = "String used as an ellipsis indicator when a snippet is truncated." + ) + 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 + @ApiModelProperty( + value = "Restrict highlighting and snippeting to items that matched the query." + ) + 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 + @ApiModelProperty(value = "Set the number of hits per page.") + 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 + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 1 typo." + ) + 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 + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 2 typos." + ) + 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 + @ApiModelProperty( + value = "Controls whether typo tolerance is enabled and how it is applied." + ) + 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 + @ApiModelProperty( + value = "Whether to allow typos on numbers (\"numeric tokens\") in the query string." + ) + 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 + @ApiModelProperty( + value = "List of attributes on which you want to disable typo tolerance." + ) + 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 + @ApiModelProperty(value = "Control which separators are indexed.") + 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 + @ApiModelProperty( + value = "Treats singular, plurals, and other forms of declensions as matching terms." + ) + 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 + @ApiModelProperty( + value = "Removes stop (common) words from the query before executing it." + ) + 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 + @ApiModelProperty( + value = "List of characters that the engine shouldn't automatically normalize." + ) + 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 + @ApiModelProperty( + value = "Sets the languages to be used by language-specific settings and functionalities such as" + + " ignorePlurals, removeStopWords, and CJK word-detection." + ) + 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 + @ApiModelProperty( + value = "Splits compound words into their composing atoms in the query." + ) + 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 + @ApiModelProperty(value = "Whether Rules should be globally enabled.") + 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 + @ApiModelProperty(value = "Enable the Personalization feature.") + 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 + @ApiModelProperty( + value = "Controls if and how query words are interpreted as prefixes." + ) + 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 + @ApiModelProperty( + value = "Selects a strategy to remove words from the query when it doesn't match any hits." + ) + 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 + @ApiModelProperty(value = "Enables the advanced query syntax.") + 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 + @ApiModelProperty( + value = "A list of words that should be considered as optional when found in the query." + ) + 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 + @ApiModelProperty( + value = "List of attributes on which you want to disable the exact ranking criterion." + ) + 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 + @ApiModelProperty( + value = "Controls how the exact ranking criterion is computed when the query contains only one" + + " word." + ) + 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 + @ApiModelProperty( + value = "List of alternatives that should be considered an exact match by the exact ranking" + + " criterion." + ) + 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 + @ApiModelProperty( + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is" + + " enabled." + ) + 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 + @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + 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 + @ApiModelProperty( + value = "Whether to take into account an index's synonyms for a particular search." + ) + 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 + @ApiModelProperty( + value = "Whether to highlight and snippet the original word that matches the synonym or the" + + " synonym itself." + ) + 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 + @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + 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 + @ApiModelProperty( + value = "Choose which fields to return in the API response. This parameters applies to search and" + + " browse queries." + ) + 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 + @ApiModelProperty( + value = "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." + ) + 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 + @ApiModelProperty( + value = "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." + ) + 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 + @ApiModelProperty( + value = "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." + ) + 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.query, searchParamsObject.query) && + 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.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) + ); + } + + private static boolean equalsNullable( + JsonNullable a, + JsonNullable b + ) { + return ( + a == b || + ( + a != null && + b != null && + a.isPresent() && + b.isPresent() && + Objects.deepEquals(a.get(), b.get()) + ) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + query, + 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 + ); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] { a.get() }) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchParamsObject {\n"); + sb.append(" query: ").append(toIndentedString(query)).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/SearchParamsAsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java similarity index 81% rename from clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java index dae824c783..9d785b1c54 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsString.java @@ -4,15 +4,15 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Objects; -/** SearchParamsAsString */ -public class SearchParamsAsString { +/** SearchParamsString */ +public class SearchParamsString { public static final String SERIALIZED_NAME_PARAMS = "params"; @SerializedName(SERIALIZED_NAME_PARAMS) private String params = ""; - public SearchParamsAsString params(String params) { + public SearchParamsString params(String params) { this.params = params; return this; } @@ -40,8 +40,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SearchParamsAsString searchParamsAsString = (SearchParamsAsString) o; - return Objects.equals(this.params, searchParamsAsString.params); + SearchParamsString searchParamsString = (SearchParamsString) o; + return Objects.equals(this.params, searchParamsString.params); } @Override @@ -52,7 +52,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class SearchParamsAsString {\n"); + sb.append("class SearchParamsString {\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); sb.append("}"); return sb.toString(); 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 index 89f5510212..05a26a42ca 100644 --- 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 @@ -1649,11 +1649,11 @@ private okhttp3.Call browseValidateBeforeCall( /** * Retrieve all index content. 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. + * 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) @@ -1682,11 +1682,11 @@ public BrowseResponse browse(String indexName, BrowseRequest browseRequest) /** * Retrieve all index content. 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. + * 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) @@ -1719,12 +1719,11 @@ public ApiResponse browseWithHttpInfo( /** * Retrieve all index content. (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. + * 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) @@ -2025,7 +2024,7 @@ private okhttp3.Call clearObjectsValidateBeforeCall( } /** - * clear all objects from an index. Delete an index’s content, but leave settings and + * clear all objects from an index. 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) @@ -2050,7 +2049,7 @@ public UpdatedAtResponse clearObjects(String indexName) throws ApiException { } /** - * clear all objects from an index. Delete an index’s content, but leave settings and + * clear all objects from an index. 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) @@ -2076,7 +2075,7 @@ public ApiResponse clearObjectsWithHttpInfo( } /** - * clear all objects from an index. (asynchronously) Delete an index’s content, but leave settings + * clear all objects from an index. (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) @@ -2544,7 +2543,7 @@ private okhttp3.Call deleteByValidateBeforeCall( /** * Delete all records matching the query. 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. + * 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) @@ -2575,7 +2574,7 @@ public DeletedAtResponse deleteBy( /** * Delete all records matching the query. 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. + * 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) @@ -2608,7 +2607,7 @@ public ApiResponse deleteByWithHttpInfo( /** * Delete all records matching the query. (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. + * (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) @@ -5785,11 +5784,11 @@ private okhttp3.Call hasPendingMappingsValidateBeforeCall( } /** - * Has pending mappings 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. + * Has pending mappings 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 (optional) * @return CreatedAtResponse @@ -5814,11 +5813,11 @@ public CreatedAtResponse hasPendingMappings(Boolean getClusters) } /** - * Has pending mappings 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. + * Has pending mappings 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 (optional) * @return ApiResponse<CreatedAtResponse> @@ -5846,9 +5845,9 @@ public ApiResponse hasPendingMappingsWithHttpInfo( } /** - * Has pending mappings (asynchronously) Get the status of your clusters' migrations or user + * Has pending mappings (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 + * 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. * @@ -7130,7 +7129,7 @@ private okhttp3.Call partialUpdateObjectValidateBeforeCall( * Partially update an object. 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. + * 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) @@ -7169,7 +7168,7 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( * Partially update an object. 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. + * 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) @@ -7211,7 +7210,7 @@ public ApiResponse partialUpdateObjectWithHttpInf * Partially update an object. (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 + * 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) @@ -9685,11 +9684,11 @@ private okhttp3.Call searchUserIdsValidateBeforeCall( /** * Search userID 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. + * 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 searchUserIdsObject (required) * @return SearchUserIdsResponse @@ -9717,11 +9716,11 @@ public SearchUserIdsResponse searchUserIds( /** * Search userID 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. + * 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 searchUserIdsObject (required) * @return ApiResponse<SearchUserIdsResponse> @@ -9752,7 +9751,7 @@ public ApiResponse searchUserIdsWithHttpInfo( /** * Search userID (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 + * 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 diff --git a/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts b/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts index 751d944917..ca5aa9a451 100644 --- a/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts +++ b/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts @@ -100,17 +100,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getAverageClickPosition - The getAverageClickPosition parameters. + * @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. */ - getAverageClickPosition( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getAverageClickPosition({ + index, + startDate, + endDate, + tags, + }: GetAverageClickPositionProps): Promise { const path = '/2/clicks/averageClickPosition'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -153,17 +154,18 @@ export class AnalyticsApi { * Returns the distribution of clicks per range of positions. * * @summary Returns the distribution of clicks per range of positions. - * @param index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getClickPositions - The getClickPositions parameters. + * @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. */ - getClickPositions( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getClickPositions({ + index, + startDate, + endDate, + tags, + }: GetClickPositionsProps): Promise { const path = '/2/clicks/positions'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -206,17 +208,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getClickThroughRate - The getClickThroughRate parameters. + * @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. */ - getClickThroughRate( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getClickThroughRate({ + index, + startDate, + endDate, + tags, + }: GetClickThroughRateProps): Promise { const path = '/2/clicks/clickThroughRate'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -259,17 +262,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getConversationRate - The getConversationRate parameters. + * @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. */ - getConversationRate( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getConversationRate({ + index, + startDate, + endDate, + tags, + }: GetConversationRateProps): Promise { const path = '/2/conversions/conversionRate'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -312,17 +316,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getNoClickRate - The getNoClickRate parameters. + * @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. */ - getNoClickRate( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getNoClickRate({ + index, + startDate, + endDate, + tags, + }: GetNoClickRateProps): Promise { const path = '/2/searches/noClickRate'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -365,17 +370,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getNoResultsRate - The getNoResultsRate parameters. + * @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. */ - getNoResultsRate( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getNoResultsRate({ + index, + startDate, + endDate, + tags, + }: GetNoResultsRateProps): Promise { const path = '/2/searches/noResultRate'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -418,17 +424,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getSearchesCount - The getSearchesCount parameters. + * @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. */ - getSearchesCount( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getSearchesCount({ + index, + startDate, + endDate, + tags, + }: GetSearchesCountProps): Promise { const path = '/2/searches/count'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -471,21 +478,22 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getSearchesNoClicks - The getSearchesNoClicks parameters. + * @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 - How many items to fetch. + * @param getSearchesNoClicks.offset - From which position to start retrieving results. + * @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. */ - getSearchesNoClicks( - index: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getSearchesNoClicks({ + index, + startDate, + endDate, + limit, + offset, + tags, + }: GetSearchesNoClicksProps): Promise { const path = '/2/searches/noClicks'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -536,21 +544,22 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getSearchesNoResults - The getSearchesNoResults parameters. + * @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 - How many items to fetch. + * @param getSearchesNoResults.offset - From which position to start retrieving results. + * @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. */ - getSearchesNoResults( - index: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getSearchesNoResults({ + index, + startDate, + endDate, + limit, + offset, + tags, + }: GetSearchesNoResultsProps): Promise { const path = '/2/searches/noResults'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -601,9 +610,10 @@ export class AnalyticsApi { * 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 index - The index name to target. + * @param getStatus - The getStatus parameters. + * @param getStatus.index - The index name to target. */ - getStatus(index: string): Promise { + getStatus({ index }: GetStatusProps): Promise { const path = '/2/status'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -634,21 +644,22 @@ export class AnalyticsApi { * Returns top countries. Limited to the 1000 most frequent ones. * * @summary Returns top countries. - * @param index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopCountries - The getTopCountries parameters. + * @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 - How many items to fetch. + * @param getTopCountries.offset - From which position to start retrieving results. + * @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. */ - getTopCountries( - index: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopCountries({ + index, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopCountriesProps): Promise { const path = '/2/countries'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -699,21 +710,22 @@ export class AnalyticsApi { * Returns top filter attributes. Limited to the 1000 most used filters. * * @summary Returns top filter attributes. - * @param index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopFilterAttributes - The getTopFilterAttributes parameters. + * @param getTopFilterAttributes.index - The index name to target. + * @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 - How many items to fetch. + * @param getTopFilterAttributes.offset - From which position to start retrieving results. + * @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. */ - getTopFilterAttributes( - index: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopFilterAttributes({ + index, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopFilterAttributesProps): Promise { const path = '/2/filters'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -764,23 +776,24 @@ export class AnalyticsApi { * Returns top filter attributes for a given search. Limited to the 1000 most used filters. * * @summary Returns top filter attributes for a given search. - * @param index - The index name to target. - * @param search - The query term. Must match the exact user input. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopFilterAttributesForSearch - The getTopFilterAttributesForSearch parameters. + * @param getTopFilterAttributesForSearch.index - The index name to target. + * @param getTopFilterAttributesForSearch.search - The query term. Must match the exact user input. + * @param getTopFilterAttributesForSearch.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopFilterAttributesForSearch.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopFilterAttributesForSearch.limit - How many items to fetch. + * @param getTopFilterAttributesForSearch.offset - From which position to start retrieving results. + * @param getTopFilterAttributesForSearch.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. */ - getTopFilterAttributesForSearch( - index: string, - search: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopFilterAttributesForSearch({ + index, + search, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopFilterAttributesForSearchProps): Promise { const path = '/2/filters?search={search}'.replace( '{search}', encodeURIComponent(String(search)) @@ -840,23 +853,24 @@ export class AnalyticsApi { * Returns top filters for the given attribute. Limited to the 1000 most used filters. * * @summary Returns top filters for the given attribute. - * @param attribute - The exact name of the attribute. - * @param index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopFilterForAttribute - The getTopFilterForAttribute parameters. + * @param getTopFilterForAttribute.attribute - The exact name of the attribute. + * @param getTopFilterForAttribute.index - The index name to target. + * @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 - How many items to fetch. + * @param getTopFilterForAttribute.offset - From which position to start retrieving results. + * @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. */ - getTopFilterForAttribute( - attribute: string, - index: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopFilterForAttribute({ + attribute, + index, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopFilterForAttributeProps): Promise { const path = '/2/filters/{attribute}'.replace( '{attribute}', encodeURIComponent(String(attribute)) @@ -916,25 +930,26 @@ export class AnalyticsApi { * Returns top filters for the given attributes and search. Several attributes can be given by separating them with a comma. Several attributes can be given by separating them with a comma. * * @summary Returns top filters for the given attributes and search. - * @param attributes - The exact names of the attributes, separated by commas. - * @param index - The index name to target. - * @param search - The query term. Must match the exact user input. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopFiltersForAttributesSearch - The getTopFiltersForAttributesSearch parameters. + * @param getTopFiltersForAttributesSearch.attributes - The exact names of the attributes, separated by commas. + * @param getTopFiltersForAttributesSearch.index - The index name to target. + * @param getTopFiltersForAttributesSearch.search - The query term. Must match the exact user input. + * @param getTopFiltersForAttributesSearch.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopFiltersForAttributesSearch.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopFiltersForAttributesSearch.limit - How many items to fetch. + * @param getTopFiltersForAttributesSearch.offset - From which position to start retrieving results. + * @param getTopFiltersForAttributesSearch.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. */ - getTopFiltersForAttributesSearch( - attributes: string, - index: string, - search: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopFiltersForAttributesSearch({ + attributes, + index, + search, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopFiltersForAttributesSearchProps): Promise { const path = '/2/filters/{attributes}?search={search}' .replace('{attributes}', encodeURIComponent(String(attributes))) .replace('{search}', encodeURIComponent(String(search))); @@ -999,21 +1014,22 @@ export class AnalyticsApi { * Returns top filters with no results. Limited to the 1000 most used filters. * * @summary Returns top filters with no results. - * @param index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopFiltersNoResults - The getTopFiltersNoResults parameters. + * @param getTopFiltersNoResults.index - The index name to target. + * @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 - How many items to fetch. + * @param getTopFiltersNoResults.offset - From which position to start retrieving results. + * @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. */ - getTopFiltersNoResults( - index: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopFiltersNoResults({ + index, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopFiltersNoResultsProps): Promise { const path = '/2/filters/noResults'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1064,23 +1080,24 @@ export class AnalyticsApi { * Returns top filters for the given no result search. Limited to the 1000 most used filters. * * @summary Returns top filters for the given no result search. - * @param index - The index name to target. - * @param search - The query term. Must match the exact user input. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopFiltersNoResultsForSearch - The getTopFiltersNoResultsForSearch parameters. + * @param getTopFiltersNoResultsForSearch.index - The index name to target. + * @param getTopFiltersNoResultsForSearch.search - The query term. Must match the exact user input. + * @param getTopFiltersNoResultsForSearch.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopFiltersNoResultsForSearch.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopFiltersNoResultsForSearch.limit - How many items to fetch. + * @param getTopFiltersNoResultsForSearch.offset - From which position to start retrieving results. + * @param getTopFiltersNoResultsForSearch.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. */ - getTopFiltersNoResultsForSearch( - index: string, - search: string, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopFiltersNoResultsForSearch({ + index, + search, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopFiltersNoResultsForSearchProps): Promise { const path = '/2/filters/noResults?search={search}'.replace( '{search}', encodeURIComponent(String(search)) @@ -1140,23 +1157,26 @@ export class AnalyticsApi { * Returns top hits. Limited to the 1000 most frequent ones. * * @summary Returns top hits. - * @param index - The index name to target. - * @param clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopHits - The getTopHits parameters. + * @param getTopHits.index - The index name to target. + * @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 - How many items to fetch. + * @param getTopHits.offset - From which position to start retrieving results. + * @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. */ - getTopHits( - index: string, - clickAnalytics?: boolean, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopHits({ + index, + clickAnalytics, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopHitsProps): Promise< + GetTopHitsResponse | GetTopHitsResponseWithAnalytics + > { const path = '/2/hits'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1211,25 +1231,28 @@ export class AnalyticsApi { * Returns top hits for the given search. Limited to the 1000 most frequent ones. * * @summary Returns top hits for the given search. - * @param index - The index name to target. - * @param search - The query term. Must match the exact user input. - * @param clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopHitsForSearch - The getTopHitsForSearch parameters. + * @param getTopHitsForSearch.index - The index name to target. + * @param getTopHitsForSearch.search - The query term. Must match the exact user input. + * @param getTopHitsForSearch.clickAnalytics - Whether to include the click-through and conversion rates for a search. + * @param getTopHitsForSearch.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopHitsForSearch.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. + * @param getTopHitsForSearch.limit - How many items to fetch. + * @param getTopHitsForSearch.offset - From which position to start retrieving results. + * @param getTopHitsForSearch.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. */ - getTopHitsForSearch( - index: string, - search: string, - clickAnalytics?: boolean, - startDate?: Date, - endDate?: Date, - limit?: number, - offset?: number, - tags?: string - ): Promise { + getTopHitsForSearch({ + index, + search, + clickAnalytics, + startDate, + endDate, + limit, + offset, + tags, + }: GetTopHitsForSearchProps): Promise< + GetTopHitsResponse | GetTopHitsResponseWithAnalytics + > { const path = '/2/hits?search={search}'.replace( '{search}', encodeURIComponent(String(search)) @@ -1293,27 +1316,30 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param clickAnalytics - Whether to include the click-through and conversion rates for a search. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param orderBy - Reorder the results. - * @param direction - The sorting of the result. - * @param limit - How many items to fetch. - * @param offset - From which position to start retrieving results. - * @param 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. + * @param getTopSearches - The getTopSearches parameters. + * @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 - How many items to fetch. + * @param getTopSearches.offset - From which position to start retrieving results. + * @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. */ - getTopSearches( - index: string, - clickAnalytics?: boolean, - startDate?: Date, - endDate?: Date, - orderBy?: Record, - direction?: Record, - limit?: number, - offset?: number, - tags?: string - ): Promise { + 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 = {}; @@ -1376,17 +1402,18 @@ export class AnalyticsApi { * 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 index - The index name to target. - * @param startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. - * @param 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. + * @param getUsersCount - The getUsersCount parameters. + * @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. */ - getUsersCount( - index: string, - startDate?: Date, - endDate?: Date, - tags?: string - ): Promise { + getUsersCount({ + index, + startDate, + endDate, + tags, + }: GetUsersCountProps): Promise { const path = '/2/users/count'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1426,3 +1453,182 @@ export class AnalyticsApi { return this.sendRequest(request, requestOptions); } } + +export type GetAverageClickPositionProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetClickPositionsProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetClickThroughRateProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetConversationRateProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetNoClickRateProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetNoResultsRateProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetSearchesCountProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; + +export type GetSearchesNoClicksProps = { + index: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetSearchesNoResultsProps = { + index: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetStatusProps = { + index: string; +}; + +export type GetTopCountriesProps = { + index: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopFilterAttributesProps = { + index: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopFilterAttributesForSearchProps = { + index: string; + search: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopFilterForAttributeProps = { + attribute: string; + index: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopFiltersForAttributesSearchProps = { + attributes: string; + index: string; + search: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopFiltersNoResultsProps = { + index: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopFiltersNoResultsForSearchProps = { + index: string; + search: string; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopHitsProps = { + index: string; + clickAnalytics?: boolean; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopHitsForSearchProps = { + index: string; + search: string; + clickAnalytics?: boolean; + startDate?: Date; + endDate?: Date; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetTopSearchesProps = { + index: string; + clickAnalytics?: boolean; + startDate?: Date; + endDate?: Date; + orderBy?: Record; + direction?: Record; + limit?: number; + offset?: number; + tags?: string; +}; + +export type GetUsersCountProps = { + index: string; + startDate?: Date; + endDate?: Date; + tags?: string; +}; diff --git a/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts b/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts index 8ecc4c7a9f..317d88901a 100644 --- a/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts +++ b/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts @@ -85,9 +85,12 @@ export class PersonalizationApi { * 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 userToken - UserToken representing the user for which to fetch the Personalization profile. + * @param deleteUserProfile - The deleteUserProfile parameters. + * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. */ - deleteUserProfile(userToken: string): Promise { + deleteUserProfile({ + userToken, + }: DeleteUserProfileProps): Promise { const path = '/1/profiles/{userToken}'.replace( '{userToken}', encodeURIComponent(String(userToken)) @@ -117,6 +120,7 @@ export class PersonalizationApi { * The strategy contains information on the events and facets that impact user profiles and personalized search results. * * @summary Get the current personalization strategy. + * @param getPersonalizationStrategy - The getPersonalizationStrategy parameters. */ getPersonalizationStrategy(): Promise { const path = '/1/strategies/personalization'; @@ -139,9 +143,12 @@ export class PersonalizationApi { * 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 userToken - UserToken representing the user for which to fetch the Personalization profile. + * @param getUserTokenProfile - The getUserTokenProfile parameters. + * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. */ - getUserTokenProfile(userToken: string): Promise { + getUserTokenProfile({ + userToken, + }: GetUserTokenProfileProps): Promise { const path = '/1/profiles/personalization/{userToken}'.replace( '{userToken}', encodeURIComponent(String(userToken)) @@ -171,11 +178,12 @@ export class PersonalizationApi { * A strategy defines the events and facets that impact user profiles and personalized search results. * * @summary Set a new personalization strategy. - * @param personalizationStrategyObject - The personalizationStrategyObject. + * @param setPersonalizationStrategy - The setPersonalizationStrategy parameters. + * @param setPersonalizationStrategy.personalizationStrategyObject - The personalizationStrategyObject. */ - setPersonalizationStrategy( - personalizationStrategyObject: PersonalizationStrategyObject - ): Promise { + setPersonalizationStrategy({ + personalizationStrategyObject, + }: SetPersonalizationStrategyProps): Promise { const path = '/1/strategies/personalization'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -189,6 +197,31 @@ export class PersonalizationApi { ); } + if ( + personalizationStrategyObject.eventScoring === null || + personalizationStrategyObject.eventScoring === undefined + ) { + throw new Error( + 'Required parameter personalizationStrategyObject.eventScoring was null or undefined when calling setPersonalizationStrategy.' + ); + } + if ( + personalizationStrategyObject.facetScoring === null || + personalizationStrategyObject.facetScoring === undefined + ) { + throw new Error( + 'Required parameter personalizationStrategyObject.facetScoring was null or undefined when calling setPersonalizationStrategy.' + ); + } + if ( + personalizationStrategyObject.personalizationImpact === null || + personalizationStrategyObject.personalizationImpact === undefined + ) { + throw new Error( + 'Required parameter personalizationStrategyObject.personalizationImpact was null or undefined when calling setPersonalizationStrategy.' + ); + } + const request: Request = { method: 'POST', path, @@ -203,3 +236,15 @@ export class PersonalizationApi { return this.sendRequest(request, requestOptions); } } + +export type DeleteUserProfileProps = { + userToken: string; +}; + +export type GetUserTokenProfileProps = { + userToken: string; +}; + +export type SetPersonalizationStrategyProps = { + personalizationStrategyObject: PersonalizationStrategyObject; +}; diff --git a/clients/algoliasearch-client-javascript/client-search/model/addOrUpdateObjectResponse.ts b/clients/algoliasearch-client-javascript/client-search/model/addOrUpdateObjectResponse.ts deleted file mode 100644 index 92b18daca0..0000000000 --- a/clients/algoliasearch-client-javascript/client-search/model/addOrUpdateObjectResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type AddOrUpdateObjectResponse = { - /** - * Date of last update (ISO-8601 format). - */ - updatedAt?: Date; - /** - * TaskID of the indexing task to wait for. - */ - taskID?: number; - /** - * Unique identifier of the object. - */ - objectID?: string; -}; diff --git a/clients/algoliasearch-client-javascript/client-search/model/models.ts b/clients/algoliasearch-client-javascript/client-search/model/models.ts index 07318f8a72..f16aa3e5f4 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/models.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/models.ts @@ -74,7 +74,8 @@ export * from './searchForFacetValuesResponse'; export * from './searchForFacetValuesResponseFacetHits'; export * from './searchHits'; export * from './searchParams'; -export * from './searchParamsAsString'; +export * from './searchParamsObject'; +export * from './searchParamsString'; export * from './searchResponse'; export * from './searchRulesParams'; export * from './searchRulesResponse'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/partialUpdateObjectResponse.ts b/clients/algoliasearch-client-javascript/client-search/model/partialUpdateObjectResponse.ts deleted file mode 100644 index 602e7483fd..0000000000 --- a/clients/algoliasearch-client-javascript/client-search/model/partialUpdateObjectResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type PartialUpdateObjectResponse = { - /** - * Date of last update (ISO-8601 format). - */ - updatedAt?: Date; - /** - * TaskID of the indexing task to wait for. - */ - taskID?: number; - /** - * Unique identifier of the object. - */ - objectID?: string; -}; diff --git a/clients/algoliasearch-client-javascript/client-search/model/searchParams.ts b/clients/algoliasearch-client-javascript/client-search/model/searchParams.ts index abd2558062..b1675283bb 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/searchParams.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/searchParams.ts @@ -1,4 +1,4 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; +import type { SearchParamsObject } from './searchParamsObject'; +import type { SearchParamsString } from './searchParamsString'; -export type SearchParams = BaseSearchParams & IndexSettingsAsSearchParams; +export type SearchParams = SearchParamsObject | SearchParamsString; diff --git a/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts b/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts new file mode 100644 index 0000000000..626a977f7b --- /dev/null +++ b/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts @@ -0,0 +1,4 @@ +import type { BaseSearchParams } from './baseSearchParams'; +import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; + +export type SearchParamsObject = BaseSearchParams & IndexSettingsAsSearchParams; diff --git a/clients/algoliasearch-client-javascript/client-search/model/searchParamsAsString.ts b/clients/algoliasearch-client-javascript/client-search/model/searchParamsString.ts similarity index 69% rename from clients/algoliasearch-client-javascript/client-search/model/searchParamsAsString.ts rename to clients/algoliasearch-client-javascript/client-search/model/searchParamsString.ts index ce49eec40e..3aff58347d 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/searchParamsAsString.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/searchParamsString.ts @@ -1,4 +1,4 @@ -export type SearchParamsAsString = { +export type SearchParamsString = { /** * Search parameters as URL-encoded query string. */ diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index 702ccc90af..c5b4947996 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -41,7 +41,6 @@ import type { SearchDictionaryEntries } from '../model/searchDictionaryEntries'; import type { SearchForFacetValuesRequest } from '../model/searchForFacetValuesRequest'; import type { SearchForFacetValuesResponse } from '../model/searchForFacetValuesResponse'; import type { SearchParams } from '../model/searchParams'; -import type { SearchParamsAsString } from '../model/searchParamsAsString'; import type { SearchResponse } from '../model/searchResponse'; import type { SearchRulesParams } from '../model/searchRulesParams'; import type { SearchRulesResponse } from '../model/searchRulesResponse'; @@ -154,9 +153,10 @@ export class SearchApi { * Add a new API Key with specific permissions/restrictions. * * @summary Create a new API key. - * @param apiKey - The apiKey. + * @param addApiKey - The addApiKey parameters. + * @param addApiKey.apiKey - The apiKey. */ - addApiKey(apiKey: ApiKey): Promise { + addApiKey({ apiKey }: AddApiKeyProps): Promise { const path = '/1/keys'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -167,6 +167,12 @@ export class SearchApi { ); } + if (apiKey.acl === null || apiKey.acl === undefined) { + throw new Error( + 'Required parameter apiKey.acl was null or undefined when calling addApiKey.' + ); + } + const request: Request = { method: 'POST', path, @@ -184,15 +190,16 @@ export class SearchApi { * 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 indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param requestBody - The Algolia object. + * @param addOrUpdateObject - The addOrUpdateObject parameters. + * @param addOrUpdateObject.indexName - The index in which to perform the request. + * @param addOrUpdateObject.objectID - Unique identifier of an object. + * @param addOrUpdateObject.requestBody - The Algolia object. */ - addOrUpdateObject( - indexName: string, - objectID: string, - requestBody: { [key: string]: Record } - ): Promise { + addOrUpdateObject({ + indexName, + objectID, + requestBody, + }: AddOrUpdateObjectProps): Promise { const path = '/1/indexes/{indexName}/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -233,9 +240,10 @@ export class SearchApi { /** * Add a single source to the list of allowed sources. * - * @param source - The source to add. + * @param appendSource - The appendSource parameters. + * @param appendSource.source - The source to add. */ - appendSource(source: Source): Promise { + appendSource({ source }: AppendSourceProps): Promise { const path = '/1/security/sources/append'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -263,13 +271,14 @@ export class SearchApi { * 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 xAlgoliaUserID - UserID to assign. - * @param assignUserIdObject - The assignUserIdObject. + * @param assignUserId - The assignUserId parameters. + * @param assignUserId.xAlgoliaUserID - UserID to assign. + * @param assignUserId.assignUserIdObject - The assignUserIdObject. */ - assignUserId( - xAlgoliaUserID: Record, - assignUserIdObject: AssignUserIdObject - ): Promise { + assignUserId({ + xAlgoliaUserID, + assignUserIdObject, + }: AssignUserIdProps): Promise { const path = '/1/clusters/mapping'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -286,6 +295,15 @@ export class SearchApi { ); } + if ( + assignUserIdObject.cluster === null || + assignUserIdObject.cluster === undefined + ) { + throw new Error( + 'Required parameter assignUserIdObject.cluster was null or undefined when calling assignUserId.' + ); + } + if (xAlgoliaUserID !== undefined) { queryParameters['X-Algolia-User-ID'] = xAlgoliaUserID.toString(); } @@ -306,13 +324,11 @@ export class SearchApi { /** * Performs multiple write operations in a single API call. * - * @param indexName - The index in which to perform the request. - * @param batchWriteObject - The batchWriteObject. + * @param batch - The batch parameters. + * @param batch.indexName - The index in which to perform the request. + * @param batch.batchWriteObject - The batchWriteObject. */ - batch( - indexName: string, - batchWriteObject: BatchWriteObject - ): Promise { + batch({ indexName, batchWriteObject }: BatchProps): Promise { const path = '/1/indexes/{indexName}/batch'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -349,13 +365,14 @@ export class SearchApi { * 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 xAlgoliaUserID - UserID to assign. - * @param batchAssignUserIdsObject - The batchAssignUserIdsObject. + * @param batchAssignUserIds - The batchAssignUserIds parameters. + * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign. + * @param batchAssignUserIds.batchAssignUserIdsObject - The batchAssignUserIdsObject. */ - batchAssignUserIds( - xAlgoliaUserID: Record, - batchAssignUserIdsObject: BatchAssignUserIdsObject - ): Promise { + batchAssignUserIds({ + xAlgoliaUserID, + batchAssignUserIdsObject, + }: BatchAssignUserIdsProps): Promise { const path = '/1/clusters/mapping/batch'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -375,6 +392,23 @@ export class SearchApi { ); } + if ( + batchAssignUserIdsObject.cluster === null || + batchAssignUserIdsObject.cluster === undefined + ) { + throw new Error( + 'Required parameter batchAssignUserIdsObject.cluster was null or undefined when calling batchAssignUserIds.' + ); + } + if ( + batchAssignUserIdsObject.users === null || + batchAssignUserIdsObject.users === undefined + ) { + throw new Error( + 'Required parameter batchAssignUserIdsObject.users was null or undefined when calling batchAssignUserIds.' + ); + } + if (xAlgoliaUserID !== undefined) { queryParameters['X-Algolia-User-ID'] = xAlgoliaUserID.toString(); } @@ -396,13 +430,14 @@ export class SearchApi { * Send a batch of dictionary entries. * * @summary Send a batch of dictionary entries. - * @param dictionaryName - The dictionary to search in. - * @param batchDictionaryEntries - The batchDictionaryEntries. + * @param batchDictionaryEntries - The batchDictionaryEntries parameters. + * @param batchDictionaryEntries.dictionaryName - The dictionary to search in. + * @param batchDictionaryEntries.batchDictionaryEntries - The batchDictionaryEntries. */ - batchDictionaryEntries( - dictionaryName: 'compounds' | 'plurals' | 'stopwords', - batchDictionaryEntries: BatchDictionaryEntries - ): Promise { + batchDictionaryEntries({ + dictionaryName, + batchDictionaryEntries, + }: BatchDictionaryEntriesProps): Promise { const path = '/1/dictionaries/{dictionaryName}/batch'.replace( '{dictionaryName}', encodeURIComponent(String(dictionaryName)) @@ -425,6 +460,15 @@ export class SearchApi { ); } + if ( + batchDictionaryEntries.requests === null || + batchDictionaryEntries.requests === undefined + ) { + throw new Error( + 'Required parameter batchDictionaryEntries.requests was null or undefined when calling batchDictionaryEntries.' + ); + } + const request: Request = { method: 'POST', path, @@ -442,17 +486,18 @@ export class SearchApi { * Create or update a batch of Rules. * * @summary Batch Rules. - * @param indexName - The index in which to perform the request. - * @param rule - The rule. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - * @param clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. + * @param batchRules - The batchRules parameters. + * @param batchRules.indexName - The index in which to perform the request. + * @param batchRules.rule - The rule. + * @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. */ - batchRules( - indexName: string, - rule: Rule[], - forwardToReplicas?: boolean, - clearExistingRules?: boolean - ): Promise { + batchRules({ + indexName, + rule, + forwardToReplicas, + clearExistingRules, + }: BatchRulesProps): Promise { const path = '/1/indexes/{indexName}/rules/batch'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -497,13 +542,11 @@ export class SearchApi { * 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 indexName - The index in which to perform the request. - * @param browseRequest - The browseRequest. + * @param browse - The browse parameters. + * @param browse.indexName - The index in which to perform the request. + * @param browse.browseRequest - The browseRequest. */ - browse( - indexName: string, - browseRequest?: BrowseRequest - ): Promise { + browse({ indexName, browseRequest }: BrowseProps): Promise { const path = '/1/indexes/{indexName}/browse'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -534,13 +577,14 @@ export class SearchApi { * Remove all synonyms from an index. * * @summary Clear all synonyms. - * @param indexName - The index in which to perform the request. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param clearAllSynonyms - The clearAllSynonyms parameters. + * @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. */ - clearAllSynonyms( - indexName: string, - forwardToReplicas?: boolean - ): Promise { + clearAllSynonyms({ + indexName, + forwardToReplicas, + }: ClearAllSynonymsProps): Promise { const path = '/1/indexes/{indexName}/synonyms/clear'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -571,12 +615,13 @@ export class SearchApi { return this.sendRequest(request, requestOptions); } /** - * Delete an index’s content, but leave settings and index-specific API keys untouched. + * Delete an index\'s content, but leave settings and index-specific API keys untouched. * * @summary Clear all objects from an index. - * @param indexName - The index in which to perform the request. + * @param clearObjects - The clearObjects parameters. + * @param clearObjects.indexName - The index in which to perform the request. */ - clearObjects(indexName: string): Promise { + clearObjects({ indexName }: ClearObjectsProps): Promise { const path = '/1/indexes/{indexName}/clear'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -606,13 +651,14 @@ export class SearchApi { * Delete all Rules in the index. * * @summary Clear Rules. - * @param indexName - The index in which to perform the request. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param clearRules - The clearRules parameters. + * @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. */ - clearRules( - indexName: string, - forwardToReplicas?: boolean - ): Promise { + clearRules({ + indexName, + forwardToReplicas, + }: ClearRulesProps): Promise { const path = '/1/indexes/{indexName}/rules/clear'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -646,9 +692,10 @@ export class SearchApi { * Delete an existing API Key. * * @summary Delete an API key. - * @param key - API Key string. + * @param deleteApiKey - The deleteApiKey parameters. + * @param deleteApiKey.key - API Key string. */ - deleteApiKey(key: string): Promise { + deleteApiKey({ key }: DeleteApiKeyProps): Promise { const path = '/1/keys/{key}'.replace( '{key}', encodeURIComponent(String(key)) @@ -675,16 +722,17 @@ export class SearchApi { return this.sendRequest(request, requestOptions); } /** - * 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. + * 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 indexName - The index in which to perform the request. - * @param searchParamsAsStringSearchParams - The searchParamsAsStringSearchParams. + * @param deleteBy - The deleteBy parameters. + * @param deleteBy.indexName - The index in which to perform the request. + * @param deleteBy.searchParams - The searchParams. */ - deleteBy( - indexName: string, - searchParamsAsStringSearchParams: SearchParams | SearchParamsAsString - ): Promise { + deleteBy({ + indexName, + searchParams, + }: DeleteByProps): Promise { const path = '/1/indexes/{indexName}/deleteByQuery'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -698,19 +746,16 @@ export class SearchApi { ); } - if ( - searchParamsAsStringSearchParams === null || - searchParamsAsStringSearchParams === undefined - ) { + if (searchParams === null || searchParams === undefined) { throw new Error( - 'Required parameter searchParamsAsStringSearchParams was null or undefined when calling deleteBy.' + 'Required parameter searchParams was null or undefined when calling deleteBy.' ); } const request: Request = { method: 'POST', path, - data: searchParamsAsStringSearchParams, + data: searchParams, }; const requestOptions: RequestOptions = { @@ -724,9 +769,10 @@ export class SearchApi { * Delete an existing index. * * @summary Delete index. - * @param indexName - The index in which to perform the request. + * @param deleteIndex - The deleteIndex parameters. + * @param deleteIndex.indexName - The index in which to perform the request. */ - deleteIndex(indexName: string): Promise { + deleteIndex({ indexName }: DeleteIndexProps): Promise { const path = '/1/indexes/{indexName}'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -756,13 +802,14 @@ export class SearchApi { * Delete an existing object. * * @summary Delete object. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. + * @param deleteObject - The deleteObject parameters. + * @param deleteObject.indexName - The index in which to perform the request. + * @param deleteObject.objectID - Unique identifier of an object. */ - deleteObject( - indexName: string, - objectID: string - ): Promise { + deleteObject({ + indexName, + objectID, + }: DeleteObjectProps): Promise { const path = '/1/indexes/{indexName}/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -797,15 +844,16 @@ export class SearchApi { * Delete the Rule with the specified objectID. * * @summary Delete a rule. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param deleteRule - The deleteRule parameters. + * @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. */ - deleteRule( - indexName: string, - objectID: string, - forwardToReplicas?: boolean - ): Promise { + deleteRule({ + indexName, + objectID, + forwardToReplicas, + }: DeleteRuleProps): Promise { const path = '/1/indexes/{indexName}/rules/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -843,9 +891,10 @@ export class SearchApi { /** * Remove a single source from the list of allowed sources. * - * @param source - The IP range of the source. + * @param deleteSource - The deleteSource parameters. + * @param deleteSource.source - The IP range of the source. */ - deleteSource(source: string): Promise { + deleteSource({ source }: DeleteSourceProps): Promise { const path = '/1/security/sources/{source}'.replace( '{source}', encodeURIComponent(String(source)) @@ -875,15 +924,16 @@ export class SearchApi { * Delete a single synonyms set, identified by the given objectID. * * @summary Delete synonym. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param deleteSynonym - The deleteSynonym parameters. + * @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. */ - deleteSynonym( - indexName: string, - objectID: string, - forwardToReplicas?: boolean - ): Promise { + deleteSynonym({ + indexName, + objectID, + forwardToReplicas, + }: DeleteSynonymProps): Promise { const path = '/1/indexes/{indexName}/synonyms/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -922,9 +972,10 @@ export class SearchApi { * Get the permissions of an API key. * * @summary Get an API key. - * @param key - API Key string. + * @param getApiKey - The getApiKey parameters. + * @param getApiKey.key - API Key string. */ - getApiKey(key: string): Promise { + getApiKey({ key }: GetApiKeyProps): Promise { const path = '/1/keys/{key}'.replace( '{key}', encodeURIComponent(String(key)) @@ -954,6 +1005,7 @@ export class SearchApi { * List dictionaries supported per language. * * @summary List dictionaries supported per language. + * @param getDictionaryLanguages - The getDictionaryLanguages parameters. */ getDictionaryLanguages(): Promise<{ [key: string]: Languages }> { const path = '/1/dictionaries/*/languages'; @@ -976,6 +1028,7 @@ export class SearchApi { * Retrieve dictionaries settings. * * @summary Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. + * @param getDictionarySettings - The getDictionarySettings parameters. */ getDictionarySettings(): Promise { const path = '/1/dictionaries/*/settings'; @@ -997,17 +1050,18 @@ export class SearchApi { /** * 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. - * @param length - Maximum number of entries to retrieve. The maximum allowed value is 1000. - * @param indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. - * @param type - Type of log entries to retrieve. When omitted, all log entries are retrieved. + * @param getLogs - The getLogs parameters. + * @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. */ - getLogs( - offset?: number, - length?: number, - indexName?: string, - type?: 'all' | 'build' | 'error' | 'query' - ): Promise { + getLogs({ + offset, + length, + indexName, + type, + }: GetLogsProps): Promise { const path = '/1/logs'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1044,15 +1098,16 @@ export class SearchApi { * Retrieve one object from the index. * * @summary Retrieve one object from the index. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param attributesToRetrieve - The attributesToRetrieve. + * @param getObject - The getObject parameters. + * @param getObject.indexName - The index in which to perform the request. + * @param getObject.objectID - Unique identifier of an object. + * @param getObject.attributesToRetrieve - The attributesToRetrieve. */ - getObject( - indexName: string, - objectID: string, - attributesToRetrieve?: string[] - ): Promise<{ [key: string]: string }> { + 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))); @@ -1091,9 +1146,12 @@ export class SearchApi { * Retrieve one or more objects, potentially from different indices, in a single API call. * * @summary Retrieve one or more objects. - * @param getObjectsObject - The getObjectsObject. + * @param getObjects - The getObjects parameters. + * @param getObjects.getObjectsObject - The getObjectsObject. */ - getObjects(getObjectsObject: GetObjectsObject): Promise { + getObjects({ + getObjectsObject, + }: GetObjectsProps): Promise { const path = '/1/indexes/*/objects'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1121,10 +1179,11 @@ export class SearchApi { * Retrieve the Rule with the specified objectID. * * @summary Get a rule. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. + * @param getRule - The getRule parameters. + * @param getRule.indexName - The index in which to perform the request. + * @param getRule.objectID - Unique identifier of an object. */ - getRule(indexName: string, objectID: string): Promise { + getRule({ indexName, objectID }: GetRuleProps): Promise { const path = '/1/indexes/{indexName}/rules/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -1158,9 +1217,10 @@ export class SearchApi { /** * Retrieve settings of a given indexName. * - * @param indexName - The index in which to perform the request. + * @param getSettings - The getSettings parameters. + * @param getSettings.indexName - The index in which to perform the request. */ - getSettings(indexName: string): Promise { + getSettings({ indexName }: GetSettingsProps): Promise { const path = '/1/indexes/{indexName}/settings'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -1188,6 +1248,8 @@ export class SearchApi { } /** * List all allowed sources. + * + * @param getSources - The getSources parameters. */ getSources(): Promise { const path = '/1/security/sources'; @@ -1210,10 +1272,11 @@ export class SearchApi { * Fetch a synonym object identified by its objectID. * * @summary Get synonym. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. + * @param getSynonym - The getSynonym parameters. + * @param getSynonym.indexName - The index in which to perform the request. + * @param getSynonym.objectID - Unique identifier of an object. */ - getSynonym(indexName: string, objectID: string): Promise { + getSynonym({ indexName, objectID }: GetSynonymProps): Promise { const path = '/1/indexes/{indexName}/synonyms/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -1247,10 +1310,11 @@ export class SearchApi { /** * Check the current status of a given task. * - * @param indexName - The index in which to perform the request. - * @param taskID - Unique identifier of an task. Numeric value (up to 64bits). + * @param getTask - The getTask parameters. + * @param getTask.indexName - The index in which to perform the request. + * @param getTask.taskID - Unique identifier of an task. Numeric value (up to 64bits). */ - getTask(indexName: string, taskID: number): Promise { + getTask({ indexName, taskID }: GetTaskProps): Promise { const path = '/1/indexes/{indexName}/task/{taskID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{taskID}', encodeURIComponent(String(taskID))); @@ -1285,6 +1349,7 @@ export class SearchApi { * 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. + * @param getTopUserIds - The getTopUserIds parameters. */ getTopUserIds(): Promise { const path = '/1/clusters/mapping/top'; @@ -1307,9 +1372,10 @@ export class SearchApi { * 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 userID - UserID to assign. + * @param getUserId - The getUserId parameters. + * @param getUserId.userID - UserID to assign. */ - getUserId(userID: Record): Promise { + getUserId({ userID }: GetUserIdProps): Promise { const path = '/1/clusters/mapping/{userID}'.replace( '{userID}', encodeURIComponent(String(userID)) @@ -1339,9 +1405,12 @@ export class SearchApi { * 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 getClusters - The getClusters. + * @param hasPendingMappings - The hasPendingMappings parameters. + * @param hasPendingMappings.getClusters - The getClusters. */ - hasPendingMappings(getClusters?: boolean): Promise { + hasPendingMappings({ + getClusters, + }: HasPendingMappingsProps): Promise { const path = '/1/clusters/mapping/pending'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1366,6 +1435,7 @@ export class SearchApi { * List API keys, along with their associated rights. * * @summary Get the full list of API Keys. + * @param listApiKeys - The listApiKeys parameters. */ listApiKeys(): Promise { const path = '/1/keys'; @@ -1388,6 +1458,7 @@ export class SearchApi { * 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. + * @param listClusters - The listClusters parameters. */ listClusters(): Promise { const path = '/1/clusters'; @@ -1410,9 +1481,10 @@ export class SearchApi { * List existing indexes from an application. * * @summary List existing indexes. - * @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). + * @param listIndices - The listIndices parameters. + * @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). */ - listIndices(page?: number): Promise { + listIndices({ page }: ListIndicesProps): Promise { const path = '/1/indexes'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1437,13 +1509,14 @@ export class SearchApi { * 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 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 hitsPerPage - Maximum number of objects to retrieve. + * @param listUserIds - The listUserIds parameters. + * @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. */ - listUserIds( - page?: number, - hitsPerPage?: number - ): Promise { + listUserIds({ + page, + hitsPerPage, + }: ListUserIdsProps): Promise { const path = '/1/clusters/mapping'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1471,9 +1544,12 @@ export class SearchApi { /** * Perform multiple write operations, potentially targeting multiple indices, in a single API call. * - * @param batchObject - The batchObject. + * @param multipleBatch - The multipleBatch parameters. + * @param multipleBatch.batchObject - The batchObject. */ - multipleBatch(batchObject: BatchObject): Promise { + multipleBatch({ + batchObject, + }: MultipleBatchProps): Promise { const path = '/1/indexes/*/batch'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1500,11 +1576,12 @@ export class SearchApi { /** * Get search results for the given requests. * - * @param multipleQueriesObject - The multipleQueriesObject. + * @param multipleQueries - The multipleQueries parameters. + * @param multipleQueries.multipleQueriesObject - The multipleQueriesObject. */ - multipleQueries( - multipleQueriesObject: MultipleQueriesObject - ): Promise { + multipleQueries({ + multipleQueriesObject, + }: MultipleQueriesProps): Promise { const path = '/1/indexes/*/queries'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1515,6 +1592,15 @@ export class SearchApi { ); } + if ( + multipleQueriesObject.requests === null || + multipleQueriesObject.requests === undefined + ) { + throw new Error( + 'Required parameter multipleQueriesObject.requests was null or undefined when calling multipleQueries.' + ); + } + const request: Request = { method: 'POST', path, @@ -1532,13 +1618,14 @@ export class SearchApi { * Peforms a copy or a move operation on a index. * * @summary Copy/move index. - * @param indexName - The index in which to perform the request. - * @param operationIndexObject - The operationIndexObject. + * @param operationIndex - The operationIndex parameters. + * @param operationIndex.indexName - The index in which to perform the request. + * @param operationIndex.operationIndexObject - The operationIndexObject. */ - operationIndex( - indexName: string, - operationIndexObject: OperationIndexObject - ): Promise { + operationIndex({ + indexName, + operationIndexObject, + }: OperationIndexProps): Promise { const path = '/1/indexes/{indexName}/operation'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -1558,6 +1645,23 @@ export class SearchApi { ); } + if ( + operationIndexObject.operation === null || + operationIndexObject.operation === undefined + ) { + throw new Error( + 'Required parameter operationIndexObject.operation was null or undefined when calling operationIndex.' + ); + } + if ( + operationIndexObject.destination === null || + operationIndexObject.destination === undefined + ) { + throw new Error( + 'Required parameter operationIndexObject.destination was null or undefined when calling operationIndex.' + ); + } + const request: Request = { method: 'POST', path, @@ -1572,20 +1676,21 @@ export class SearchApi { return this.sendRequest(request, requestOptions); } /** - * 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. + * 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 indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param stringBuildInOperation - The Algolia object. - * @param createIfNotExists - Creates the record if it does not exist yet. + * @param partialUpdateObject - The partialUpdateObject parameters. + * @param partialUpdateObject.indexName - The index in which to perform the request. + * @param partialUpdateObject.objectID - Unique identifier of an object. + * @param partialUpdateObject.stringBuildInOperation - The Algolia object. + * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet. */ - partialUpdateObject( - indexName: string, - objectID: string, - stringBuildInOperation: Array<{ [key: string]: BuildInOperation | string }>, - createIfNotExists?: boolean - ): Promise { + partialUpdateObject({ + indexName, + objectID, + stringBuildInOperation, + createIfNotExists, + }: PartialUpdateObjectProps): Promise { const path = '/1/indexes/{indexName}/{objectID}/partial' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -1634,9 +1739,10 @@ export class SearchApi { * 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 userID - UserID to assign. + * @param removeUserId - The removeUserId parameters. + * @param removeUserId.userID - UserID to assign. */ - removeUserId(userID: Record): Promise { + removeUserId({ userID }: RemoveUserIdProps): Promise { const path = '/1/clusters/mapping/{userID}'.replace( '{userID}', encodeURIComponent(String(userID)) @@ -1665,9 +1771,12 @@ export class SearchApi { /** * Replace all allowed sources. * - * @param source - The sources to allow. + * @param replaceSources - The replaceSources parameters. + * @param replaceSources.source - The sources to allow. */ - replaceSources(source: Source[]): Promise { + replaceSources({ + source, + }: ReplaceSourcesProps): Promise { const path = '/1/security/sources'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1695,9 +1804,10 @@ export class SearchApi { * Restore a deleted API key, along with its associated rights. * * @summary Restore an API key. - * @param key - API Key string. + * @param restoreApiKey - The restoreApiKey parameters. + * @param restoreApiKey.key - API Key string. */ - restoreApiKey(key: string): Promise { + restoreApiKey({ key }: RestoreApiKeyProps): Promise { const path = '/1/keys/{key}/restore'.replace( '{key}', encodeURIComponent(String(key)) @@ -1726,13 +1836,14 @@ export class SearchApi { /** * Add an object to the index, automatically assigning it an object ID. * - * @param indexName - The index in which to perform the request. - * @param requestBody - The Algolia object. + * @param saveObject - The saveObject parameters. + * @param saveObject.indexName - The index in which to perform the request. + * @param saveObject.requestBody - The Algolia object. */ - saveObject( - indexName: string, - requestBody: { [key: string]: Record } - ): Promise { + saveObject({ + indexName, + requestBody, + }: SaveObjectProps): Promise { const path = '/1/indexes/{indexName}'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -1769,17 +1880,18 @@ export class SearchApi { * Create or update the Rule with the specified objectID. * * @summary Save/Update a rule. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param rule - The rule. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param saveRule - The saveRule parameters. + * @param saveRule.indexName - The index in which to perform the request. + * @param saveRule.objectID - Unique identifier of an object. + * @param saveRule.rule - The rule. + * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ - saveRule( - indexName: string, - objectID: string, - rule: Rule, - forwardToReplicas?: boolean - ): Promise { + saveRule({ + indexName, + objectID, + rule, + forwardToReplicas, + }: SaveRuleProps): Promise { const path = '/1/indexes/{indexName}/rules/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -1804,6 +1916,17 @@ export class SearchApi { ); } + if (rule.objectID === null || rule.objectID === undefined) { + throw new Error( + 'Required parameter rule.objectID was null or undefined when calling saveRule.' + ); + } + if (rule.consequence === null || rule.consequence === undefined) { + throw new Error( + 'Required parameter rule.consequence was null or undefined when calling saveRule.' + ); + } + if (forwardToReplicas !== undefined) { queryParameters.forwardToReplicas = forwardToReplicas.toString(); } @@ -1825,17 +1948,18 @@ export class SearchApi { * Create a new synonym object or update the existing synonym object with the given object ID. * * @summary Save synonym. - * @param indexName - The index in which to perform the request. - * @param objectID - Unique identifier of an object. - * @param synonymHit - The synonymHit. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param saveSynonym - The saveSynonym parameters. + * @param saveSynonym.indexName - The index in which to perform the request. + * @param saveSynonym.objectID - Unique identifier of an object. + * @param saveSynonym.synonymHit - The synonymHit. + * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ - saveSynonym( - indexName: string, - objectID: string, - synonymHit: SynonymHit, - forwardToReplicas?: boolean - ): Promise { + saveSynonym({ + indexName, + objectID, + synonymHit, + forwardToReplicas, + }: SaveSynonymProps): Promise { const path = '/1/indexes/{indexName}/synonyms/{objectID}' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{objectID}', encodeURIComponent(String(objectID))); @@ -1860,6 +1984,17 @@ export class SearchApi { ); } + if (synonymHit.objectID === null || synonymHit.objectID === undefined) { + throw new Error( + 'Required parameter synonymHit.objectID was null or undefined when calling saveSynonym.' + ); + } + if (synonymHit.type === null || synonymHit.type === undefined) { + throw new Error( + 'Required parameter synonymHit.type was null or undefined when calling saveSynonym.' + ); + } + if (forwardToReplicas !== undefined) { queryParameters.forwardToReplicas = forwardToReplicas.toString(); } @@ -1881,17 +2016,18 @@ export class SearchApi { * 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 indexName - The index in which to perform the request. - * @param synonymHit - The synonymHit. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. - * @param replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request. + * @param saveSynonyms - The saveSynonyms parameters. + * @param saveSynonyms.indexName - The index in which to perform the request. + * @param saveSynonyms.synonymHit - The synonymHit. + * @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. */ - saveSynonyms( - indexName: string, - synonymHit: SynonymHit[], - forwardToReplicas?: boolean, - replaceExistingSynonyms?: boolean - ): Promise { + saveSynonyms({ + indexName, + synonymHit, + forwardToReplicas, + replaceExistingSynonyms, + }: SaveSynonymsProps): Promise { const path = '/1/indexes/{indexName}/synonyms/batch'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -1936,13 +2072,11 @@ export class SearchApi { /** * Get search results. * - * @param indexName - The index in which to perform the request. - * @param searchParamsAsStringSearchParams - The searchParamsAsStringSearchParams. + * @param search - The search parameters. + * @param search.indexName - The index in which to perform the request. + * @param search.searchParams - The searchParams. */ - search( - indexName: string, - searchParamsAsStringSearchParams: SearchParams | SearchParamsAsString - ): Promise { + search({ indexName, searchParams }: SearchProps): Promise { const path = '/1/indexes/{indexName}/query'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -1956,19 +2090,16 @@ export class SearchApi { ); } - if ( - searchParamsAsStringSearchParams === null || - searchParamsAsStringSearchParams === undefined - ) { + if (searchParams === null || searchParams === undefined) { throw new Error( - 'Required parameter searchParamsAsStringSearchParams was null or undefined when calling search.' + 'Required parameter searchParams was null or undefined when calling search.' ); } const request: Request = { method: 'POST', path, - data: searchParamsAsStringSearchParams, + data: searchParams, }; const requestOptions: RequestOptions = { @@ -1982,13 +2113,14 @@ export class SearchApi { * Search the dictionary entries. * * @summary Search the dictionary entries. - * @param dictionaryName - The dictionary to search in. - * @param searchDictionaryEntries - The searchDictionaryEntries. + * @param searchDictionaryEntries - The searchDictionaryEntries parameters. + * @param searchDictionaryEntries.dictionaryName - The dictionary to search in. + * @param searchDictionaryEntries.searchDictionaryEntries - The searchDictionaryEntries. */ - searchDictionaryEntries( - dictionaryName: 'compounds' | 'plurals' | 'stopwords', - searchDictionaryEntries: SearchDictionaryEntries - ): Promise { + searchDictionaryEntries({ + dictionaryName, + searchDictionaryEntries, + }: SearchDictionaryEntriesProps): Promise { const path = '/1/dictionaries/{dictionaryName}/search'.replace( '{dictionaryName}', encodeURIComponent(String(dictionaryName)) @@ -2011,6 +2143,15 @@ export class SearchApi { ); } + if ( + searchDictionaryEntries.query === null || + searchDictionaryEntries.query === undefined + ) { + throw new Error( + 'Required parameter searchDictionaryEntries.query was null or undefined when calling searchDictionaryEntries.' + ); + } + const request: Request = { method: 'POST', path, @@ -2028,15 +2169,16 @@ export class SearchApi { * 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 indexName - The index in which to perform the request. - * @param facetName - The facet name. - * @param searchForFacetValuesRequest - The searchForFacetValuesRequest. + * @param searchForFacetValues - The searchForFacetValues parameters. + * @param searchForFacetValues.indexName - The index in which to perform the request. + * @param searchForFacetValues.facetName - The facet name. + * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest. */ - searchForFacetValues( - indexName: string, - facetName: string, - searchForFacetValuesRequest?: SearchForFacetValuesRequest - ): Promise { + searchForFacetValues({ + indexName, + facetName, + searchForFacetValuesRequest, + }: SearchForFacetValuesProps): Promise { const path = '/1/indexes/{indexName}/facets/{facetName}/query' .replace('{indexName}', encodeURIComponent(String(indexName))) .replace('{facetName}', encodeURIComponent(String(facetName))); @@ -2072,13 +2214,14 @@ export class SearchApi { * Search for rules matching various criteria. * * @summary Search for rules. - * @param indexName - The index in which to perform the request. - * @param searchRulesParams - The searchRulesParams. + * @param searchRules - The searchRules parameters. + * @param searchRules.indexName - The index in which to perform the request. + * @param searchRules.searchRulesParams - The searchRulesParams. */ - searchRules( - indexName: string, - searchRulesParams: SearchRulesParams - ): Promise { + searchRules({ + indexName, + searchRulesParams, + }: SearchRulesProps): Promise { const path = '/1/indexes/{indexName}/rules/search'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -2115,24 +2258,20 @@ export class SearchApi { * Search or browse all synonyms, optionally filtering them by type. * * @summary Get all synonyms that match a query. - * @param indexName - The index in which to perform the request. - * @param query - Search for specific synonyms matching this string. - * @param type - Only search for specific types of synonyms. - * @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). - * @param hitsPerPage - Maximum number of objects to retrieve. + * @param searchSynonyms - The searchSynonyms parameters. + * @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. */ - searchSynonyms( - indexName: string, - query?: string, - type?: - | 'altcorrection1' - | 'altcorrection2' - | 'onewaysynonym' - | 'placeholder' - | 'synonym', - page?: number, - hitsPerPage?: number - ): Promise { + searchSynonyms({ + indexName, + query, + type, + page, + hitsPerPage, + }: SearchSynonymsProps): Promise { const path = '/1/indexes/{indexName}/synonyms/search'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -2178,11 +2317,12 @@ export class SearchApi { * 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 searchUserIdsObject - The searchUserIdsObject. + * @param searchUserIds - The searchUserIds parameters. + * @param searchUserIds.searchUserIdsObject - The searchUserIdsObject. */ - searchUserIds( - searchUserIdsObject: SearchUserIdsObject - ): Promise { + searchUserIds({ + searchUserIdsObject, + }: SearchUserIdsProps): Promise { const path = '/1/clusters/mapping/search'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -2193,6 +2333,15 @@ export class SearchApi { ); } + if ( + searchUserIdsObject.query === null || + searchUserIdsObject.query === undefined + ) { + throw new Error( + 'Required parameter searchUserIdsObject.query was null or undefined when calling searchUserIds.' + ); + } + const request: Request = { method: 'POST', path, @@ -2210,11 +2359,12 @@ export class SearchApi { * Set dictionary settings. * * @summary Set dictionary settings. - * @param dictionarySettingsRequest - The dictionarySettingsRequest. + * @param setDictionarySettings - The setDictionarySettings parameters. + * @param setDictionarySettings.dictionarySettingsRequest - The dictionarySettingsRequest. */ - setDictionarySettings( - dictionarySettingsRequest: DictionarySettingsRequest - ): Promise { + setDictionarySettings({ + dictionarySettingsRequest, + }: SetDictionarySettingsProps): Promise { const path = '/1/dictionaries/*/settings'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -2228,6 +2378,15 @@ export class SearchApi { ); } + if ( + dictionarySettingsRequest.disableStandardEntries === null || + dictionarySettingsRequest.disableStandardEntries === undefined + ) { + throw new Error( + 'Required parameter dictionarySettingsRequest.disableStandardEntries was null or undefined when calling setDictionarySettings.' + ); + } + const request: Request = { method: 'PUT', path, @@ -2244,15 +2403,16 @@ export class SearchApi { /** * 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. - * @param indexSettings - The indexSettings. - * @param forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param setSettings - The setSettings parameters. + * @param setSettings.indexName - The index in which to perform the request. + * @param setSettings.indexSettings - The indexSettings. + * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ - setSettings( - indexName: string, - indexSettings: IndexSettings, - forwardToReplicas?: boolean - ): Promise { + setSettings({ + indexName, + indexSettings, + forwardToReplicas, + }: SetSettingsProps): Promise { const path = '/1/indexes/{indexName}/settings'.replace( '{indexName}', encodeURIComponent(String(indexName)) @@ -2293,10 +2453,14 @@ export class SearchApi { * Replace every permission of an existing API key. * * @summary Update an API key. - * @param key - API Key string. - * @param apiKey - The apiKey. + * @param updateApiKey - The updateApiKey parameters. + * @param updateApiKey.key - API Key string. + * @param updateApiKey.apiKey - The apiKey. */ - updateApiKey(key: string, apiKey: ApiKey): Promise { + updateApiKey({ + key, + apiKey, + }: UpdateApiKeyProps): Promise { const path = '/1/keys/{key}'.replace( '{key}', encodeURIComponent(String(key)) @@ -2316,6 +2480,12 @@ export class SearchApi { ); } + if (apiKey.acl === null || apiKey.acl === undefined) { + throw new Error( + 'Required parameter apiKey.acl was null or undefined when calling updateApiKey.' + ); + } + const request: Request = { method: 'PUT', path, @@ -2330,3 +2500,265 @@ export class SearchApi { return this.sendRequest(request, requestOptions); } } + +export type AddApiKeyProps = { + apiKey: ApiKey; +}; + +export type AddOrUpdateObjectProps = { + indexName: string; + objectID: string; + requestBody: { [key: string]: Record }; +}; + +export type AppendSourceProps = { + source: Source; +}; + +export type AssignUserIdProps = { + xAlgoliaUserID: Record; + assignUserIdObject: AssignUserIdObject; +}; + +export type BatchProps = { + indexName: string; + batchWriteObject: BatchWriteObject; +}; + +export type BatchAssignUserIdsProps = { + xAlgoliaUserID: Record; + batchAssignUserIdsObject: BatchAssignUserIdsObject; +}; + +export type BatchDictionaryEntriesProps = { + dictionaryName: 'compounds' | 'plurals' | 'stopwords'; + batchDictionaryEntries: BatchDictionaryEntries; +}; + +export type BatchRulesProps = { + indexName: string; + rule: Rule[]; + forwardToReplicas?: boolean; + clearExistingRules?: boolean; +}; + +export type BrowseProps = { + indexName: string; + browseRequest?: BrowseRequest; +}; + +export type ClearAllSynonymsProps = { + indexName: string; + forwardToReplicas?: boolean; +}; + +export type ClearObjectsProps = { + indexName: string; +}; + +export type ClearRulesProps = { + indexName: string; + forwardToReplicas?: boolean; +}; + +export type DeleteApiKeyProps = { + key: string; +}; + +export type DeleteByProps = { + indexName: string; + searchParams: SearchParams; +}; + +export type DeleteIndexProps = { + indexName: string; +}; + +export type DeleteObjectProps = { + indexName: string; + objectID: string; +}; + +export type DeleteRuleProps = { + indexName: string; + objectID: string; + forwardToReplicas?: boolean; +}; + +export type DeleteSourceProps = { + source: string; +}; + +export type DeleteSynonymProps = { + indexName: string; + objectID: string; + forwardToReplicas?: boolean; +}; + +export type GetApiKeyProps = { + key: string; +}; + +export type GetLogsProps = { + offset?: number; + length?: number; + indexName?: string; + type?: 'all' | 'build' | 'error' | 'query'; +}; + +export type GetObjectProps = { + indexName: string; + objectID: string; + attributesToRetrieve?: string[]; +}; + +export type GetObjectsProps = { + getObjectsObject: GetObjectsObject; +}; + +export type GetRuleProps = { + indexName: string; + objectID: string; +}; + +export type GetSettingsProps = { + indexName: string; +}; + +export type GetSynonymProps = { + indexName: string; + objectID: string; +}; + +export type GetTaskProps = { + indexName: string; + taskID: number; +}; + +export type GetUserIdProps = { + userID: Record; +}; + +export type HasPendingMappingsProps = { + getClusters?: boolean; +}; + +export type ListIndicesProps = { + page?: number; +}; + +export type ListUserIdsProps = { + page?: number; + hitsPerPage?: number; +}; + +export type MultipleBatchProps = { + batchObject: BatchObject; +}; + +export type MultipleQueriesProps = { + multipleQueriesObject: MultipleQueriesObject; +}; + +export type OperationIndexProps = { + indexName: string; + operationIndexObject: OperationIndexObject; +}; + +export type PartialUpdateObjectProps = { + indexName: string; + objectID: string; + stringBuildInOperation: Array<{ [key: string]: BuildInOperation | string }>; + createIfNotExists?: boolean; +}; + +export type RemoveUserIdProps = { + userID: Record; +}; + +export type ReplaceSourcesProps = { + source: Source[]; +}; + +export type RestoreApiKeyProps = { + key: string; +}; + +export type SaveObjectProps = { + indexName: string; + requestBody: { [key: string]: Record }; +}; + +export type SaveRuleProps = { + indexName: string; + objectID: string; + rule: Rule; + forwardToReplicas?: boolean; +}; + +export type SaveSynonymProps = { + indexName: string; + objectID: string; + synonymHit: SynonymHit; + forwardToReplicas?: boolean; +}; + +export type SaveSynonymsProps = { + indexName: string; + synonymHit: SynonymHit[]; + forwardToReplicas?: boolean; + replaceExistingSynonyms?: boolean; +}; + +export type SearchProps = { + indexName: string; + searchParams: SearchParams; +}; + +export type SearchDictionaryEntriesProps = { + dictionaryName: 'compounds' | 'plurals' | 'stopwords'; + searchDictionaryEntries: SearchDictionaryEntries; +}; + +export type SearchForFacetValuesProps = { + indexName: string; + facetName: string; + searchForFacetValuesRequest?: SearchForFacetValuesRequest; +}; + +export type SearchRulesProps = { + indexName: string; + searchRulesParams: SearchRulesParams; +}; + +export type SearchSynonymsProps = { + indexName: string; + query?: string; + type?: + | 'altcorrection1' + | 'altcorrection2' + | 'onewaysynonym' + | 'placeholder' + | 'synonym'; + page?: number; + hitsPerPage?: number; +}; + +export type SearchUserIdsProps = { + searchUserIdsObject: SearchUserIdsObject; +}; + +export type SetDictionarySettingsProps = { + dictionarySettingsRequest: DictionarySettingsRequest; +}; + +export type SetSettingsProps = { + indexName: string; + indexSettings: IndexSettings; + forwardToReplicas?: boolean; +}; + +export type UpdateApiKeyProps = { + key: string; + apiKey: ApiKey; +}; diff --git a/clients/algoliasearch-client-javascript/recommend/model/getRecommendations.ts b/clients/algoliasearch-client-javascript/recommend/model/getRecommendations.ts index e30130f28e..fd0545253f 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/getRecommendations.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/getRecommendations.ts @@ -4,5 +4,8 @@ import type { RecommendationRequest } from './recommendationRequest'; * The `getRecommendations` requests. */ export type GetRecommendations = { + /** + * The `getRecommendations` requests. + */ requests: RecommendationRequest[]; }; diff --git a/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts b/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts index d71fe87fb6..77a4d6a355 100644 --- a/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts +++ b/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts @@ -99,11 +99,12 @@ export class RecommendApi { /** * Returns recommendations for a specific model and objectID. * - * @param getRecommendations - The getRecommendations. + * @param getRecommendations - The getRecommendations parameters. + * @param getRecommendations.getRecommendations - The getRecommendations. */ - getRecommendations( - getRecommendations: GetRecommendations - ): Promise { + getRecommendations({ + getRecommendations, + }: GetRecommendationsProps): Promise { const path = '/1/indexes/*/recommendations'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -114,6 +115,15 @@ export class RecommendApi { ); } + if ( + getRecommendations.requests === null || + getRecommendations.requests === undefined + ) { + throw new Error( + 'Required parameter getRecommendations.requests was null or undefined when calling getRecommendations.' + ); + } + const request: Request = { method: 'POST', path, @@ -128,3 +138,7 @@ export class RecommendApi { return this.sendRequest(request, requestOptions); } } + +export type GetRecommendationsProps = { + getRecommendations: GetRecommendations; +}; diff --git a/playground/javascript/analytics.ts b/playground/javascript/analytics.ts index 633aab5b92..3db80e5700 100644 --- a/playground/javascript/analytics.ts +++ b/playground/javascript/analytics.ts @@ -14,7 +14,9 @@ const client = new AnalyticsApi(appId, apiKey, 'de'); async function testAnalytics() { try { - const res = await client.getStatus(analyticsIndex); + const res = await client.getSearchesNoResults({ + index: analyticsIndex, + }); console.log(`[OK]`, res); } catch (e) { diff --git a/playground/javascript/personalization.ts b/playground/javascript/personalization.ts index bb1dfe6e9a..08c433f50b 100644 --- a/playground/javascript/personalization.ts +++ b/playground/javascript/personalization.ts @@ -12,7 +12,7 @@ const client = new PersonalizationApi(appId, apiKey, 'eu'); async function testPersonalization() { try { - const res = await client.getPersonalizationStrategy(); + const res = await client.deleteUserProfile({ userToken: 'userToken' }); console.log(`[OK]`, res); } catch (e) { diff --git a/playground/javascript/recommend.ts b/playground/javascript/recommend.ts index 40e2f490d3..6c006ef0d8 100644 --- a/playground/javascript/recommend.ts +++ b/playground/javascript/recommend.ts @@ -1,4 +1,8 @@ -import { RecommendApi, ApiError, RecommendationRequest } from '@algolia/recommend'; +import { + RecommendApi, + ApiError, + RecommendationRequest, +} from '@algolia/recommend'; import dotenv from 'dotenv'; dotenv.config({ path: '../.env' }); @@ -14,16 +18,20 @@ const client = new RecommendApi(appId, apiKey); async function testRecommend() { try { - const res = await client.getRecommendations({ - requests: [ - { - indexName: searchIndex, - model: RecommendationRequest.ModelEnum['BoughtTogether'], - objectID: searchQuery, - threshold: 0, - }, - ], - }); + const request = { + getRecommendations: { + requests: [ + { + indexName: searchIndex, + model: RecommendationRequest.ModelEnum['BoughtTogether'], + objectID: searchQuery, + threshold: 0, + }, + ], + }, + }; + + const res = await client.getRecommendations(request); console.log(`[OK]`, res); } catch (e) { diff --git a/playground/javascript/search.ts b/playground/javascript/search.ts index 089b426e8b..36990d431b 100644 --- a/playground/javascript/search.ts +++ b/playground/javascript/search.ts @@ -14,7 +14,10 @@ const client = new SearchApi(appId, apiKey); async function testSearch() { try { - const res = await client.search(searchIndex, { query: searchQuery }); + const res = await client.search({ + indexName: searchIndex, + searchParams: { query: searchQuery }, + }); console.log(`[OK]`, res); } catch (e) { diff --git a/specs/recommend/paths/getRecommendations.yml b/specs/recommend/paths/getRecommendations.yml index 5c006603cf..a6c265e356 100644 --- a/specs/recommend/paths/getRecommendations.yml +++ b/specs/recommend/paths/getRecommendations.yml @@ -15,6 +15,7 @@ post: properties: requests: type: array + description: The `getRecommendations` requests. items: title: recommendationRequest type: object diff --git a/specs/search/common/schemas/SearchParams.yml b/specs/search/common/schemas/SearchParams.yml index 607370f7fb..0b71956c95 100644 --- a/specs/search/common/schemas/SearchParams.yml +++ b/specs/search/common/schemas/SearchParams.yml @@ -1,4 +1,9 @@ searchParams: + oneOf: + - $ref: '#/searchParamsString' + - $ref: '#/searchParamsObject' + +searchParamsObject: allOf: - $ref: '../../common/schemas/SearchParams.yml#/baseSearchParams' - $ref: '../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' @@ -159,7 +164,7 @@ baseSearchParams: description: Whether this search should use AI Re-Ranking. default: true -searchParamsAsString: +searchParamsString: type: object additionalProperties: false properties: diff --git a/specs/search/paths/objects/clearObjects.yml b/specs/search/paths/objects/clearObjects.yml index b6da257c2e..292deb6384 100644 --- a/specs/search/paths/objects/clearObjects.yml +++ b/specs/search/paths/objects/clearObjects.yml @@ -3,7 +3,7 @@ post: - search operationId: clearObjects summary: clear all objects from an index. - description: Delete an index’s content, but leave settings and index-specific API keys untouched. + description: Delete an index's content, but leave settings and index-specific API keys untouched. parameters: - $ref: ../../../common/parameters.yml#/IndexName responses: diff --git a/specs/search/paths/objects/deleteBy.yml b/specs/search/paths/objects/deleteBy.yml index 92842ac427..bc283b69a3 100644 --- a/specs/search/paths/objects/deleteBy.yml +++ b/specs/search/paths/objects/deleteBy.yml @@ -8,7 +8,7 @@ post: 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. + It doesn't accept empty filters or a query. parameters: - $ref: ../../../common/parameters.yml#/IndexName requestBody: @@ -16,9 +16,7 @@ post: content: application/json: schema: - oneOf: - - $ref: '../../common/schemas/SearchParams.yml#/searchParamsAsString' - - $ref: '../../common/schemas/SearchParams.yml#/searchParams' + $ref: '../../common/schemas/SearchParams.yml#/searchParams' responses: '200': $ref: ../../../common/responses/DeletedAt.yml diff --git a/specs/search/paths/objects/partialUpdate.yml b/specs/search/paths/objects/partialUpdate.yml index af803bcfeb..81f822b7f1 100644 --- a/specs/search/paths/objects/partialUpdate.yml +++ b/specs/search/paths/objects/partialUpdate.yml @@ -10,7 +10,7 @@ post: 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. + If the index targeted by this operation doesn't exist yet, it's automatically created. parameters: - $ref: ../../../common/parameters.yml#/IndexName - $ref: ../../../common/parameters.yml#/ObjectID diff --git a/specs/search/paths/search/search.yml b/specs/search/paths/search/search.yml index 5d445dbdb4..7d4ccfb397 100644 --- a/specs/search/paths/search/search.yml +++ b/specs/search/paths/search/search.yml @@ -10,9 +10,7 @@ post: content: application/json: schema: - oneOf: - - $ref: '../../common/schemas/SearchParams.yml#/searchParamsAsString' - - $ref: '../../common/schemas/SearchParams.yml#/searchParams' + $ref: '../../common/schemas/SearchParams.yml#/searchParams' responses: '200': description: OK diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 2b4931ee8e..c5b5de36c0 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -51,7 +51,7 @@ public class {{classname}} extends ApiClient { {{#operation}} {{^vendorExtensions.x-group-parameters}}/** * Build call for {{operationId}}{{#allParams}} - * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -60,7 +60,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -68,8 +68,8 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{{description}}} - * @see {{summary}} Documentation + * {{&description}} + * @see {{&summary}} Documentation {{/externalDocs}} */ {{#isDeprecated}} @@ -177,9 +177,9 @@ public class {{classname}} extends ApiClient { {{^vendorExtensions.x-group-parameters}} /** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} + * {{&summary}} + * {{¬es}}{{#allParams}} + * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} * @return {{.}}{{/returnType}} * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} @@ -187,7 +187,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -195,8 +195,8 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{{description}}} - * @see {{summary}} Documentation + * {{&description}} + * @see {{&summary}} Documentation {{/externalDocs}} */ {{#isDeprecated}} @@ -217,9 +217,9 @@ public class {{classname}} extends ApiClient { {{/vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}}/** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * {{&summary}} + * {{¬es}}{{#allParams}} + * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} @@ -227,7 +227,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -235,8 +235,8 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{{description}}} - * @see {{summary}} Documentation + * {{&description}} + * @see {{&summary}} Documentation {{/externalDocs}} */ {{#isDeprecated}} @@ -255,9 +255,9 @@ public class {{classname}} extends ApiClient { {{/vendorExtensions.x-streaming}} {{^vendorExtensions.x-group-parameters}}/** - * {{summary}} (asynchronously) - * {{notes}}{{#allParams}} - * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * {{&summary}} (asynchronously) + * {{¬es}}{{#allParams}} + * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @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 @@ -266,7 +266,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -274,8 +274,8 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{{description}}} - * @see {{summary}} Documentation + * {{&description}} + * @see {{&summary}} Documentation {{/externalDocs}} */ {{#isDeprecated}} @@ -307,7 +307,7 @@ public class {{classname}} extends ApiClient { {{#optionalParams}} /** * Set {{paramName}} - * @param {{paramName}} {{{description}}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) + * @param {{paramName}} {{&description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) * @return API{{operationId}}Request */ public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { @@ -326,7 +326,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -350,7 +350,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -375,7 +375,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -400,7 +400,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -417,16 +417,16 @@ public class {{classname}} extends ApiClient { } /** - * {{summary}} - * {{notes}}{{#requiredParams}} - * @param {{paramName}} {{{description}}} (required){{/requiredParams}} + * {{&summary}} + * {{¬es}}{{#requiredParams}} + * @param {{paramName}} {{&description}} (required){{/requiredParams}} * @return API{{operationId}}Request {{#responses.0}} * @http.response.details {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{&description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -434,8 +434,8 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{{description}}} - * @see {{summary}} Documentation + * {{&description}} + * @see {{&summary}} Documentation {{/externalDocs}} */ {{#isDeprecated}} diff --git a/templates/java/modelEnum.mustache b/templates/java/modelEnum.mustache index 091bd1dd6b..3dad6f9fbb 100644 --- a/templates/java/modelEnum.mustache +++ b/templates/java/modelEnum.mustache @@ -11,7 +11,7 @@ import com.google.gson.stream.JsonWriter; {{/gson}} /** - * {{{description}}}{{^description}}Gets or Sets {{{name}}}{{/description}} + * {{&description}}{{^description}}Gets or Sets {{{name}}}{{/description}} */ {{#gson}} @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) diff --git a/templates/java/modelInnerEnum.mustache b/templates/java/modelInnerEnum.mustache index 3a82945127..7bd66e2bea 100644 --- a/templates/java/modelInnerEnum.mustache +++ b/templates/java/modelInnerEnum.mustache @@ -1,5 +1,5 @@ /** - * {{{description}}}{{^description}}Gets or Sets {{{name}}}{{/description}} + * {{&description}}{{^description}}Gets or Sets {{{name}}}{{/description}} */ {{#gson}} @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class) diff --git a/templates/java/pojo.mustache b/templates/java/pojo.mustache index bd0d35b137..6039e529f9 100644 --- a/templates/java/pojo.mustache +++ b/templates/java/pojo.mustache @@ -1,5 +1,5 @@ /** - * {{{description}}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * {{&description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} @Deprecated{{/isDeprecated}}{{#description}} @@ -193,7 +193,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#jsonb}} @JsonbProperty("{{baseName}}") {{/jsonb}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{&description}}") {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index 578a9cebfd..2c64259f5b 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -16,6 +16,7 @@ import { ApiKeyAuth } from '../model/models'; * {{&description}} */ {{/description}} + export enum {{classname}}Keys { {{#authMethods}} {{#isApiKey}} @@ -132,11 +133,20 @@ export class {{classname}} { {{#summary}} * @summary {{&summary}} {{/summary}} + * @param {{nickname}} - The {{nickname}} parameters. {{#allParams}} - * @param {{paramName}} {{^description}}The {{paramName}}{{/description}}{{#description}}{{{description}}}{{/description}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}}{{/description}}{{#description}}{{{description}}}{{/description}} {{/allParams}} */ - public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}) : Promise<{{{returnType}}}> { + public {{nickname}} ( + {{#allParams.0}} + { + {{#allParams}} + {{paramName}}, + {{/allParams}} + }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props + {{/allParams.0}} + ) : Promise<{{{returnType}}}> { const path = '{{{path}}}'{{#pathParams}}.replace( {{=<% %>=}} '{<%baseName%>}', @@ -152,6 +162,14 @@ export class {{classname}} { throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); } + {{#vars}} + {{#required}} + if ({{paramName}}.{{baseName}} === null || {{paramName}}.{{baseName}} === undefined) { + throw new Error('Required parameter {{paramName}}.{{baseName}} was null or undefined when calling {{nickname}}.'); + } + {{/required}} + {{/vars}} + {{/required}} {{/allParams}} {{#queryParams}} @@ -181,4 +199,16 @@ export class {{classname}} { } {{/operation}} } + +{{#operation}} +{{#allParams.0}} +export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { + {{#allParams}} + {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; + {{/allParams}} +} +{{/allParams.0}} + +{{/operation}} + {{/operations}} diff --git a/templates/javascript/model.mustache b/templates/javascript/model.mustache index 44392c97d5..13d2a34c83 100644 --- a/templates/javascript/model.mustache +++ b/templates/javascript/model.mustache @@ -5,7 +5,9 @@ import { {{classname}} } from '{{filename}}'; {{/tsImports}} {{! We handle types that depend on other interfaces }} -{{#interfaces.size}}export type {{classname}} = {{#interfaces}}{{.}} {{^-last}}&{{/-last}} {{/interfaces}};{{/interfaces.size}} +{{#interfaces.size}} +export type {{classname}} = {{#oneOf}}{{.}} {{^-last}}|{{/-last}} {{/oneOf}}{{#allOf}}{{.}} {{^-last}}&{{/-last}} {{/allOf}}; +{{/interfaces.size}} {{^interfaces}} {{#description}} diff --git a/tests/CTS/clients/recommend/getRecommendations.json b/tests/CTS/clients/recommend/getRecommendations.json index c86f5322de..fb7ec3e086 100644 --- a/tests/CTS/clients/recommend/getRecommendations.json +++ b/tests/CTS/clients/recommend/getRecommendations.json @@ -4,14 +4,16 @@ "testName": "get recommendations with minimal parameters", "parameters": [ { - "requests": [ - { - "indexName": "indexName", - "objectID": "objectID", - "model": "related-products", - "threshold": 42 - } - ] + "getRecommendations": { + "requests": [ + { + "indexName": "indexName", + "objectID": "objectID", + "model": "related-products", + "threshold": 42 + } + ] + } } ], "request": { @@ -34,16 +36,18 @@ "testName": "get recommendations with all parameters", "parameters": [ { - "requests": [ - { - "indexName": "indexName", - "objectID": "objectID", - "model": "related-products", - "threshold": 42, - "queryParameters": { "facetFilters": ["query"] }, - "fallbackParameters": { "facetFilters": ["fallback"] } - } - ] + "getRecommendations": { + "requests": [ + { + "indexName": "indexName", + "objectID": "objectID", + "model": "related-products", + "threshold": 42, + "queryParameters": { "facetFilters": ["query"] }, + "fallbackParameters": { "facetFilters": ["fallback"] } + } + ] + } } ], "request": { @@ -68,20 +72,22 @@ "testName": "get multiple recommendations with minimal parameters", "parameters": [ { - "requests": [ - { - "indexName": "indexName1", - "objectID": "objectID1", - "model": "related-products", - "threshold": 21 - }, - { - "indexName": "indexName2", - "objectID": "objectID2", - "model": "related-products", - "threshold": 21 - } - ] + "getRecommendations": { + "requests": [ + { + "indexName": "indexName1", + "objectID": "objectID1", + "model": "related-products", + "threshold": 21 + }, + { + "indexName": "indexName2", + "objectID": "objectID2", + "model": "related-products", + "threshold": 21 + } + ] + } } ], "request": { @@ -110,24 +116,26 @@ "testName": "get multiple recommendations with all parameters", "parameters": [ { - "requests": [ - { - "indexName": "indexName1", - "objectID": "objectID1", - "model": "related-products", - "threshold": 21, - "queryParameters": { "facetFilters": ["query1"] }, - "fallbackParameters": { "facetFilters": ["fallback1"] } - }, - { - "indexName": "indexName2", - "objectID": "objectID2", - "model": "related-products", - "threshold": 21, - "queryParameters": { "facetFilters": ["query2"] }, - "fallbackParameters": { "facetFilters": ["fallback2"] } - } - ] + "getRecommendations": { + "requests": [ + { + "indexName": "indexName1", + "objectID": "objectID1", + "model": "related-products", + "threshold": 21, + "queryParameters": { "facetFilters": ["query1"] }, + "fallbackParameters": { "facetFilters": ["fallback1"] } + }, + { + "indexName": "indexName2", + "objectID": "objectID2", + "model": "related-products", + "threshold": 21, + "queryParameters": { "facetFilters": ["query2"] }, + "fallbackParameters": { "facetFilters": ["fallback2"] } + } + ] + } } ], "request": { @@ -160,14 +168,16 @@ "testName": "get frequently bought together recommendations", "parameters": [ { - "requests": [ - { - "indexName": "indexName1", - "objectID": "objectID1", - "model": "bought-together", - "threshold": 42 - } - ] + "getRecommendations": { + "requests": [ + { + "indexName": "indexName1", + "objectID": "objectID1", + "model": "bought-together", + "threshold": 42 + } + ] + } } ], "request": { diff --git a/tests/CTS/clients/search/addApiKey.json b/tests/CTS/clients/search/addApiKey.json index 6f06c6f1d8..66d733c583 100644 --- a/tests/CTS/clients/search/addApiKey.json +++ b/tests/CTS/clients/search/addApiKey.json @@ -3,11 +3,13 @@ "method": "addApiKey", "parameters": [ { - "acl": ["search", "addObject"], - "description": "my new api key", - "validity": 300, - "maxQueriesPerIPPerHour": 100, - "maxHitsPerQuery": 20 + "apiKey": { + "acl": ["search", "addObject"], + "description": "my new api key", + "validity": 300, + "maxQueriesPerIPPerHour": 100, + "maxHitsPerQuery": 20 + } } ], "request": { diff --git a/tests/CTS/clients/search/batchDictionaryEntries.json b/tests/CTS/clients/search/batchDictionaryEntries.json index 3a4405c83d..91c73db302 100644 --- a/tests/CTS/clients/search/batchDictionaryEntries.json +++ b/tests/CTS/clients/search/batchDictionaryEntries.json @@ -3,24 +3,26 @@ "method": "batchDictionaryEntries", "testName": "get batchDictionaryEntries results with minimal parameters", "parameters": [ - "dictionaryName", { - "requests": [ - { - "action": "addEntry", - "body": { - "objectID": "1", - "language": "en" - } - }, - { - "action": "deleteEntry", - "body": { - "objectID": "2", - "language": "fr" + "dictionaryName": "dictionaryName", + "batchDictionaryEntries": { + "requests": [ + { + "action": "addEntry", + "body": { + "objectID": "1", + "language": "en" + } + }, + { + "action": "deleteEntry", + "body": { + "objectID": "2", + "language": "fr" + } } - } - ] + ] + } } ], "request": { @@ -50,33 +52,35 @@ "method": "batchDictionaryEntries", "testName": "get batchDictionaryEntries results with all parameters", "parameters": [ - "dictionaryName", { - "clearExistingDictionaryEntries": false, - "requests": [ - { - "action": "addEntry", - "body": { - "objectID": "1", - "language": "en", - "word": "yo", - "words": ["yo", "algolia"], - "decomposition": ["yo", "algolia"], - "state": "enabled" + "dictionaryName": "dictionaryName", + "batchDictionaryEntries": { + "clearExistingDictionaryEntries": false, + "requests": [ + { + "action": "addEntry", + "body": { + "objectID": "1", + "language": "en", + "word": "yo", + "words": ["yo", "algolia"], + "decomposition": ["yo", "algolia"], + "state": "enabled" + } + }, + { + "action": "deleteEntry", + "body": { + "objectID": "2", + "language": "fr", + "word": "salut", + "words": ["salut", "algolia"], + "decomposition": ["salut", "algolia"], + "state": "enabled" + } } - }, - { - "action": "deleteEntry", - "body": { - "objectID": "2", - "language": "fr", - "word": "salut", - "words": ["salut", "algolia"], - "decomposition": ["salut", "algolia"], - "state": "enabled" - } - } - ] + ] + } } ], "request": { diff --git a/tests/CTS/clients/search/batchRules.json b/tests/CTS/clients/search/batchRules.json index 507de4d6e4..b340f6a1ba 100644 --- a/tests/CTS/clients/search/batchRules.json +++ b/tests/CTS/clients/search/batchRules.json @@ -2,14 +2,17 @@ { "method": "batchRules", "parameters": [ - "indexName", - [ + { + "indexName": "indexName", + "rule": [ { "objectID": "a-rule-id", - "conditions": [{ - "pattern": "smartphone", - "anchoring": "contains" - }], + "conditions": [ + { + "pattern": "smartphone", + "anchoring": "contains" + } + ], "consequence": { "params": { "filters": "category:smartphone" @@ -18,50 +21,56 @@ }, { "objectID": "a-second-rule-id", - "conditions": [{ - "pattern": "apple", - "anchoring": "contains" - }], + "conditions": [ + { + "pattern": "apple", + "anchoring": "contains" + } + ], "consequence": { "params": { "filters": "brand:apple" } } } - ], - true, - true + ], + "forwardToReplicas": true, + "clearExistingRules": true + } ], "request": { "path": "/1/indexes/indexName/rules/batch", "method": "POST", "data": [ - { - "objectID": "a-rule-id", - "conditions": [{ + { + "objectID": "a-rule-id", + "conditions": [ + { "pattern": "smartphone", "anchoring": "contains" - }], - "consequence": { - "params": { - "filters": "category:smartphone" - } } - }, - { - "objectID": "a-second-rule-id", - "conditions": [{ + ], + "consequence": { + "params": { + "filters": "category:smartphone" + } + } + }, + { + "objectID": "a-second-rule-id", + "conditions": [ + { "pattern": "apple", "anchoring": "contains" - }], - "consequence": { - "params": { - "filters": "brand:apple" - } + } + ], + "consequence": { + "params": { + "filters": "brand:apple" } } + } ] } } ] - \ No newline at end of file diff --git a/tests/CTS/clients/search/browse.json b/tests/CTS/clients/search/browse.json index 8f14ddd4cf..caa1101e8d 100644 --- a/tests/CTS/clients/search/browse.json +++ b/tests/CTS/clients/search/browse.json @@ -2,7 +2,7 @@ { "method": "browse", "testName": "get browse results with minimal parameters", - "parameters": ["indexName"], + "parameters": [{ "indexName": "indexName" }], "request": { "path": "/1/indexes/indexName/browse", "method": "POST" @@ -12,10 +12,12 @@ "method": "browse", "testName": "get browse results with all parameters", "parameters": [ - "indexName", { - "params": "query=foo&facetFilters=['bar']", - "cursor": "cts" + "indexName": "indexName", + "browseRequest": { + "params": "query=foo&facetFilters=['bar']", + "cursor": "cts" + } } ], "request": { diff --git a/tests/CTS/clients/search/clearAllSynonyms.json b/tests/CTS/clients/search/clearAllSynonyms.json index 0fc48d2f72..12d891ee96 100644 --- a/tests/CTS/clients/search/clearAllSynonyms.json +++ b/tests/CTS/clients/search/clearAllSynonyms.json @@ -1,7 +1,7 @@ [ { "method": "clearAllSynonyms", - "parameters": ["indexName"], + "parameters": [{ "indexName": "indexName" }], "request": { "path": "/1/indexes/indexName/synonyms/clear", "method": "POST" diff --git a/tests/CTS/clients/search/clearRules.json b/tests/CTS/clients/search/clearRules.json index 0a205332e1..fd1fa700eb 100644 --- a/tests/CTS/clients/search/clearRules.json +++ b/tests/CTS/clients/search/clearRules.json @@ -1,11 +1,10 @@ [ { "method": "clearRules", - "parameters": ["indexName"], + "parameters": [{ "indexName": "indexName" }], "request": { "path": "/1/indexes/indexName/rules/clear", "method": "POST" } } ] - \ No newline at end of file diff --git a/tests/CTS/clients/search/deleteApiKey.json b/tests/CTS/clients/search/deleteApiKey.json index 40500b64f5..2295b6dce0 100644 --- a/tests/CTS/clients/search/deleteApiKey.json +++ b/tests/CTS/clients/search/deleteApiKey.json @@ -1,7 +1,7 @@ [ { "method": "deleteApiKey", - "parameters": ["myTestApiKey"], + "parameters": [{ "key": "myTestApiKey" }], "request": { "path": "/1/keys/myTestApiKey", "method": "DELETE" diff --git a/tests/CTS/clients/search/deleteRule.json b/tests/CTS/clients/search/deleteRule.json index 36bf62d073..7e63e5535e 100644 --- a/tests/CTS/clients/search/deleteRule.json +++ b/tests/CTS/clients/search/deleteRule.json @@ -1,11 +1,10 @@ [ { "method": "deleteRule", - "parameters": ["indexName", "id1"], + "parameters": [{ "indexName": "indexName", "objectID": "id1" }], "request": { "path": "/1/indexes/indexName/rules/id1", "method": "DELETE" } } ] - \ No newline at end of file diff --git a/tests/CTS/clients/search/deleteSynonym.json b/tests/CTS/clients/search/deleteSynonym.json index f29f8d6279..eb59860a96 100644 --- a/tests/CTS/clients/search/deleteSynonym.json +++ b/tests/CTS/clients/search/deleteSynonym.json @@ -1,7 +1,7 @@ [ { "method": "deleteSynonym", - "parameters": ["indexName", "id1"], + "parameters": [{ "indexName": "indexName", "objectID": "id1" }], "request": { "path": "/1/indexes/indexName/synonyms/id1", "method": "DELETE" diff --git a/tests/CTS/clients/search/getApiKey.json b/tests/CTS/clients/search/getApiKey.json index e6c5bb40e9..b92233fbd5 100644 --- a/tests/CTS/clients/search/getApiKey.json +++ b/tests/CTS/clients/search/getApiKey.json @@ -1,7 +1,7 @@ [ { "method": "getApiKey", - "parameters": ["myTestApiKey"], + "parameters": [{ "key": "myTestApiKey" }], "request": { "path": "/1/keys/myTestApiKey", "method": "GET" diff --git a/tests/CTS/clients/search/getRule.json b/tests/CTS/clients/search/getRule.json index 93203a795f..3cc5f79190 100644 --- a/tests/CTS/clients/search/getRule.json +++ b/tests/CTS/clients/search/getRule.json @@ -1,11 +1,10 @@ [ { "method": "getRule", - "parameters": ["indexName", "id1"], + "parameters": [{ "indexName": "indexName", "objectID": "id1" }], "request": { "path": "/1/indexes/indexName/rules/id1", "method": "GET" } } ] - \ No newline at end of file diff --git a/tests/CTS/clients/search/getSynonym.json b/tests/CTS/clients/search/getSynonym.json index 8b19584a92..f74e379122 100644 --- a/tests/CTS/clients/search/getSynonym.json +++ b/tests/CTS/clients/search/getSynonym.json @@ -1,7 +1,7 @@ [ { "method": "getSynonym", - "parameters": ["indexName", "id1"], + "parameters": [{ "indexName": "indexName", "objectID": "id1" }], "request": { "path": "/1/indexes/indexName/synonyms/id1", "method": "GET" diff --git a/tests/CTS/clients/search/restoreApiKey.json b/tests/CTS/clients/search/restoreApiKey.json index 6db1e0419e..493be3170a 100644 --- a/tests/CTS/clients/search/restoreApiKey.json +++ b/tests/CTS/clients/search/restoreApiKey.json @@ -1,7 +1,7 @@ [ { "method": "restoreApiKey", - "parameters": ["myApiKey"], + "parameters": [{ "key": "myApiKey" }], "request": { "path": "/1/keys/myApiKey/restore", "method": "POST" diff --git a/tests/CTS/clients/search/saveRule.json b/tests/CTS/clients/search/saveRule.json index 68761da37d..dd8aad816d 100644 --- a/tests/CTS/clients/search/saveRule.json +++ b/tests/CTS/clients/search/saveRule.json @@ -2,38 +2,43 @@ { "method": "saveRule", "parameters": [ - "indexName", - "id1", { + "indexName": "indexName", + "objectID": "id1", + "rule": { "objectID": "id1", - "conditions": [{ - "pattern": "apple", - "anchoring": "contains" - }], + "conditions": [ + { + "pattern": "apple", + "anchoring": "contains" + } + ], "consequence": { "params": { "filters": "brand:apple" } } }, - true + "forwardToReplicas": true + } ], "request": { "path": "/1/indexes/indexName/rules/id1", "method": "PUT", "data": { - "objectID": "id1", - "conditions": [{ + "objectID": "id1", + "conditions": [ + { "pattern": "apple", "anchoring": "contains" - }], - "consequence": { - "params": { - "filters": "brand:apple" - } + } + ], + "consequence": { + "params": { + "filters": "brand:apple" } } + } } } ] - \ No newline at end of file diff --git a/tests/CTS/clients/search/saveSynonym.json b/tests/CTS/clients/search/saveSynonym.json index 4a07116797..d081390a60 100644 --- a/tests/CTS/clients/search/saveSynonym.json +++ b/tests/CTS/clients/search/saveSynonym.json @@ -2,14 +2,16 @@ { "method": "saveSynonym", "parameters": [ - "indexName", - "id1", { + "indexName": "indexName", "objectID": "id1", - "type": "synonym", - "synonyms": ["car", "vehicule", "auto"] - }, - true + "synonymHit": { + "objectID": "id1", + "type": "synonym", + "synonyms": ["car", "vehicule", "auto"] + }, + "forwardToReplicas": true + } ], "request": { "path": "/1/indexes/indexName/synonyms/id1", diff --git a/tests/CTS/clients/search/saveSynonyms.json b/tests/CTS/clients/search/saveSynonyms.json index 03e08326ef..3acd2329c1 100644 --- a/tests/CTS/clients/search/saveSynonyms.json +++ b/tests/CTS/clients/search/saveSynonyms.json @@ -2,22 +2,24 @@ { "method": "saveSynonyms", "parameters": [ - "indexName", - [ - { - "objectID": "id1", - "type": "synonym", - "synonyms": ["car", "vehicule", "auto"] - }, - { - "objectID": "id2", - "type": "onewaysynonym", - "input": "iphone", - "synonyms": ["ephone", "aphone", "yphone"] - } - ], - true, - false + { + "indexName": "indexName", + "synonymHit": [ + { + "objectID": "id1", + "type": "synonym", + "synonyms": ["car", "vehicule", "auto"] + }, + { + "objectID": "id2", + "type": "onewaysynonym", + "input": "iphone", + "synonyms": ["ephone", "aphone", "yphone"] + } + ], + "forwardToReplicas": true, + "replaceExistingSynonyms": false + } ], "request": { "path": "/1/indexes/indexName/synonyms/batch", diff --git a/tests/CTS/clients/search/search.json b/tests/CTS/clients/search/search.json index 0ce82a8ef1..f564f7c9c0 100644 --- a/tests/CTS/clients/search/search.json +++ b/tests/CTS/clients/search/search.json @@ -2,10 +2,12 @@ { "method": "search", "parameters": [ - "indexName", { - "$objectName": "Query", - "query": "queryString" + "indexName": "indexName", + "searchParams": { + "$objectName": "Query", + "query": "queryString" + } } ], "request": { diff --git a/tests/CTS/clients/search/searchDictionaryEntries.json b/tests/CTS/clients/search/searchDictionaryEntries.json index 24c0d7ec38..aee149fccd 100644 --- a/tests/CTS/clients/search/searchDictionaryEntries.json +++ b/tests/CTS/clients/search/searchDictionaryEntries.json @@ -3,9 +3,11 @@ "method": "searchDictionaryEntries", "testName": "get searchDictionaryEntries results with minimal parameters", "parameters": [ - "dictionaryName", { - "query": "foo" + "dictionaryName": "dictionaryName", + "searchDictionaryEntries": { + "query": "foo" + } } ], "request": { @@ -20,12 +22,14 @@ "method": "searchDictionaryEntries", "testName": "get searchDictionaryEntries results with all parameters", "parameters": [ - "dictionaryName", { - "query": "foo", - "page": 4, - "hitsPerPage": 2, - "language": "fr" + "dictionaryName": "dictionaryName", + "searchDictionaryEntries": { + "query": "foo", + "page": 4, + "hitsPerPage": 2, + "language": "fr" + } } ], "request": { diff --git a/tests/CTS/clients/search/searchForFacetValues.json b/tests/CTS/clients/search/searchForFacetValues.json index 4e02a47ade..eb90bedcfd 100644 --- a/tests/CTS/clients/search/searchForFacetValues.json +++ b/tests/CTS/clients/search/searchForFacetValues.json @@ -2,7 +2,7 @@ { "method": "searchForFacetValues", "testName": "get searchForFacetValues results with minimal parameters", - "parameters": ["indexName", "facetName"], + "parameters": [{ "indexName": "indexName", "facetName": "facetName" }], "request": { "path": "/1/indexes/indexName/facets/facetName/query", "method": "POST" @@ -12,12 +12,14 @@ "method": "searchForFacetValues", "testName": "get searchForFacetValues results with all parameters", "parameters": [ - "indexName", - "facetName", { - "params": "query=foo&facetFilters=['bar']", - "facetQuery": "foo", - "maxFacetHits": 42 + "indexName": "indexName", + "facetName": "facetName", + "searchForFacetValuesRequest": { + "params": "query=foo&facetFilters=['bar']", + "facetQuery": "foo", + "maxFacetHits": 42 + } } ], "request": { diff --git a/tests/CTS/clients/search/searchRules.json b/tests/CTS/clients/search/searchRules.json index 8417218673..3d17c9cb4f 100644 --- a/tests/CTS/clients/search/searchRules.json +++ b/tests/CTS/clients/search/searchRules.json @@ -2,13 +2,15 @@ { "method": "searchRules", "parameters": [ - "indexName", - {"query": "something"} - ], + { + "indexName": "indexName", + "searchRulesParams": { "query": "something" } + } + ], "request": { "path": "/1/indexes/indexName/rules/search", "method": "POST", - "data": {"query": "something"} + "data": { "query": "something" } } } ] diff --git a/tests/CTS/clients/search/searchSynonyms.json b/tests/CTS/clients/search/searchSynonyms.json index d3db2bdc51..e35d13a501 100644 --- a/tests/CTS/clients/search/searchSynonyms.json +++ b/tests/CTS/clients/search/searchSynonyms.json @@ -1,7 +1,13 @@ [ { "method": "searchSynonyms", - "parameters": ["indexName", "queryString", "onewaysynonym"], + "parameters": [ + { + "indexName": "indexName", + "query": "queryString", + "type": "onewaysynonym" + } + ], "request": { "path": "/1/indexes/indexName/synonyms/search", "method": "POST" diff --git a/tests/CTS/clients/search/setDictionarySettings.json b/tests/CTS/clients/search/setDictionarySettings.json index d2a7c77b4e..7d06d8d590 100644 --- a/tests/CTS/clients/search/setDictionarySettings.json +++ b/tests/CTS/clients/search/setDictionarySettings.json @@ -4,11 +4,13 @@ "testName": "get setDictionarySettings results with minimal parameters", "parameters": [ { - "disableStandardEntries": { - "plurals": { - "fr": false, - "en": false, - "ru": true + "dictionarySettingsRequest": { + "disableStandardEntries": { + "plurals": { + "fr": false, + "en": false, + "ru": true + } } } } @@ -32,17 +34,19 @@ "testName": "get setDictionarySettings results with all parameters", "parameters": [ { - "disableStandardEntries": { - "plurals": { - "fr": false, - "en": false, - "ru": true - }, - "stopwords": { - "fr": false - }, - "compounds": { - "ru": true + "dictionarySettingsRequest": { + "disableStandardEntries": { + "plurals": { + "fr": false, + "en": false, + "ru": true + }, + "stopwords": { + "fr": false + }, + "compounds": { + "ru": true + } } } } diff --git a/tests/CTS/clients/search/updateApiKey.json b/tests/CTS/clients/search/updateApiKey.json index 8c3c3ebc41..cb5a654f6c 100644 --- a/tests/CTS/clients/search/updateApiKey.json +++ b/tests/CTS/clients/search/updateApiKey.json @@ -2,12 +2,14 @@ { "method": "updateApiKey", "parameters": [ - "myApiKey", { - "acl": ["search", "addObject"], - "validity": 300, - "maxQueriesPerIPPerHour": 100, - "maxHitsPerQuery": 20 + "key": "myApiKey", + "apiKey": { + "acl": ["search", "addObject"], + "validity": 300, + "maxQueriesPerIPPerHour": 100, + "maxHitsPerQuery": 20 + } } ], "request": { diff --git a/tests/output/javascript/recommend.test.ts b/tests/output/javascript/recommend.test.ts index 68b6c7065a..5b84cb9201 100644 --- a/tests/output/javascript/recommend.test.ts +++ b/tests/output/javascript/recommend.test.ts @@ -10,14 +10,16 @@ const client = new RecommendApi( describe('getRecommendations', () => { test('get recommendations with minimal parameters', async () => { const req = await client.getRecommendations({ - requests: [ - { - indexName: 'indexName', - objectID: 'objectID', - model: 'related-products', - threshold: 42, - }, - ], + getRecommendations: { + requests: [ + { + indexName: 'indexName', + objectID: 'objectID', + model: 'related-products', + threshold: 42, + }, + ], + }, }); expect(req).toMatchObject({ path: '/1/indexes/*/recommendations', @@ -37,16 +39,18 @@ describe('getRecommendations', () => { test('get recommendations with all parameters', async () => { const req = await client.getRecommendations({ - requests: [ - { - indexName: 'indexName', - objectID: 'objectID', - model: 'related-products', - threshold: 42, - queryParameters: { facetFilters: ['query'] }, - fallbackParameters: { facetFilters: ['fallback'] }, - }, - ], + getRecommendations: { + requests: [ + { + indexName: 'indexName', + objectID: 'objectID', + model: 'related-products', + threshold: 42, + queryParameters: { facetFilters: ['query'] }, + fallbackParameters: { facetFilters: ['fallback'] }, + }, + ], + }, }); expect(req).toMatchObject({ path: '/1/indexes/*/recommendations', @@ -68,20 +72,22 @@ describe('getRecommendations', () => { test('get multiple recommendations with minimal parameters', async () => { const req = await client.getRecommendations({ - requests: [ - { - indexName: 'indexName1', - objectID: 'objectID1', - model: 'related-products', - threshold: 21, - }, - { - indexName: 'indexName2', - objectID: 'objectID2', - model: 'related-products', - threshold: 21, - }, - ], + getRecommendations: { + requests: [ + { + indexName: 'indexName1', + objectID: 'objectID1', + model: 'related-products', + threshold: 21, + }, + { + indexName: 'indexName2', + objectID: 'objectID2', + model: 'related-products', + threshold: 21, + }, + ], + }, }); expect(req).toMatchObject({ path: '/1/indexes/*/recommendations', @@ -107,24 +113,26 @@ describe('getRecommendations', () => { test('get multiple recommendations with all parameters', async () => { const req = await client.getRecommendations({ - requests: [ - { - indexName: 'indexName1', - objectID: 'objectID1', - model: 'related-products', - threshold: 21, - queryParameters: { facetFilters: ['query1'] }, - fallbackParameters: { facetFilters: ['fallback1'] }, - }, - { - indexName: 'indexName2', - objectID: 'objectID2', - model: 'related-products', - threshold: 21, - queryParameters: { facetFilters: ['query2'] }, - fallbackParameters: { facetFilters: ['fallback2'] }, - }, - ], + getRecommendations: { + requests: [ + { + indexName: 'indexName1', + objectID: 'objectID1', + model: 'related-products', + threshold: 21, + queryParameters: { facetFilters: ['query1'] }, + fallbackParameters: { facetFilters: ['fallback1'] }, + }, + { + indexName: 'indexName2', + objectID: 'objectID2', + model: 'related-products', + threshold: 21, + queryParameters: { facetFilters: ['query2'] }, + fallbackParameters: { facetFilters: ['fallback2'] }, + }, + ], + }, }); expect(req).toMatchObject({ path: '/1/indexes/*/recommendations', @@ -154,14 +162,16 @@ describe('getRecommendations', () => { test('get frequently bought together recommendations', async () => { const req = await client.getRecommendations({ - requests: [ - { - indexName: 'indexName1', - objectID: 'objectID1', - model: 'bought-together', - threshold: 42, - }, - ], + getRecommendations: { + requests: [ + { + indexName: 'indexName1', + objectID: 'objectID1', + model: 'bought-together', + threshold: 42, + }, + ], + }, }); expect(req).toMatchObject({ path: '/1/indexes/*/recommendations', diff --git a/tests/output/javascript/search.test.ts b/tests/output/javascript/search.test.ts index e648d5b19e..b0d5668e59 100644 --- a/tests/output/javascript/search.test.ts +++ b/tests/output/javascript/search.test.ts @@ -19,11 +19,11 @@ describe('getDictionarySettings', () => { describe('searchSynonyms', () => { test('searchSynonyms', async () => { - const req = await client.searchSynonyms( - 'indexName', - 'queryString', - 'onewaysynonym' - ); + const req = await client.searchSynonyms({ + indexName: 'indexName', + query: 'queryString', + type: 'onewaysynonym', + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/synonyms/search', method: 'POST', @@ -33,9 +33,9 @@ describe('searchSynonyms', () => { describe('saveSynonyms', () => { test('saveSynonyms', async () => { - const req = await client.saveSynonyms( - 'indexName', - [ + const req = await client.saveSynonyms({ + indexName: 'indexName', + synonymHit: [ { objectID: 'id1', type: 'synonym', @@ -48,9 +48,9 @@ describe('saveSynonyms', () => { synonyms: ['ephone', 'aphone', 'yphone'], }, ], - true, - false - ); + forwardToReplicas: true, + replaceExistingSynonyms: false, + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/synonyms/batch', method: 'POST', @@ -73,7 +73,10 @@ describe('saveSynonyms', () => { describe('deleteRule', () => { test('deleteRule', async () => { - const req = await client.deleteRule('indexName', 'id1'); + const req = await client.deleteRule({ + indexName: 'indexName', + objectID: 'id1', + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/rules/id1', method: 'DELETE', @@ -83,7 +86,10 @@ describe('deleteRule', () => { describe('searchForFacetValues', () => { test('get searchForFacetValues results with minimal parameters', async () => { - const req = await client.searchForFacetValues('indexName', 'facetName'); + const req = await client.searchForFacetValues({ + indexName: 'indexName', + facetName: 'facetName', + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/facets/facetName/query', method: 'POST', @@ -91,10 +97,14 @@ describe('searchForFacetValues', () => { }); test('get searchForFacetValues results with all parameters', async () => { - const req = await client.searchForFacetValues('indexName', 'facetName', { - params: "query=foo&facetFilters=['bar']", - facetQuery: 'foo', - maxFacetHits: 42, + const req = await client.searchForFacetValues({ + indexName: 'indexName', + facetName: 'facetName', + searchForFacetValuesRequest: { + params: "query=foo&facetFilters=['bar']", + facetQuery: 'foo', + maxFacetHits: 42, + }, }); expect(req).toMatchObject({ path: '/1/indexes/indexName/facets/facetName/query', @@ -110,7 +120,10 @@ describe('searchForFacetValues', () => { describe('getSynonym', () => { test('getSynonym', async () => { - const req = await client.getSynonym('indexName', 'id1'); + const req = await client.getSynonym({ + indexName: 'indexName', + objectID: 'id1', + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/synonyms/id1', method: 'GET', @@ -120,7 +133,10 @@ describe('getSynonym', () => { describe('search', () => { test('search', async () => { - const req = await client.search('indexName', { query: 'queryString' }); + const req = await client.search({ + indexName: 'indexName', + searchParams: { $objectName: 'Query', query: 'queryString' }, + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/query', method: 'POST', @@ -132,7 +148,9 @@ describe('search', () => { describe('setDictionarySettings', () => { test('get setDictionarySettings results with minimal parameters', async () => { const req = await client.setDictionarySettings({ - disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, + dictionarySettingsRequest: { + disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, + }, }); expect(req).toMatchObject({ path: '/1/dictionaries/*/settings', @@ -145,10 +163,12 @@ describe('setDictionarySettings', () => { test('get setDictionarySettings results with all parameters', async () => { const req = await client.setDictionarySettings({ - disableStandardEntries: { - plurals: { fr: false, en: false, ru: true }, - stopwords: { fr: false }, - compounds: { ru: true }, + dictionarySettingsRequest: { + disableStandardEntries: { + plurals: { fr: false, en: false, ru: true }, + stopwords: { fr: false }, + compounds: { ru: true }, + }, }, }); expect(req).toMatchObject({ @@ -167,7 +187,10 @@ describe('setDictionarySettings', () => { describe('getRule', () => { test('getRule', async () => { - const req = await client.getRule('indexName', 'id1'); + const req = await client.getRule({ + indexName: 'indexName', + objectID: 'id1', + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/rules/id1', method: 'GET', @@ -177,8 +200,9 @@ describe('getRule', () => { describe('searchDictionaryEntries', () => { test('get searchDictionaryEntries results with minimal parameters', async () => { - const req = await client.searchDictionaryEntries('dictionaryName', { - query: 'foo', + const req = await client.searchDictionaryEntries({ + dictionaryName: 'dictionaryName', + searchDictionaryEntries: { query: 'foo' }, }); expect(req).toMatchObject({ path: '/1/dictionaries/dictionaryName/search', @@ -188,11 +212,14 @@ describe('searchDictionaryEntries', () => { }); test('get searchDictionaryEntries results with all parameters', async () => { - const req = await client.searchDictionaryEntries('dictionaryName', { - query: 'foo', - page: 4, - hitsPerPage: 2, - language: 'fr', + const req = await client.searchDictionaryEntries({ + dictionaryName: 'dictionaryName', + searchDictionaryEntries: { + query: 'foo', + page: 4, + hitsPerPage: 2, + language: 'fr', + }, }); expect(req).toMatchObject({ path: '/1/dictionaries/dictionaryName/search', @@ -204,9 +231,9 @@ describe('searchDictionaryEntries', () => { describe('batchRules', () => { test('batchRules', async () => { - const req = await client.batchRules( - 'indexName', - [ + const req = await client.batchRules({ + indexName: 'indexName', + rule: [ { objectID: 'a-rule-id', conditions: [{ pattern: 'smartphone', anchoring: 'contains' }], @@ -218,9 +245,9 @@ describe('batchRules', () => { consequence: { params: { filters: 'brand:apple' } }, }, ], - true, - true - ); + forwardToReplicas: true, + clearExistingRules: true, + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/rules/batch', method: 'POST', @@ -242,11 +269,14 @@ describe('batchRules', () => { describe('updateApiKey', () => { test('updateApiKey', async () => { - const req = await client.updateApiKey('myApiKey', { - acl: ['search', 'addObject'], - validity: 300, - maxQueriesPerIPPerHour: 100, - maxHitsPerQuery: 20, + const req = await client.updateApiKey({ + key: 'myApiKey', + apiKey: { + acl: ['search', 'addObject'], + validity: 300, + maxQueriesPerIPPerHour: 100, + maxHitsPerQuery: 20, + }, }); expect(req).toMatchObject({ path: '/1/keys/myApiKey', @@ -273,7 +303,7 @@ describe('getDictionaryLanguages', () => { describe('deleteApiKey', () => { test('deleteApiKey', async () => { - const req = await client.deleteApiKey('myTestApiKey'); + const req = await client.deleteApiKey({ key: 'myTestApiKey' }); expect(req).toMatchObject({ path: '/1/keys/myTestApiKey', method: 'DELETE', @@ -283,7 +313,10 @@ describe('deleteApiKey', () => { describe('searchRules', () => { test('searchRules', async () => { - const req = await client.searchRules('indexName', { query: 'something' }); + const req = await client.searchRules({ + indexName: 'indexName', + searchRulesParams: { query: 'something' }, + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/rules/search', method: 'POST', @@ -294,7 +327,7 @@ describe('searchRules', () => { describe('clearAllSynonyms', () => { test('clearAllSynonyms', async () => { - const req = await client.clearAllSynonyms('indexName'); + const req = await client.clearAllSynonyms({ indexName: 'indexName' }); expect(req).toMatchObject({ path: '/1/indexes/indexName/synonyms/clear', method: 'POST', @@ -304,16 +337,16 @@ describe('clearAllSynonyms', () => { describe('saveRule', () => { test('saveRule', async () => { - const req = await client.saveRule( - 'indexName', - 'id1', - { + const req = await client.saveRule({ + indexName: 'indexName', + objectID: 'id1', + rule: { objectID: 'id1', conditions: [{ pattern: 'apple', anchoring: 'contains' }], consequence: { params: { filters: 'brand:apple' } }, }, - true - ); + forwardToReplicas: true, + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/rules/id1', method: 'PUT', @@ -329,11 +362,13 @@ describe('saveRule', () => { describe('addApiKey', () => { test('addApiKey', async () => { const req = await client.addApiKey({ - acl: ['search', 'addObject'], - description: 'my new api key', - validity: 300, - maxQueriesPerIPPerHour: 100, - maxHitsPerQuery: 20, + apiKey: { + acl: ['search', 'addObject'], + description: 'my new api key', + validity: 300, + maxQueriesPerIPPerHour: 100, + maxHitsPerQuery: 20, + }, }); expect(req).toMatchObject({ path: '/1/keys', @@ -351,7 +386,7 @@ describe('addApiKey', () => { describe('restoreApiKey', () => { test('restoreApiKey', async () => { - const req = await client.restoreApiKey('myApiKey'); + const req = await client.restoreApiKey({ key: 'myApiKey' }); expect(req).toMatchObject({ path: '/1/keys/myApiKey/restore', method: 'POST', @@ -361,7 +396,7 @@ describe('restoreApiKey', () => { describe('getApiKey', () => { test('getApiKey', async () => { - const req = await client.getApiKey('myTestApiKey'); + const req = await client.getApiKey({ key: 'myTestApiKey' }); expect(req).toMatchObject({ path: '/1/keys/myTestApiKey', method: 'GET', @@ -371,7 +406,7 @@ describe('getApiKey', () => { describe('browse', () => { test('get browse results with minimal parameters', async () => { - const req = await client.browse('indexName'); + const req = await client.browse({ indexName: 'indexName' }); expect(req).toMatchObject({ path: '/1/indexes/indexName/browse', method: 'POST', @@ -379,9 +414,12 @@ describe('browse', () => { }); test('get browse results with all parameters', async () => { - const req = await client.browse('indexName', { - params: "query=foo&facetFilters=['bar']", - cursor: 'cts', + const req = await client.browse({ + indexName: 'indexName', + browseRequest: { + params: "query=foo&facetFilters=['bar']", + cursor: 'cts', + }, }); expect(req).toMatchObject({ path: '/1/indexes/indexName/browse', @@ -393,7 +431,10 @@ describe('browse', () => { describe('deleteSynonym', () => { test('deleteSynonym', async () => { - const req = await client.deleteSynonym('indexName', 'id1'); + const req = await client.deleteSynonym({ + indexName: 'indexName', + objectID: 'id1', + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/synonyms/id1', method: 'DELETE', @@ -403,7 +444,7 @@ describe('deleteSynonym', () => { describe('clearRules', () => { test('clearRules', async () => { - const req = await client.clearRules('indexName'); + const req = await client.clearRules({ indexName: 'indexName' }); expect(req).toMatchObject({ path: '/1/indexes/indexName/rules/clear', method: 'POST', @@ -413,11 +454,14 @@ describe('clearRules', () => { describe('batchDictionaryEntries', () => { test('get batchDictionaryEntries results with minimal parameters', async () => { - const req = await client.batchDictionaryEntries('dictionaryName', { - requests: [ - { action: 'addEntry', body: { objectID: '1', language: 'en' } }, - { action: 'deleteEntry', body: { objectID: '2', language: 'fr' } }, - ], + const req = await client.batchDictionaryEntries({ + dictionaryName: 'dictionaryName', + batchDictionaryEntries: { + requests: [ + { action: 'addEntry', body: { objectID: '1', language: 'en' } }, + { action: 'deleteEntry', body: { objectID: '2', language: 'fr' } }, + ], + }, }); expect(req).toMatchObject({ path: '/1/dictionaries/dictionaryName/batch', @@ -432,32 +476,35 @@ describe('batchDictionaryEntries', () => { }); test('get batchDictionaryEntries results with all parameters', async () => { - const req = await client.batchDictionaryEntries('dictionaryName', { - clearExistingDictionaryEntries: false, - requests: [ - { - action: 'addEntry', - body: { - objectID: '1', - language: 'en', - word: 'yo', - words: ['yo', 'algolia'], - decomposition: ['yo', 'algolia'], - state: 'enabled', + const req = await client.batchDictionaryEntries({ + dictionaryName: 'dictionaryName', + batchDictionaryEntries: { + clearExistingDictionaryEntries: false, + requests: [ + { + action: 'addEntry', + body: { + objectID: '1', + language: 'en', + word: 'yo', + words: ['yo', 'algolia'], + decomposition: ['yo', 'algolia'], + state: 'enabled', + }, }, - }, - { - action: 'deleteEntry', - body: { - objectID: '2', - language: 'fr', - word: 'salut', - words: ['salut', 'algolia'], - decomposition: ['salut', 'algolia'], - state: 'enabled', + { + action: 'deleteEntry', + body: { + objectID: '2', + language: 'fr', + word: 'salut', + words: ['salut', 'algolia'], + decomposition: ['salut', 'algolia'], + state: 'enabled', + }, }, - }, - ], + ], + }, }); expect(req).toMatchObject({ path: '/1/dictionaries/dictionaryName/batch', @@ -505,16 +552,16 @@ describe('listApiKeys', () => { describe('saveSynonym', () => { test('saveSynonym', async () => { - const req = await client.saveSynonym( - 'indexName', - 'id1', - { + const req = await client.saveSynonym({ + indexName: 'indexName', + objectID: 'id1', + synonymHit: { objectID: 'id1', type: 'synonym', synonyms: ['car', 'vehicule', 'auto'], }, - true - ); + forwardToReplicas: true, + }); expect(req).toMatchObject({ path: '/1/indexes/indexName/synonyms/id1', method: 'PUT',