diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AppendSourceResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AppendSourceResponse.java
new file mode 100644
index 0000000000..cbd8b08f6a
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AppendSourceResponse.java
@@ -0,0 +1,77 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.time.OffsetDateTime;
+import java.util.Objects;
+
+/** AppendSourceResponse */
+public class AppendSourceResponse {
+
+ public static final String SERIALIZED_NAME_CREATED_AT = "createdAt";
+
+ @SerializedName(SERIALIZED_NAME_CREATED_AT)
+ private OffsetDateTime createdAt;
+
+ public AppendSourceResponse createdAt(OffsetDateTime createdAt) {
+ this.createdAt = createdAt;
+ return this;
+ }
+
+ /**
+ * Date of creation (ISO-8601 format).
+ *
+ * @return createdAt
+ */
+ @javax.annotation.Nonnull
+ @ApiModelProperty(
+ required = true,
+ value = "Date of creation (ISO-8601 format)."
+ )
+ public OffsetDateTime getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(OffsetDateTime createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AppendSourceResponse appendSourceResponse = (AppendSourceResponse) o;
+ return Objects.equals(this.createdAt, appendSourceResponse.createdAt);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(createdAt);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class AppendSourceResponse {\n");
+ sb
+ .append(" createdAt: ")
+ .append(toIndentedString(createdAt))
+ .append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java
new file mode 100644
index 0000000000..18ccd3412c
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSourceResponse.java
@@ -0,0 +1,77 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.time.OffsetDateTime;
+import java.util.Objects;
+
+/** DeleteSourceResponse */
+public class DeleteSourceResponse {
+
+ public static final String SERIALIZED_NAME_DELETED_AT = "deletedAt";
+
+ @SerializedName(SERIALIZED_NAME_DELETED_AT)
+ private OffsetDateTime deletedAt;
+
+ public DeleteSourceResponse deletedAt(OffsetDateTime deletedAt) {
+ this.deletedAt = deletedAt;
+ return this;
+ }
+
+ /**
+ * Date of deletion (ISO-8601 format).
+ *
+ * @return deletedAt
+ */
+ @javax.annotation.Nonnull
+ @ApiModelProperty(
+ required = true,
+ 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;
+ }
+ DeleteSourceResponse deleteSourceResponse = (DeleteSourceResponse) o;
+ return Objects.equals(this.deletedAt, deleteSourceResponse.deletedAt);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(deletedAt);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class DeleteSourceResponse {\n");
+ sb
+ .append(" deletedAt: ")
+ .append(toIndentedString(deletedAt))
+ .append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java
new file mode 100644
index 0000000000..5b1d6d9e79
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ReplaceSourceResponse.java
@@ -0,0 +1,77 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.time.OffsetDateTime;
+import java.util.Objects;
+
+/** ReplaceSourceResponse */
+public class ReplaceSourceResponse {
+
+ public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt";
+
+ @SerializedName(SERIALIZED_NAME_UPDATED_AT)
+ private OffsetDateTime updatedAt;
+
+ public ReplaceSourceResponse updatedAt(OffsetDateTime updatedAt) {
+ this.updatedAt = updatedAt;
+ return this;
+ }
+
+ /**
+ * Date of last update (ISO-8601 format).
+ *
+ * @return updatedAt
+ */
+ @javax.annotation.Nonnull
+ @ApiModelProperty(
+ required = true,
+ 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;
+ }
+ ReplaceSourceResponse replaceSourceResponse = (ReplaceSourceResponse) o;
+ return Objects.equals(this.updatedAt, replaceSourceResponse.updatedAt);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(updatedAt);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ReplaceSourceResponse {\n");
+ sb
+ .append(" updatedAt: ")
+ .append(toIndentedString(updatedAt))
+ .append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java
new file mode 100644
index 0000000000..b1eb087440
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Source.java
@@ -0,0 +1,108 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.Objects;
+
+/** The source. */
+@ApiModel(description = "The source.")
+public class Source {
+
+ public static final String SERIALIZED_NAME_SOURCE = "source";
+
+ @SerializedName(SERIALIZED_NAME_SOURCE)
+ private String source;
+
+ public static final String SERIALIZED_NAME_DESCRIPTION = "description";
+
+ @SerializedName(SERIALIZED_NAME_DESCRIPTION)
+ private String description;
+
+ public Source source(String source) {
+ this.source = source;
+ return this;
+ }
+
+ /**
+ * The IP range of the source.
+ *
+ * @return source
+ */
+ @javax.annotation.Nonnull
+ @ApiModelProperty(
+ example = "10.0.0.1/32",
+ required = true,
+ value = "The IP range of the source."
+ )
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public Source description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * The description of the source.
+ *
+ * @return description
+ */
+ @javax.annotation.Nullable
+ @ApiModelProperty(value = "The description of the source.")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Source source = (Source) o;
+ return (
+ Objects.equals(this.source, source.source) &&
+ Objects.equals(this.description, source.description)
+ );
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(source, description);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Source {\n");
+ sb.append(" source: ").append(toIndentedString(source)).append("\n");
+ sb
+ .append(" description: ")
+ .append(toIndentedString(description))
+ .append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java
index 1e797f5f82..0b4e10f137 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
@@ -7,6 +7,7 @@
import com.algolia.Pair;
import com.algolia.model.AddApiKeyResponse;
import com.algolia.model.ApiKey;
+import com.algolia.model.AppendSourceResponse;
import com.algolia.model.AssignUserIdObject;
import com.algolia.model.AssignUserIdResponse;
import com.algolia.model.BatchAssignUserIdsObject;
@@ -16,6 +17,7 @@
import com.algolia.model.ClearAllSynonymsResponse;
import com.algolia.model.DeleteApiKeyResponse;
import com.algolia.model.DeleteIndexResponse;
+import com.algolia.model.DeleteSourceResponse;
import com.algolia.model.DeleteSynonymResponse;
import com.algolia.model.GetLogsResponse;
import com.algolia.model.GetTaskResponse;
@@ -32,6 +34,7 @@
import com.algolia.model.OperationIndexObject;
import com.algolia.model.OperationIndexResponse;
import com.algolia.model.RemoveUserIdResponse;
+import com.algolia.model.ReplaceSourceResponse;
import com.algolia.model.SaveObjectResponse;
import com.algolia.model.SaveSynonymResponse;
import com.algolia.model.SaveSynonymsResponse;
@@ -41,6 +44,7 @@
import com.algolia.model.SearchUserIdsObject;
import com.algolia.model.SearchUserIdsResponse;
import com.algolia.model.SetSettingsResponse;
+import com.algolia.model.Source;
import com.algolia.model.SynonymHit;
import com.algolia.model.UpdateApiKeyResponse;
import com.algolia.model.UserId;
@@ -203,6 +207,145 @@ public okhttp3.Call addApiKeyAsync(
return localVarCall;
}
+ /**
+ * Build call for appendSource
+ *
+ * @param source The source to add. (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call appendSourceCall(
+ Source source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ Object localVarPostBody = source;
+
+ // create path and map variables
+ String localVarPath = "/1/security/sources/append";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = { "application/json" };
+ final String localVarAccept = this.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = { "application/json" };
+ final String localVarContentType =
+ this.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "apiKey", "appId" };
+ return this.buildCall(
+ localVarPath,
+ "POST",
+ localVarQueryParams,
+ localVarCollectionQueryParams,
+ localVarPostBody,
+ localVarHeaderParams,
+ localVarCookieParams,
+ localVarFormParams,
+ localVarAuthNames,
+ _callback
+ );
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call appendSourceValidateBeforeCall(
+ Source source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ // verify the required parameter 'source' is set
+ if (source == null) {
+ throw new ApiException(
+ "Missing the required parameter 'source' when calling appendSource(Async)"
+ );
+ }
+
+ okhttp3.Call localVarCall = appendSourceCall(source, _callback);
+ return localVarCall;
+ }
+
+ /**
+ * Add a single source to the list of allowed sources.
+ *
+ * @param source The source to add. (required)
+ * @return AppendSourceResponse
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public AppendSourceResponse appendSource(Source source) throws ApiException {
+ ApiResponse localVarResp = appendSourceWithHttpInfo(
+ source
+ );
+ return localVarResp.getData();
+ }
+
+ /**
+ * Add a single source to the list of allowed sources.
+ *
+ * @param source The source to add. (required)
+ * @return ApiResponse<AppendSourceResponse>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public ApiResponse appendSourceWithHttpInfo(
+ Source source
+ ) throws ApiException {
+ okhttp3.Call localVarCall = appendSourceValidateBeforeCall(source, null);
+ Type localVarReturnType = new TypeToken() {}
+ .getType();
+ return this.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * (asynchronously) Add a single source to the list of allowed sources.
+ *
+ * @param source The source to add. (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call appendSourceAsync(
+ Source source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ okhttp3.Call localVarCall = appendSourceValidateBeforeCall(
+ source,
+ _callback
+ );
+ Type localVarReturnType = new TypeToken() {}
+ .getType();
+ this.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
+
/**
* Build call for assignUserId
*
@@ -1279,6 +1422,150 @@ public okhttp3.Call deleteIndexAsync(
return localVarCall;
}
+ /**
+ * Build call for deleteSource
+ *
+ * @param source The IP range of the source. (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call deleteSourceCall(
+ String source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath =
+ "/1/security/sources/{source}".replaceAll(
+ "\\{" + "source" + "\\}",
+ this.escapeString(source.toString())
+ );
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = { "application/json" };
+ final String localVarAccept = this.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {};
+
+ final String localVarContentType =
+ this.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "apiKey", "appId" };
+ return this.buildCall(
+ localVarPath,
+ "DELETE",
+ localVarQueryParams,
+ localVarCollectionQueryParams,
+ localVarPostBody,
+ localVarHeaderParams,
+ localVarCookieParams,
+ localVarFormParams,
+ localVarAuthNames,
+ _callback
+ );
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call deleteSourceValidateBeforeCall(
+ String source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ // verify the required parameter 'source' is set
+ if (source == null) {
+ throw new ApiException(
+ "Missing the required parameter 'source' when calling deleteSource(Async)"
+ );
+ }
+
+ okhttp3.Call localVarCall = deleteSourceCall(source, _callback);
+ return localVarCall;
+ }
+
+ /**
+ * Remove a single source from the list of allowed sources.
+ *
+ * @param source The IP range of the source. (required)
+ * @return DeleteSourceResponse
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public DeleteSourceResponse deleteSource(String source) throws ApiException {
+ ApiResponse localVarResp = deleteSourceWithHttpInfo(
+ source
+ );
+ return localVarResp.getData();
+ }
+
+ /**
+ * Remove a single source from the list of allowed sources.
+ *
+ * @param source The IP range of the source. (required)
+ * @return ApiResponse<DeleteSourceResponse>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public ApiResponse deleteSourceWithHttpInfo(
+ String source
+ ) throws ApiException {
+ okhttp3.Call localVarCall = deleteSourceValidateBeforeCall(source, null);
+ Type localVarReturnType = new TypeToken() {}
+ .getType();
+ return this.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * (asynchronously) Remove a single source from the list of allowed sources.
+ *
+ * @param source The IP range of the source. (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call deleteSourceAsync(
+ String source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ okhttp3.Call localVarCall = deleteSourceValidateBeforeCall(
+ source,
+ _callback
+ );
+ Type localVarReturnType = new TypeToken() {}
+ .getType();
+ this.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
+
/**
* Build call for deleteSynonym
*
@@ -2028,6 +2315,123 @@ public okhttp3.Call getSettingsAsync(
return localVarCall;
}
+ /**
+ * Build call for getSources
+ *
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call getSourcesCall(final ApiCallback _callback)
+ throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/1/security/sources";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = { "application/json" };
+ final String localVarAccept = this.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {};
+
+ final String localVarContentType =
+ this.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "apiKey", "appId" };
+ return this.buildCall(
+ localVarPath,
+ "GET",
+ localVarQueryParams,
+ localVarCollectionQueryParams,
+ localVarPostBody,
+ localVarHeaderParams,
+ localVarCookieParams,
+ localVarFormParams,
+ localVarAuthNames,
+ _callback
+ );
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call getSourcesValidateBeforeCall(
+ final ApiCallback _callback
+ ) throws ApiException {
+ okhttp3.Call localVarCall = getSourcesCall(_callback);
+ return localVarCall;
+ }
+
+ /**
+ * List all allowed sources.
+ *
+ * @return List<Source>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public List getSources() throws ApiException {
+ ApiResponse> localVarResp = getSourcesWithHttpInfo();
+ return localVarResp.getData();
+ }
+
+ /**
+ * List all allowed sources.
+ *
+ * @return ApiResponse<List<Source>>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public ApiResponse> getSourcesWithHttpInfo()
+ throws ApiException {
+ okhttp3.Call localVarCall = getSourcesValidateBeforeCall(null);
+ Type localVarReturnType = new TypeToken>() {}.getType();
+ return this.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * (asynchronously) List all allowed sources.
+ *
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call getSourcesAsync(
+ final ApiCallback> _callback
+ ) throws ApiException {
+ okhttp3.Call localVarCall = getSourcesValidateBeforeCall(_callback);
+ Type localVarReturnType = new TypeToken>() {}.getType();
+ this.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
+
/**
* Build call for getSynonym
*
@@ -4002,6 +4406,146 @@ public okhttp3.Call removeUserIdAsync(
return localVarCall;
}
+ /**
+ * Build call for replaceSources
+ *
+ * @param source The sources to allow. (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call replaceSourcesCall(
+ List source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ Object localVarPostBody = source;
+
+ // create path and map variables
+ String localVarPath = "/1/security/sources";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = { "application/json" };
+ final String localVarAccept = this.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = { "application/json" };
+ final String localVarContentType =
+ this.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "apiKey", "appId" };
+ return this.buildCall(
+ localVarPath,
+ "PUT",
+ localVarQueryParams,
+ localVarCollectionQueryParams,
+ localVarPostBody,
+ localVarHeaderParams,
+ localVarCookieParams,
+ localVarFormParams,
+ localVarAuthNames,
+ _callback
+ );
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call replaceSourcesValidateBeforeCall(
+ List source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ // verify the required parameter 'source' is set
+ if (source == null) {
+ throw new ApiException(
+ "Missing the required parameter 'source' when calling replaceSources(Async)"
+ );
+ }
+
+ okhttp3.Call localVarCall = replaceSourcesCall(source, _callback);
+ return localVarCall;
+ }
+
+ /**
+ * Replace all allowed sources.
+ *
+ * @param source The sources to allow. (required)
+ * @return ReplaceSourceResponse
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public ReplaceSourceResponse replaceSources(List source)
+ throws ApiException {
+ ApiResponse localVarResp = replaceSourcesWithHttpInfo(
+ source
+ );
+ return localVarResp.getData();
+ }
+
+ /**
+ * Replace all allowed sources.
+ *
+ * @param source The sources to allow. (required)
+ * @return ApiResponse<ReplaceSourceResponse>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
+ * response body
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public ApiResponse replaceSourcesWithHttpInfo(
+ List source
+ ) throws ApiException {
+ okhttp3.Call localVarCall = replaceSourcesValidateBeforeCall(source, null);
+ Type localVarReturnType = new TypeToken() {}
+ .getType();
+ return this.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * (asynchronously) Replace all allowed sources.
+ *
+ * @param source The sources to allow. (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+ *
+ *
Status Code
Description
Response Headers
+ *
200
OK
-
+ *
+ */
+ public okhttp3.Call replaceSourcesAsync(
+ List source,
+ final ApiCallback _callback
+ ) throws ApiException {
+ okhttp3.Call localVarCall = replaceSourcesValidateBeforeCall(
+ source,
+ _callback
+ );
+ Type localVarReturnType = new TypeToken() {}
+ .getType();
+ this.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
+
/**
* Build call for restoreApiKey
*
diff --git a/clients/algoliasearch-client-javascript/client-search/model/appendSourceResponse.ts b/clients/algoliasearch-client-javascript/client-search/model/appendSourceResponse.ts
new file mode 100644
index 0000000000..698eb57260
--- /dev/null
+++ b/clients/algoliasearch-client-javascript/client-search/model/appendSourceResponse.ts
@@ -0,0 +1,6 @@
+export type AppendSourceResponse = {
+ /**
+ * Date of creation (ISO-8601 format).
+ */
+ createdAt: Date;
+};
diff --git a/clients/algoliasearch-client-javascript/client-search/model/deleteSourceResponse.ts b/clients/algoliasearch-client-javascript/client-search/model/deleteSourceResponse.ts
new file mode 100644
index 0000000000..8025072619
--- /dev/null
+++ b/clients/algoliasearch-client-javascript/client-search/model/deleteSourceResponse.ts
@@ -0,0 +1,6 @@
+export type DeleteSourceResponse = {
+ /**
+ * Date of deletion (ISO-8601 format).
+ */
+ deletedAt: Date;
+};
diff --git a/clients/algoliasearch-client-javascript/client-search/model/models.ts b/clients/algoliasearch-client-javascript/client-search/model/models.ts
index e763aed2a7..cb84373b1a 100644
--- a/clients/algoliasearch-client-javascript/client-search/model/models.ts
+++ b/clients/algoliasearch-client-javascript/client-search/model/models.ts
@@ -3,6 +3,7 @@ import type { RequestOptions } from '../utils/types';
export * from './addApiKeyResponse';
export * from './apiKey';
+export * from './appendSourceResponse';
export * from './assignUserIdObject';
export * from './assignUserIdResponse';
export * from './baseIndexSettings';
@@ -17,6 +18,7 @@ export * from './clearAllSynonymsResponse';
export * from './createdAtObject';
export * from './deleteApiKeyResponse';
export * from './deleteIndexResponse';
+export * from './deleteSourceResponse';
export * from './deleteSynonymResponse';
export * from './errorBase';
export * from './getLogsResponse';
@@ -44,6 +46,7 @@ export * from './rankingInfo';
export * from './rankingInfoMatchedGeoLocation';
export * from './record';
export * from './removeUserIdResponse';
+export * from './replaceSourceResponse';
export * from './saveObjectResponse';
export * from './saveSynonymResponse';
export * from './saveSynonymsResponse';
@@ -58,6 +61,7 @@ export * from './searchUserIdsResponseHighlightResult';
export * from './searchUserIdsResponseHits';
export * from './setSettingsResponse';
export * from './snippetResult';
+export * from './source';
export * from './synonymHit';
export * from './synonymHitHighlightResult';
export * from './updateApiKeyResponse';
diff --git a/clients/algoliasearch-client-javascript/client-search/model/replaceSourceResponse.ts b/clients/algoliasearch-client-javascript/client-search/model/replaceSourceResponse.ts
new file mode 100644
index 0000000000..7a9b660965
--- /dev/null
+++ b/clients/algoliasearch-client-javascript/client-search/model/replaceSourceResponse.ts
@@ -0,0 +1,6 @@
+export type ReplaceSourceResponse = {
+ /**
+ * Date of last update (ISO-8601 format).
+ */
+ updatedAt: Date;
+};
diff --git a/clients/algoliasearch-client-javascript/client-search/model/source.ts b/clients/algoliasearch-client-javascript/client-search/model/source.ts
new file mode 100644
index 0000000000..79813c184a
--- /dev/null
+++ b/clients/algoliasearch-client-javascript/client-search/model/source.ts
@@ -0,0 +1,13 @@
+/**
+ * The source.
+ */
+export type Source = {
+ /**
+ * The IP range of the source.
+ */
+ source: string;
+ /**
+ * The description of the source.
+ */
+ description?: string;
+};
diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts
index 1f53782079..ca724d260a 100644
--- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts
+++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts
@@ -1,5 +1,6 @@
import type { AddApiKeyResponse } from '../model/addApiKeyResponse';
import type { ApiKey } from '../model/apiKey';
+import type { AppendSourceResponse } from '../model/appendSourceResponse';
import type { AssignUserIdObject } from '../model/assignUserIdObject';
import type { AssignUserIdResponse } from '../model/assignUserIdResponse';
import type { BatchAssignUserIdsObject } from '../model/batchAssignUserIdsObject';
@@ -9,6 +10,7 @@ import type { BatchResponse } from '../model/batchResponse';
import type { ClearAllSynonymsResponse } from '../model/clearAllSynonymsResponse';
import type { DeleteApiKeyResponse } from '../model/deleteApiKeyResponse';
import type { DeleteIndexResponse } from '../model/deleteIndexResponse';
+import type { DeleteSourceResponse } from '../model/deleteSourceResponse';
import type { DeleteSynonymResponse } from '../model/deleteSynonymResponse';
import type { GetLogsResponse } from '../model/getLogsResponse';
import type { GetTaskResponse } from '../model/getTaskResponse';
@@ -26,6 +28,7 @@ import type { MultipleQueriesResponse } from '../model/multipleQueriesResponse';
import type { OperationIndexObject } from '../model/operationIndexObject';
import type { OperationIndexResponse } from '../model/operationIndexResponse';
import type { RemoveUserIdResponse } from '../model/removeUserIdResponse';
+import type { ReplaceSourceResponse } from '../model/replaceSourceResponse';
import type { SaveObjectResponse } from '../model/saveObjectResponse';
import type { SaveSynonymResponse } from '../model/saveSynonymResponse';
import type { SaveSynonymsResponse } from '../model/saveSynonymsResponse';
@@ -36,6 +39,7 @@ import type { SearchSynonymsResponse } from '../model/searchSynonymsResponse';
import type { SearchUserIdsObject } from '../model/searchUserIdsObject';
import type { SearchUserIdsResponse } from '../model/searchUserIdsResponse';
import type { SetSettingsResponse } from '../model/setSettingsResponse';
+import type { Source } from '../model/source';
import type { SynonymHit } from '../model/synonymHit';
import type { UpdateApiKeyResponse } from '../model/updateApiKeyResponse';
import type { UserId } from '../model/userId';
@@ -164,6 +168,35 @@ export class SearchApi {
return this.sendRequest(request, requestOptions);
}
+ /**
+ * Add a single source to the list of allowed sources.
+ *
+ * @param source - The source to add.
+ */
+ appendSource(source: Source): Promise {
+ const path = '/1/security/sources/append';
+ const headers: Headers = { Accept: 'application/json' };
+ const queryParameters: Record = {};
+
+ if (source === null || source === undefined) {
+ throw new Error(
+ 'Required parameter source was null or undefined when calling appendSource.'
+ );
+ }
+
+ const request: Request = {
+ method: 'POST',
+ path,
+ data: source,
+ };
+
+ const requestOptions: RequestOptions = {
+ headers,
+ queryParameters,
+ };
+
+ return this.sendRequest(request, requestOptions);
+ }
/**
* 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.
*
@@ -398,6 +431,37 @@ export class SearchApi {
return this.sendRequest(request, requestOptions);
}
+ /**
+ * Remove a single source from the list of allowed sources.
+ *
+ * @param source - The IP range of the source.
+ */
+ deleteSource(source: string): Promise {
+ const path = '/1/security/sources/{source}'.replace(
+ '{source}',
+ encodeURIComponent(String(source))
+ );
+ const headers: Headers = { Accept: 'application/json' };
+ const queryParameters: Record = {};
+
+ if (source === null || source === undefined) {
+ throw new Error(
+ 'Required parameter source was null or undefined when calling deleteSource.'
+ );
+ }
+
+ const request: Request = {
+ method: 'DELETE',
+ path,
+ };
+
+ const requestOptions: RequestOptions = {
+ headers,
+ queryParameters,
+ };
+
+ return this.sendRequest(request, requestOptions);
+ }
/**
* Delete a single synonyms set, identified by the given objectID.
*
@@ -554,6 +618,26 @@ export class SearchApi {
return this.sendRequest(request, requestOptions);
}
+ /**
+ * List all allowed sources.
+ */
+ getSources(): Promise {
+ const path = '/1/security/sources';
+ const headers: Headers = { Accept: 'application/json' };
+ const queryParameters: Record = {};
+
+ const request: Request = {
+ method: 'GET',
+ path,
+ };
+
+ const requestOptions: RequestOptions = {
+ headers,
+ queryParameters,
+ };
+
+ return this.sendRequest(request, requestOptions);
+ }
/**
* Fetch a synonym object identified by its objectID.
*
@@ -924,6 +1008,35 @@ export class SearchApi {
return this.sendRequest(request, requestOptions);
}
+ /**
+ * Replace all allowed sources.
+ *
+ * @param source - The sources to allow.
+ */
+ replaceSources(source: Source[]): Promise {
+ const path = '/1/security/sources';
+ const headers: Headers = { Accept: 'application/json' };
+ const queryParameters: Record = {};
+
+ if (source === null || source === undefined) {
+ throw new Error(
+ 'Required parameter source was null or undefined when calling replaceSources.'
+ );
+ }
+
+ const request: Request = {
+ method: 'PUT',
+ path,
+ data: source,
+ };
+
+ const requestOptions: RequestOptions = {
+ headers,
+ queryParameters,
+ };
+
+ return this.sendRequest(request, requestOptions);
+ }
/**
* Restore a deleted API key, along with its associated rights.
*
diff --git a/specs/search/paths/vault/appendSource.yml b/specs/search/paths/vault/appendSource.yml
index 6adb517bf4..8c439bc1cc 100644
--- a/specs/search/paths/vault/appendSource.yml
+++ b/specs/search/paths/vault/appendSource.yml
@@ -1 +1,26 @@
post:
+ tags:
+ - search
+ operationId: appendSource
+ description: Add a single source to the list of allowed sources.
+ requestBody:
+ required: true
+ description: The source to add.
+ content:
+ application/json:
+ schema:
+ $ref: 'common/schemas.yml#/source'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ title: appendSourceResponse
+ type: object
+ additionalProperties: false
+ required:
+ - createdAt
+ properties:
+ createdAt:
+ $ref: '../../../common/parameters.yml#/createdAt'
diff --git a/specs/search/paths/vault/common/schemas.yml b/specs/search/paths/vault/common/schemas.yml
new file mode 100644
index 0000000000..88aaae8826
--- /dev/null
+++ b/specs/search/paths/vault/common/schemas.yml
@@ -0,0 +1,17 @@
+sources:
+ description: A list of sources.
+ items:
+ $ref: '#/source'
+
+source:
+ description: The source.
+ required:
+ - source
+ properties:
+ source:
+ description: The IP range of the source.
+ type: string
+ example: '10.0.0.1/32'
+ description:
+ description: The description of the source.
+ type: string
diff --git a/specs/search/paths/vault/deleteSource.yml b/specs/search/paths/vault/deleteSource.yml
index ac5790e8f8..1d003d263f 100644
--- a/specs/search/paths/vault/deleteSource.yml
+++ b/specs/search/paths/vault/deleteSource.yml
@@ -1 +1,27 @@
delete:
+ tags:
+ - search
+ operationId: deleteSource
+ description: Remove a single source from the list of allowed sources.
+ parameters:
+ - name: source
+ in: path
+ required: true
+ description: The IP range of the source.
+ schema:
+ type: string
+ example: '10.0.0.1/32'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ title: deleteSourceResponse
+ type: object
+ additionalProperties: false
+ required:
+ - deletedAt
+ properties:
+ deletedAt:
+ $ref: '../../../common/parameters.yml#/deletedAt'
diff --git a/specs/search/paths/vault/vaultSources.yml b/specs/search/paths/vault/vaultSources.yml
index 7f2769e14e..48cf7fdf25 100644
--- a/specs/search/paths/vault/vaultSources.yml
+++ b/specs/search/paths/vault/vaultSources.yml
@@ -1,2 +1,39 @@
get:
+ tags:
+ - search
+ operationId: getSources
+ description: List all allowed sources.
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: './common/schemas.yml#/sources'
+
put:
+ tags:
+ - search
+ operationId: replaceSources
+ description: Replace all allowed sources.
+ requestBody:
+ required: true
+ description: The sources to allow.
+ content:
+ application/json:
+ schema:
+ $ref: './common/schemas.yml#/sources'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ title: replaceSourceResponse
+ type: object
+ additionalProperties: false
+ required:
+ - updatedAt
+ properties:
+ updatedAt:
+ $ref: '../../../common/parameters.yml#/updatedAt'
diff --git a/specs/search/spec.yml b/specs/search/spec.yml
index da2be73e2f..c8d19a52ec 100644
--- a/specs/search/spec.yml
+++ b/specs/search/spec.yml
@@ -120,12 +120,12 @@ paths:
# #######################
# ### Vault Endpoints ###
# #######################
- # /1/security/sources:
- # $ref: './paths/vault/vaultSources.yml'
- # /1/security/sources/append:
- # $ref: './paths/vault/appendSource.yml'
- # /1/security/sources/{source}:
- # $ref: './paths/vault/deleteSource.yml'
+ /1/security/sources:
+ $ref: './paths/vault/vaultSources.yml'
+ /1/security/sources/append:
+ $ref: './paths/vault/appendSource.yml'
+ /1/security/sources/{source}:
+ $ref: './paths/vault/deleteSource.yml'
# ##########################
# ### Advanced Endpoints ###