accuracy) {
- this.accuracy = accuracy;
- return this;
- }
-
- /**
- * If true, returns the details for the detected entities.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage returnEntities(Boolean returnEntities) {
- this.returnEntities = Optional.ofNullable(returnEntities);
- return this;
- }
-
- /**
- * If true, returns the details for the detected entities.
- */
- @java.lang.Override
- @JsonSetter(value = "return_entities", nulls = Nulls.SKIP)
- public _FinalStage returnEntities(Optional returnEntities) {
- this.returnEntities = returnEntities;
- return this;
- }
-
- /**
- * Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage restrictRegex(List restrictRegex) {
- this.restrictRegex = Optional.ofNullable(restrictRegex);
- return this;
- }
-
- /**
- * Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- */
- @java.lang.Override
- @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP)
- public _FinalStage restrictRegex(Optional> restrictRegex) {
- this.restrictRegex = restrictRegex;
- return this;
- }
-
- /**
- * Regular expressions to ignore when detecting entities.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage allowRegex(List allowRegex) {
- this.allowRegex = Optional.ofNullable(allowRegex);
- return this;
- }
-
- /**
- * Regular expressions to ignore when detecting entities.
- */
- @java.lang.Override
- @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP)
- public _FinalStage allowRegex(Optional> allowRegex) {
- this.allowRegex = allowRegex;
- return this;
- }
-
- @java.lang.Override
- public _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat) {
- this.deidentifyTokenFormat = Optional.ofNullable(deidentifyTokenFormat);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "deidentify_token_format", nulls = Nulls.SKIP)
- public _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat) {
- this.deidentifyTokenFormat = deidentifyTokenFormat;
- return this;
- }
-
- /**
- * Entities to detect and deidentify.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage restrictEntityTypes(List restrictEntityTypes) {
- this.restrictEntityTypes = Optional.ofNullable(restrictEntityTypes);
- return this;
- }
-
- /**
- * Entities to detect and deidentify.
- */
- @java.lang.Override
- @JsonSetter(value = "restrict_entity_types", nulls = Nulls.SKIP)
- public _FinalStage restrictEntityTypes(Optional> restrictEntityTypes) {
- this.restrictEntityTypes = restrictEntityTypes;
- return this;
- }
-
- /**
- * Will give a handle to delete the tokens generated during a specific interaction.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage sessionId(String sessionId) {
- this.sessionId = Optional.ofNullable(sessionId);
- return this;
- }
-
- /**
- * Will give a handle to delete the tokens generated during a specific interaction.
- */
- @java.lang.Override
- @JsonSetter(value = "session_id", nulls = Nulls.SKIP)
- public _FinalStage sessionId(Optional sessionId) {
- this.sessionId = sessionId;
- return this;
- }
-
- @java.lang.Override
- public DetectServiceDetectTextRequest build() {
- return new DetectServiceDetectTextRequest(
- text,
- vaultId,
- sessionId,
- restrictEntityTypes,
- deidentifyTokenFormat,
- allowRegex,
- restrictRegex,
- returnEntities,
- accuracy,
- advancedOptions,
- storeEntities,
- additionalProperties);
- }
- }
-}
diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java
deleted file mode 100644
index 8bdee935..00000000
--- a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java
+++ /dev/null
@@ -1,634 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-package com.skyflow.generated.rest.resources.deprecated.requests;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSetter;
-import com.fasterxml.jackson.annotation.Nulls;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.skyflow.generated.rest.core.ObjectMappers;
-import com.skyflow.generated.rest.types.DetectDataAccuracy;
-import com.skyflow.generated.rest.types.DetectDataEntities;
-import com.skyflow.generated.rest.types.DetectFileRequestDataType;
-import com.skyflow.generated.rest.types.DetectRequestDeidentifyOption;
-import com.skyflow.generated.rest.types.V1AdvancedOptions;
-import com.skyflow.generated.rest.types.V1AudioConfig;
-import com.skyflow.generated.rest.types.V1FileDataFormat;
-import com.skyflow.generated.rest.types.V1ImageOptions;
-import com.skyflow.generated.rest.types.V1PdfConfig;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import org.jetbrains.annotations.NotNull;
-
-@JsonInclude(JsonInclude.Include.NON_ABSENT)
-@JsonDeserialize(builder = V1DetectFileRequest.Builder.class)
-public final class V1DetectFileRequest {
- private final String file;
-
- private final V1FileDataFormat dataFormat;
-
- private final DetectFileRequestDataType inputType;
-
- private final String vaultId;
-
- private final Optional sessionId;
-
- private final Optional> restrictEntityTypes;
-
- private final Optional> allowRegex;
-
- private final Optional> restrictRegex;
-
- private final Optional returnEntities;
-
- private final Optional accuracy;
-
- private final Optional audio;
-
- private final Optional image;
-
- private final Optional pdf;
-
- private final Optional advancedOptions;
-
- private final Optional deidentifyTokenFormat;
-
- private final Map additionalProperties;
-
- private V1DetectFileRequest(
- String file,
- V1FileDataFormat dataFormat,
- DetectFileRequestDataType inputType,
- String vaultId,
- Optional sessionId,
- Optional> restrictEntityTypes,
- Optional> allowRegex,
- Optional> restrictRegex,
- Optional returnEntities,
- Optional accuracy,
- Optional audio,
- Optional image,
- Optional pdf,
- Optional advancedOptions,
- Optional deidentifyTokenFormat,
- Map additionalProperties) {
- this.file = file;
- this.dataFormat = dataFormat;
- this.inputType = inputType;
- this.vaultId = vaultId;
- this.sessionId = sessionId;
- this.restrictEntityTypes = restrictEntityTypes;
- this.allowRegex = allowRegex;
- this.restrictRegex = restrictRegex;
- this.returnEntities = returnEntities;
- this.accuracy = accuracy;
- this.audio = audio;
- this.image = image;
- this.pdf = pdf;
- this.advancedOptions = advancedOptions;
- this.deidentifyTokenFormat = deidentifyTokenFormat;
- this.additionalProperties = additionalProperties;
- }
-
- /**
- * @return Path of the file or base64-encoded data that has to be processed.
- */
- @JsonProperty("file")
- public String getFile() {
- return file;
- }
-
- @JsonProperty("data_format")
- public V1FileDataFormat getDataFormat() {
- return dataFormat;
- }
-
- @JsonProperty("input_type")
- public DetectFileRequestDataType getInputType() {
- return inputType;
- }
-
- /**
- * @return ID of the vault.
- */
- @JsonProperty("vault_id")
- public String getVaultId() {
- return vaultId;
- }
-
- /**
- * @return Will give a handle to delete the tokens generated during a specific interaction.
- */
- @JsonProperty("session_id")
- public Optional getSessionId() {
- return sessionId;
- }
-
- /**
- * @return Entities to detect and deidentify.
- */
- @JsonProperty("restrict_entity_types")
- public Optional> getRestrictEntityTypes() {
- return restrictEntityTypes;
- }
-
- /**
- * @return Regular expressions to ignore when detecting entities.
- */
- @JsonProperty("allow_regex")
- public Optional> getAllowRegex() {
- return allowRegex;
- }
-
- /**
- * @return Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- */
- @JsonProperty("restrict_regex")
- public Optional> getRestrictRegex() {
- return restrictRegex;
- }
-
- /**
- * @return If true, returns the details for the detected entities.
- */
- @JsonProperty("return_entities")
- public Optional getReturnEntities() {
- return returnEntities;
- }
-
- @JsonProperty("accuracy")
- public Optional getAccuracy() {
- return accuracy;
- }
-
- @JsonProperty("audio")
- public Optional getAudio() {
- return audio;
- }
-
- @JsonProperty("image")
- public Optional getImage() {
- return image;
- }
-
- @JsonProperty("pdf")
- public Optional getPdf() {
- return pdf;
- }
-
- @JsonProperty("advanced_options")
- public Optional getAdvancedOptions() {
- return advancedOptions;
- }
-
- @JsonProperty("deidentify_token_format")
- public Optional getDeidentifyTokenFormat() {
- return deidentifyTokenFormat;
- }
-
- @java.lang.Override
- public boolean equals(Object other) {
- if (this == other) return true;
- return other instanceof V1DetectFileRequest && equalTo((V1DetectFileRequest) other);
- }
-
- @JsonAnyGetter
- public Map getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- private boolean equalTo(V1DetectFileRequest other) {
- return file.equals(other.file)
- && dataFormat.equals(other.dataFormat)
- && inputType.equals(other.inputType)
- && vaultId.equals(other.vaultId)
- && sessionId.equals(other.sessionId)
- && restrictEntityTypes.equals(other.restrictEntityTypes)
- && allowRegex.equals(other.allowRegex)
- && restrictRegex.equals(other.restrictRegex)
- && returnEntities.equals(other.returnEntities)
- && accuracy.equals(other.accuracy)
- && audio.equals(other.audio)
- && image.equals(other.image)
- && pdf.equals(other.pdf)
- && advancedOptions.equals(other.advancedOptions)
- && deidentifyTokenFormat.equals(other.deidentifyTokenFormat);
- }
-
- @java.lang.Override
- public int hashCode() {
- return Objects.hash(
- this.file,
- this.dataFormat,
- this.inputType,
- this.vaultId,
- this.sessionId,
- this.restrictEntityTypes,
- this.allowRegex,
- this.restrictRegex,
- this.returnEntities,
- this.accuracy,
- this.audio,
- this.image,
- this.pdf,
- this.advancedOptions,
- this.deidentifyTokenFormat);
- }
-
- @java.lang.Override
- public String toString() {
- return ObjectMappers.stringify(this);
- }
-
- public static FileStage builder() {
- return new Builder();
- }
-
- public interface FileStage {
- /**
- * Path of the file or base64-encoded data that has to be processed.
- */
- DataFormatStage file(@NotNull String file);
-
- Builder from(V1DetectFileRequest other);
- }
-
- public interface DataFormatStage {
- InputTypeStage dataFormat(@NotNull V1FileDataFormat dataFormat);
- }
-
- public interface InputTypeStage {
- VaultIdStage inputType(@NotNull DetectFileRequestDataType inputType);
- }
-
- public interface VaultIdStage {
- /**
- * ID of the vault.
- */
- _FinalStage vaultId(@NotNull String vaultId);
- }
-
- public interface _FinalStage {
- V1DetectFileRequest build();
-
- /**
- * Will give a handle to delete the tokens generated during a specific interaction.
- */
- _FinalStage sessionId(Optional sessionId);
-
- _FinalStage sessionId(String sessionId);
-
- /**
- * Entities to detect and deidentify.
- */
- _FinalStage restrictEntityTypes(Optional> restrictEntityTypes);
-
- _FinalStage restrictEntityTypes(List restrictEntityTypes);
-
- /**
- * Regular expressions to ignore when detecting entities.
- */
- _FinalStage allowRegex(Optional> allowRegex);
-
- _FinalStage allowRegex(List allowRegex);
-
- /**
- * Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- */
- _FinalStage restrictRegex(Optional> restrictRegex);
-
- _FinalStage restrictRegex(List restrictRegex);
-
- /**
- * If true, returns the details for the detected entities.
- */
- _FinalStage returnEntities(Optional returnEntities);
-
- _FinalStage returnEntities(Boolean returnEntities);
-
- _FinalStage accuracy(Optional accuracy);
-
- _FinalStage accuracy(DetectDataAccuracy accuracy);
-
- _FinalStage audio(Optional audio);
-
- _FinalStage audio(V1AudioConfig audio);
-
- _FinalStage image(Optional image);
-
- _FinalStage image(V1ImageOptions image);
-
- _FinalStage pdf(Optional pdf);
-
- _FinalStage pdf(V1PdfConfig pdf);
-
- _FinalStage advancedOptions(Optional advancedOptions);
-
- _FinalStage advancedOptions(V1AdvancedOptions advancedOptions);
-
- _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat);
-
- _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat);
- }
-
- @JsonIgnoreProperties(ignoreUnknown = true)
- public static final class Builder implements FileStage, DataFormatStage, InputTypeStage, VaultIdStage, _FinalStage {
- private String file;
-
- private V1FileDataFormat dataFormat;
-
- private DetectFileRequestDataType inputType;
-
- private String vaultId;
-
- private Optional deidentifyTokenFormat = Optional.empty();
-
- private Optional advancedOptions = Optional.empty();
-
- private Optional pdf = Optional.empty();
-
- private Optional image = Optional.empty();
-
- private Optional audio = Optional.empty();
-
- private Optional accuracy = Optional.empty();
-
- private Optional returnEntities = Optional.empty();
-
- private Optional> restrictRegex = Optional.empty();
-
- private Optional> allowRegex = Optional.empty();
-
- private Optional> restrictEntityTypes = Optional.empty();
-
- private Optional sessionId = Optional.empty();
-
- @JsonAnySetter
- private Map additionalProperties = new HashMap<>();
-
- private Builder() {}
-
- @java.lang.Override
- public Builder from(V1DetectFileRequest other) {
- file(other.getFile());
- dataFormat(other.getDataFormat());
- inputType(other.getInputType());
- vaultId(other.getVaultId());
- sessionId(other.getSessionId());
- restrictEntityTypes(other.getRestrictEntityTypes());
- allowRegex(other.getAllowRegex());
- restrictRegex(other.getRestrictRegex());
- returnEntities(other.getReturnEntities());
- accuracy(other.getAccuracy());
- audio(other.getAudio());
- image(other.getImage());
- pdf(other.getPdf());
- advancedOptions(other.getAdvancedOptions());
- deidentifyTokenFormat(other.getDeidentifyTokenFormat());
- return this;
- }
-
- /**
- * Path of the file or base64-encoded data that has to be processed.Path of the file or base64-encoded data that has to be processed.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- @JsonSetter("file")
- public DataFormatStage file(@NotNull String file) {
- this.file = Objects.requireNonNull(file, "file must not be null");
- return this;
- }
-
- @java.lang.Override
- @JsonSetter("data_format")
- public InputTypeStage dataFormat(@NotNull V1FileDataFormat dataFormat) {
- this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null");
- return this;
- }
-
- @java.lang.Override
- @JsonSetter("input_type")
- public VaultIdStage inputType(@NotNull DetectFileRequestDataType inputType) {
- this.inputType = Objects.requireNonNull(inputType, "inputType must not be null");
- return this;
- }
-
- /**
- * ID of the vault.ID of the vault.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- @JsonSetter("vault_id")
- public _FinalStage vaultId(@NotNull String vaultId) {
- this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null");
- return this;
- }
-
- @java.lang.Override
- public _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat) {
- this.deidentifyTokenFormat = Optional.ofNullable(deidentifyTokenFormat);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "deidentify_token_format", nulls = Nulls.SKIP)
- public _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat) {
- this.deidentifyTokenFormat = deidentifyTokenFormat;
- return this;
- }
-
- @java.lang.Override
- public _FinalStage advancedOptions(V1AdvancedOptions advancedOptions) {
- this.advancedOptions = Optional.ofNullable(advancedOptions);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "advanced_options", nulls = Nulls.SKIP)
- public _FinalStage advancedOptions(Optional advancedOptions) {
- this.advancedOptions = advancedOptions;
- return this;
- }
-
- @java.lang.Override
- public _FinalStage pdf(V1PdfConfig pdf) {
- this.pdf = Optional.ofNullable(pdf);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "pdf", nulls = Nulls.SKIP)
- public _FinalStage pdf(Optional pdf) {
- this.pdf = pdf;
- return this;
- }
-
- @java.lang.Override
- public _FinalStage image(V1ImageOptions image) {
- this.image = Optional.ofNullable(image);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "image", nulls = Nulls.SKIP)
- public _FinalStage image(Optional image) {
- this.image = image;
- return this;
- }
-
- @java.lang.Override
- public _FinalStage audio(V1AudioConfig audio) {
- this.audio = Optional.ofNullable(audio);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "audio", nulls = Nulls.SKIP)
- public _FinalStage audio(Optional audio) {
- this.audio = audio;
- return this;
- }
-
- @java.lang.Override
- public _FinalStage accuracy(DetectDataAccuracy accuracy) {
- this.accuracy = Optional.ofNullable(accuracy);
- return this;
- }
-
- @java.lang.Override
- @JsonSetter(value = "accuracy", nulls = Nulls.SKIP)
- public _FinalStage accuracy(Optional accuracy) {
- this.accuracy = accuracy;
- return this;
- }
-
- /**
- * If true, returns the details for the detected entities.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage returnEntities(Boolean returnEntities) {
- this.returnEntities = Optional.ofNullable(returnEntities);
- return this;
- }
-
- /**
- * If true, returns the details for the detected entities.
- */
- @java.lang.Override
- @JsonSetter(value = "return_entities", nulls = Nulls.SKIP)
- public _FinalStage returnEntities(Optional returnEntities) {
- this.returnEntities = returnEntities;
- return this;
- }
-
- /**
- * Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage restrictRegex(List restrictRegex) {
- this.restrictRegex = Optional.ofNullable(restrictRegex);
- return this;
- }
-
- /**
- * Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- */
- @java.lang.Override
- @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP)
- public _FinalStage restrictRegex(Optional> restrictRegex) {
- this.restrictRegex = restrictRegex;
- return this;
- }
-
- /**
- * Regular expressions to ignore when detecting entities.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage allowRegex(List allowRegex) {
- this.allowRegex = Optional.ofNullable(allowRegex);
- return this;
- }
-
- /**
- * Regular expressions to ignore when detecting entities.
- */
- @java.lang.Override
- @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP)
- public _FinalStage allowRegex(Optional> allowRegex) {
- this.allowRegex = allowRegex;
- return this;
- }
-
- /**
- * Entities to detect and deidentify.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage restrictEntityTypes(List restrictEntityTypes) {
- this.restrictEntityTypes = Optional.ofNullable(restrictEntityTypes);
- return this;
- }
-
- /**
- * Entities to detect and deidentify.
- */
- @java.lang.Override
- @JsonSetter(value = "restrict_entity_types", nulls = Nulls.SKIP)
- public _FinalStage restrictEntityTypes(Optional> restrictEntityTypes) {
- this.restrictEntityTypes = restrictEntityTypes;
- return this;
- }
-
- /**
- * Will give a handle to delete the tokens generated during a specific interaction.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage sessionId(String sessionId) {
- this.sessionId = Optional.ofNullable(sessionId);
- return this;
- }
-
- /**
- * Will give a handle to delete the tokens generated during a specific interaction.
- */
- @java.lang.Override
- @JsonSetter(value = "session_id", nulls = Nulls.SKIP)
- public _FinalStage sessionId(Optional sessionId) {
- this.sessionId = sessionId;
- return this;
- }
-
- @java.lang.Override
- public V1DetectFileRequest build() {
- return new V1DetectFileRequest(
- file,
- dataFormat,
- inputType,
- vaultId,
- sessionId,
- restrictEntityTypes,
- allowRegex,
- restrictRegex,
- returnEntities,
- accuracy,
- audio,
- image,
- pdf,
- advancedOptions,
- deidentifyTokenFormat,
- additionalProperties);
- }
- }
-}
diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java
index 48692d9f..782d2d2b 100644
--- a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java
+++ b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java
@@ -15,8 +15,10 @@
import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest;
import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest;
import com.skyflow.generated.rest.resources.files.requests.GetRunRequest;
+import com.skyflow.generated.rest.resources.files.requests.ReidentifyFileRequest;
import com.skyflow.generated.rest.types.DeidentifyFileResponse;
import com.skyflow.generated.rest.types.DeidentifyStatusResponse;
+import com.skyflow.generated.rest.types.ReidentifyFileResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncFilesClient {
@@ -185,4 +187,19 @@ public CompletableFuture getRun(
String runId, GetRunRequest request, RequestOptions requestOptions) {
return this.rawClient.getRun(runId, request, requestOptions).thenApply(response -> response.body());
}
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public CompletableFuture reidentifyFile(ReidentifyFileRequest request) {
+ return this.rawClient.reidentifyFile(request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public CompletableFuture reidentifyFile(
+ ReidentifyFileRequest request, RequestOptions requestOptions) {
+ return this.rawClient.reidentifyFile(request, requestOptions).thenApply(response -> response.body());
+ }
}
diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java
index f400bb2a..4672288a 100644
--- a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java
+++ b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java
@@ -26,9 +26,11 @@
import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest;
import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest;
import com.skyflow.generated.rest.resources.files.requests.GetRunRequest;
+import com.skyflow.generated.rest.resources.files.requests.ReidentifyFileRequest;
import com.skyflow.generated.rest.types.DeidentifyFileResponse;
import com.skyflow.generated.rest.types.DeidentifyStatusResponse;
import com.skyflow.generated.rest.types.ErrorResponse;
+import com.skyflow.generated.rest.types.ReidentifyFileResponse;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
@@ -926,4 +928,92 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
});
return future;
}
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public CompletableFuture> reidentifyFile(
+ ReidentifyFileRequest request) {
+ return reidentifyFile(request, null);
+ }
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public CompletableFuture> reidentifyFile(
+ ReidentifyFileRequest request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/detect/reidentify/file")
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ApiClientException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ if (response.isSuccessful()) {
+ future.complete(new ApiClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), ReidentifyFileResponse.class),
+ response));
+ return;
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 401:
+ future.completeExceptionally(new UnauthorizedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 500:
+ future.completeExceptionally(new InternalServerError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ future.completeExceptionally(new ApiClientApiException(
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ } catch (IOException e) {
+ future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
}
diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java
index 89898d41..5eee1560 100644
--- a/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java
+++ b/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java
@@ -15,8 +15,10 @@
import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest;
import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest;
import com.skyflow.generated.rest.resources.files.requests.GetRunRequest;
+import com.skyflow.generated.rest.resources.files.requests.ReidentifyFileRequest;
import com.skyflow.generated.rest.types.DeidentifyFileResponse;
import com.skyflow.generated.rest.types.DeidentifyStatusResponse;
+import com.skyflow.generated.rest.types.ReidentifyFileResponse;
public class FilesClient {
protected final ClientOptions clientOptions;
@@ -177,4 +179,18 @@ public DeidentifyStatusResponse getRun(String runId, GetRunRequest request) {
public DeidentifyStatusResponse getRun(String runId, GetRunRequest request, RequestOptions requestOptions) {
return this.rawClient.getRun(runId, request, requestOptions).body();
}
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public ReidentifyFileResponse reidentifyFile(ReidentifyFileRequest request) {
+ return this.rawClient.reidentifyFile(request).body();
+ }
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public ReidentifyFileResponse reidentifyFile(ReidentifyFileRequest request, RequestOptions requestOptions) {
+ return this.rawClient.reidentifyFile(request, requestOptions).body();
+ }
}
diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java
index 85939625..d0fb0bfc 100644
--- a/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java
+++ b/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java
@@ -26,9 +26,11 @@
import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest;
import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest;
import com.skyflow.generated.rest.resources.files.requests.GetRunRequest;
+import com.skyflow.generated.rest.resources.files.requests.ReidentifyFileRequest;
import com.skyflow.generated.rest.types.DeidentifyFileResponse;
import com.skyflow.generated.rest.types.DeidentifyStatusResponse;
import com.skyflow.generated.rest.types.ErrorResponse;
+import com.skyflow.generated.rest.types.ReidentifyFileResponse;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
@@ -711,4 +713,71 @@ public ApiClientHttpResponse getRun(
throw new ApiClientException("Network error executing HTTP request", e);
}
}
+
+ /**
+ * Re-identifies tokens in a file.
+ */
+ public ApiClientHttpResponse