diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index b30cc27f..d68c1671 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -7,9 +7,10 @@ jobs: uses: ./.github/workflows/shared-build-and-deploy.yml with: ref: ${{ github.ref_name }} - server-id: ossrh + server-id: central profile: maven-central tag: 'beta' + module: 'v3' secrets: server-username: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_USERNAME }} server-password: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_PASSWORD }} @@ -17,4 +18,4 @@ jobs: gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} skyflow-credentials: ${{ secrets.SKYFLOW_CREDENTIALS }} >> .env test-expired-token: ${{ secrets.TEST_EXPIRED_TOKEN }} >> .env - test-reusable-token: ${{ secrets.TEST_REUSABLE_TOKEN }} >> .env + test-reusable-token: ${{ secrets.TEST_REUSABLE_TOKEN }} >> .env \ No newline at end of file diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index e8b8ee61..ce1145b3 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -1,4 +1,4 @@ -name: Publish package to the JFROG Artifactory +name: Publish v3 module to the JFROG Artifactory on: push: tags-ignore: @@ -6,16 +6,17 @@ on: paths-ignore: - "*.md" branches: - - release/* + - v3-release/* jobs: - build-and-deploy: + build-and-deploy-v3: uses: ./.github/workflows/shared-build-and-deploy.yml with: ref: ${{ github.ref_name }} server-id: central profile: jfrog tag: 'internal' + module: 'v3' secrets: server-username: ${{ secrets.ARTIFACTORY_USERNAME }} server-password: ${{ secrets.ARTIFACTORY_PASSWORD }} @@ -23,4 +24,4 @@ jobs: gpg-passphrase: ${{ secrets.JFROG_GPG_PASSPHRASE }} skyflow-credentials: ${{ secrets.SKYFLOW_CREDENTIALS }} >> .env test-expired-token: ${{ secrets.TEST_EXPIRED_TOKEN }} >> .env - test-reusable-token: ${{ secrets.TEST_REUSABLE_TOKEN }} >> .env + test-reusable-token: ${{ secrets.TEST_REUSABLE_TOKEN }} >> .env \ No newline at end of file diff --git a/.github/workflows/shared-build-and-deploy.yml b/.github/workflows/shared-build-and-deploy.yml index c9cadd2c..fc576766 100644 --- a/.github/workflows/shared-build-and-deploy.yml +++ b/.github/workflows/shared-build-and-deploy.yml @@ -21,6 +21,13 @@ on: description: 'Release Tag' required: true type: string + + module: + description: 'Module to build and publish' + required: false + type: string + default: '' + secrets: server-username: required: true @@ -54,7 +61,7 @@ jobs: - name: Set up maven or jfrog repository uses: actions/setup-java@v1 with: - java-version: "1.8" + java-version: "11" distribution: "adopt" server-id: ${{ inputs.server-id }} server-username: SERVER_USERNAME @@ -87,7 +94,7 @@ jobs: if ${{ inputs.tag == 'internal' }}; then ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")" else - ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" + ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "" "${{ inputs.module }}" fi - name: Commit changes @@ -99,7 +106,7 @@ jobs: git checkout ${{ env.branch_name }} fi - git add pom.xml + git add v3/pom.xml if [[ "${{ inputs.tag }}" == "internal" ]]; then git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev-$(git rev-parse --short $GITHUB_SHA)" git push origin ${{ github.ref_name }} -f @@ -125,9 +132,14 @@ jobs: json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} - name: Publish package - run: mvn --batch-mode deploy -P ${{ inputs.profile }} + run: | + if [[ "${{ inputs.tag }}" == "internal" ]]; then + mvn --batch-mode -pl ${{ inputs.module }} -am deploy -P jfrog + elif [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then + mvn --batch-mode -pl ${{ inputs.module }} -am deploy -P ${{ inputs.profile }} + fi env: SERVER_USERNAME: ${{ secrets.server-username }} SERVER_PASSWORD: ${{ secrets.server-password }} - GPG_PASSPHRASE: ${{ secrets.gpg-passphrase }} + GPG_PASSPHRASE: ${{ secrets.gpg-passphrase }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d5a178d4..5d871d11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .idea -target \ No newline at end of file +target + +**/dependency-reduced-pom.xml +.env diff --git a/common/pom.xml b/common/pom.xml new file mode 100644 index 00000000..a18bd86f --- /dev/null +++ b/common/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + com.skyflow + skyflow + 1.0.0 + ../pom.xml + + + common + 1.0.0 + + + + 8 + 8 + UTF-8 + + \ No newline at end of file diff --git a/common/src/main/java/com/skyflow/BaseSkyflow.java b/common/src/main/java/com/skyflow/BaseSkyflow.java new file mode 100644 index 00000000..9a117a16 --- /dev/null +++ b/common/src/main/java/com/skyflow/BaseSkyflow.java @@ -0,0 +1,48 @@ +package com.skyflow; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.LogLevel; +import com.skyflow.logs.InfoLogs; +import com.skyflow.utils.BaseUtils; +import com.skyflow.utils.logger.LogUtil; + +import java.util.LinkedHashMap; + +class BaseSkyflow { + private final BaseSkyflowClientBuilder builder; + + protected BaseSkyflow(BaseSkyflowClientBuilder builder) { + this.builder = builder; + } + + public LogLevel getLogLevel() { + return this.builder.logLevel; + } + + public VaultConfig getVaultConfig() { + Object[] array = this.builder.vaultConfigMap.values().toArray(); + return (VaultConfig) array[0]; + } + + static class BaseSkyflowClientBuilder { + protected final LinkedHashMap vaultConfigMap; + protected Credentials skyflowCredentials; + protected LogLevel logLevel; + + protected BaseSkyflowClientBuilder() { + this.vaultConfigMap = new LinkedHashMap<>(); + this.skyflowCredentials = null; + this.logLevel = LogLevel.ERROR; + } + + public BaseSkyflowClientBuilder setLogLevel(LogLevel logLevel) { + this.logLevel = logLevel == null ? LogLevel.ERROR : logLevel; + LogUtil.setupLogger(this.logLevel); + LogUtil.printInfoLog(BaseUtils.parameterizedString( + InfoLogs.CURRENT_LOG_LEVEL.getLog(), String.valueOf(logLevel) + )); + return this; + } + } +} diff --git a/src/main/java/com/skyflow/config/Credentials.java b/common/src/main/java/com/skyflow/config/Credentials.java similarity index 80% rename from src/main/java/com/skyflow/config/Credentials.java rename to common/src/main/java/com/skyflow/config/Credentials.java index f1865dc7..7f2d6c8c 100644 --- a/src/main/java/com/skyflow/config/Credentials.java +++ b/common/src/main/java/com/skyflow/config/Credentials.java @@ -2,7 +2,7 @@ import java.util.ArrayList; -public class Credentials { +public class Credentials implements Cloneable { private String path; private ArrayList roles; private String context; @@ -63,4 +63,13 @@ public String getApiKey() { public void setApiKey(String apiKey) { this.apiKey = apiKey; } + + @Override + public Object clone() throws CloneNotSupportedException { + Credentials cloned = (Credentials) super.clone(); + if (this.roles != null) { + cloned.roles = new ArrayList<>(this.roles); + } + return cloned; + } } diff --git a/src/main/java/com/skyflow/config/VaultConfig.java b/common/src/main/java/com/skyflow/config/VaultConfig.java similarity index 74% rename from src/main/java/com/skyflow/config/VaultConfig.java rename to common/src/main/java/com/skyflow/config/VaultConfig.java index 4f61af2a..8797e2bd 100644 --- a/src/main/java/com/skyflow/config/VaultConfig.java +++ b/common/src/main/java/com/skyflow/config/VaultConfig.java @@ -2,7 +2,7 @@ import com.skyflow.enums.Env; -public class VaultConfig { +public class VaultConfig implements Cloneable { private String vaultId; private String clusterId; private Env env; @@ -46,4 +46,13 @@ public Credentials getCredentials() { public void setCredentials(Credentials credentials) { this.credentials = credentials; } + + @Override + public Object clone() throws CloneNotSupportedException { + VaultConfig cloned = (VaultConfig) super.clone(); + if (this.credentials != null) { + cloned.credentials = (Credentials) this.credentials.clone(); + } + return cloned; + } } diff --git a/src/main/java/com/skyflow/enums/Env.java b/common/src/main/java/com/skyflow/enums/Env.java similarity index 100% rename from src/main/java/com/skyflow/enums/Env.java rename to common/src/main/java/com/skyflow/enums/Env.java diff --git a/src/main/java/com/skyflow/enums/InterfaceName.java b/common/src/main/java/com/skyflow/enums/InterfaceName.java similarity index 100% rename from src/main/java/com/skyflow/enums/InterfaceName.java rename to common/src/main/java/com/skyflow/enums/InterfaceName.java diff --git a/src/main/java/com/skyflow/enums/LogLevel.java b/common/src/main/java/com/skyflow/enums/LogLevel.java similarity index 100% rename from src/main/java/com/skyflow/enums/LogLevel.java rename to common/src/main/java/com/skyflow/enums/LogLevel.java diff --git a/src/main/java/com/skyflow/errors/ErrorCode.java b/common/src/main/java/com/skyflow/errors/ErrorCode.java similarity index 100% rename from src/main/java/com/skyflow/errors/ErrorCode.java rename to common/src/main/java/com/skyflow/errors/ErrorCode.java diff --git a/src/main/java/com/skyflow/errors/ErrorMessage.java b/common/src/main/java/com/skyflow/errors/ErrorMessage.java similarity index 93% rename from src/main/java/com/skyflow/errors/ErrorMessage.java rename to common/src/main/java/com/skyflow/errors/ErrorMessage.java index df075bca..f4b2ce7b 100644 --- a/src/main/java/com/skyflow/errors/ErrorMessage.java +++ b/common/src/main/java/com/skyflow/errors/ErrorMessage.java @@ -1,11 +1,12 @@ package com.skyflow.errors; -import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; public enum ErrorMessage { // Client initialization VaultIdAlreadyInConfigList("%s0 Validation error. VaultId is present in an existing config. Specify a new vaultId in config."), VaultIdNotInConfigList("%s0 Validation error. VaultId is missing from the config. Specify the vaultIds from configs."), + OnlySingleVaultConfigAllowed("%s0 Validation error. A vault config already exists. Cannot add another vault config."), ConnectionIdAlreadyInConfigList("%s0 Validation error. ConnectionId is present in an existing config. Specify a connectionId in config."), ConnectionIdNotInConfigList("%s0 Validation error. ConnectionId is missing from the config. Specify the connectionIds from configs."), EmptyCredentials("%s0 Validation error. Invalid credentials. Credentials must not be empty."), @@ -51,6 +52,7 @@ public enum ErrorMessage { JwtDecodeError("%s0 Validation error. Invalid access token. Verify your credentials."), MissingAccessToken("%s0 Validation error. Access token not present in the response from bearer token generation. Verify your credentials."), MissingTokenType("%s0 Validation error. Token type not present in the response from bearer token generation. Verify your credentials."), + BearerTokenExpired("%s0 Validation error. Bearer token is invalid or expired. Please provide a valid bearer token."), // Insert TableKeyError("%s0 Validation error. 'table' key is missing from the payload. Specify a 'table' key."), @@ -145,15 +147,24 @@ public enum ErrorMessage { FailedToDecodeFileFromResponse("%s0 Failed to decode the file from the response. Ensure the response is valid and try again."), EmptyFileAndFilePathInDeIdentifyFile("%s0 Validation error. Both file and filePath are empty. Specify either file object or filePath, not both."), PollingForResultsFailed("%s0 API error. Polling for results failed. Unable to retrieve the deidentified file"), - FailedtoSaveProcessedFile("%s0 Validation error. Failed to save the processed file. Ensure the output directory is valid and writable."), + FailedToSaveProcessedFile("%s0 Validation error. Failed to save the processed file. Ensure the output directory is valid and writable."), InvalidAudioFileType("%s0 Validation error. The file type is not supported. Specify a valid file type mp3 or wav."), // Generic - ErrorOccurred("%s0 API error. Error occurred.") + ErrorOccurred("%s0 API error. Error occurred."), + + DetokenizeRequestNull("%s0 Validation error. DetokenizeRequest object is null. Specify a valid DetokenizeRequest object."), + + NullTokenGroupRedactions("%s0 Validation error. TokenGroupRedaction in the list is null. Specify a valid TokenGroupRedactions object."), + + NullRedactionInTokenGroup("%s0 Validation error. Redaction in TokenGroupRedactions is null or empty. Specify a valid redaction."), + + NullTokenGroupNameInTokenGroup("%s0 Validation error. TokenGroupName in TokenGroupRedactions is null or empty. Specify a valid tokenGroupName."), + ; ; private final String message; ErrorMessage(String message) { - this.message = message.replace("%s0", Constants.SDK_PREFIX); + this.message = message.replace("%s0", SdkVersion.getSdkPrefix()); } public String getMessage() { diff --git a/src/main/java/com/skyflow/errors/HttpStatus.java b/common/src/main/java/com/skyflow/errors/HttpStatus.java similarity index 100% rename from src/main/java/com/skyflow/errors/HttpStatus.java rename to common/src/main/java/com/skyflow/errors/HttpStatus.java diff --git a/src/main/java/com/skyflow/errors/SkyflowException.java b/common/src/main/java/com/skyflow/errors/SkyflowException.java similarity index 96% rename from src/main/java/com/skyflow/errors/SkyflowException.java rename to common/src/main/java/com/skyflow/errors/SkyflowException.java index 32c71f39..138fcc68 100644 --- a/src/main/java/com/skyflow/errors/SkyflowException.java +++ b/common/src/main/java/com/skyflow/errors/SkyflowException.java @@ -4,7 +4,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.skyflow.utils.Constants; +import com.skyflow.utils.BaseConstants; import java.util.List; import java.util.Map; @@ -70,7 +70,7 @@ public String getRequestId() { } private void setRequestId(Map> responseHeaders) { - List ids = responseHeaders.get(Constants.REQUEST_ID_HEADER_KEY); + List ids = responseHeaders.get(BaseConstants.REQUEST_ID_HEADER_KEY); this.requestId = ids == null ? null : ids.get(0); } @@ -99,7 +99,7 @@ public JsonArray getDetails() { private void setDetails(Map> responseHeaders) { JsonElement detailsElement = ((JsonObject) responseBody.get("error")).get("details"); - List errorFromClientHeader = responseHeaders.get(Constants.ERROR_FROM_CLIENT_HEADER_KEY); + List errorFromClientHeader = responseHeaders.get(BaseConstants.ERROR_FROM_CLIENT_HEADER_KEY); if (detailsElement != null) { this.details = detailsElement.getAsJsonArray(); } diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/ApiClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/ApiClient.java new file mode 100644 index 00000000..721942e9 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/ApiClient.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest; + +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.Suppliers; +import com.skyflow.generated.auth.rest.resources.authentication.AuthenticationClient; +import java.util.function.Supplier; + +public class ApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier authenticationClient; + + public ApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.authenticationClient = Suppliers.memoize(() -> new AuthenticationClient(clientOptions)); + } + + public AuthenticationClient authentication() { + return this.authenticationClient.get(); + } + + public static ApiClientBuilder builder() { + return new ApiClientBuilder(); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/ApiClientBuilder.java b/common/src/main/java/com/skyflow/generated/auth/rest/ApiClientBuilder.java new file mode 100644 index 00000000..aed3ed24 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/ApiClientBuilder.java @@ -0,0 +1,67 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest; + +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.Environment; +import okhttp3.OkHttpClient; + +public final class ApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String token = null; + + private Environment environment = Environment.PRODUCTION; + + /** + * Sets token + */ + public ApiClientBuilder token(String token) { + this.token = token; + return this; + } + + public ApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public ApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public ApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public ApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public ApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public ApiClient build() { + if (token == null) { + throw new RuntimeException("Please provide token"); + } + this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token); + clientOptionsBuilder.environment(this.environment); + return new ApiClient(clientOptionsBuilder.build()); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/AsyncApiClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/AsyncApiClient.java new file mode 100644 index 00000000..674a9ef9 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/AsyncApiClient.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest; + +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.Suppliers; +import com.skyflow.generated.auth.rest.resources.authentication.AsyncAuthenticationClient; +import java.util.function.Supplier; + +public class AsyncApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier authenticationClient; + + public AsyncApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.authenticationClient = Suppliers.memoize(() -> new AsyncAuthenticationClient(clientOptions)); + } + + public AsyncAuthenticationClient authentication() { + return this.authenticationClient.get(); + } + + public static AsyncApiClientBuilder builder() { + return new AsyncApiClientBuilder(); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/AsyncApiClientBuilder.java b/common/src/main/java/com/skyflow/generated/auth/rest/AsyncApiClientBuilder.java new file mode 100644 index 00000000..2e30d45a --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/AsyncApiClientBuilder.java @@ -0,0 +1,67 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest; + +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.Environment; +import okhttp3.OkHttpClient; + +public final class AsyncApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String token = null; + + private Environment environment = Environment.PRODUCTION; + + /** + * Sets token + */ + public AsyncApiClientBuilder token(String token) { + this.token = token; + return this; + } + + public AsyncApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public AsyncApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public AsyncApiClient build() { + if (token == null) { + throw new RuntimeException("Please provide token"); + } + this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token); + clientOptionsBuilder.environment(this.environment); + return new AsyncApiClient(clientOptionsBuilder.build()); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientApiException.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientApiException.java new file mode 100644 index 00000000..dc4c008c --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class ApiClientApiException extends ApiClientException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public ApiClientApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public ApiClientApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @java.lang.Override + public String toString() { + return "ApiClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body + + "}"; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientException.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientException.java new file mode 100644 index 00000000..f08afa2e --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class ApiClientException extends RuntimeException { + public ApiClientException(String message) { + super(message); + } + + public ApiClientException(String message, Exception e) { + super(message, e); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientHttpResponse.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientHttpResponse.java new file mode 100644 index 00000000..733c056c --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ApiClientHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class ApiClientHttpResponse { + + private final T body; + + private final Map> headers; + + public ApiClientHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ClientOptions.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ClientOptions.java new file mode 100644 index 00000000..4dd049dd --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ClientOptions.java @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.skyflow.generated.rest.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.279"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions(environment, headers, headerSuppliers, httpClient, this.timeout.get()); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/DateTimeDeserializer.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/DateTimeDeserializer.java new file mode 100644 index 00000000..a5a2fbe8 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/Environment.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/Environment.java new file mode 100644 index 00000000..098667c0 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/Environment.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +public final class Environment { + public static final Environment PRODUCTION = new Environment("https://manage.skyflowapis.com"); + + public static final Environment SANDBOX = new Environment("https://manage.skyflowapis-preview.com"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/FileStream.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/FileStream.java new file mode 100644 index 00000000..b1aad352 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/InputStreamRequestBody.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/InputStreamRequestBody.java new file mode 100644 index 00000000..22b17b14 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/MediaTypes.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/MediaTypes.java new file mode 100644 index 00000000..d4374647 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/Nullable.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/Nullable.java new file mode 100644 index 00000000..efabe806 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/NullableNonemptyFilter.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/NullableNonemptyFilter.java new file mode 100644 index 00000000..dd32d66c --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/NullableNonemptyFilter.java @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + return o instanceof Optional && !((Optional) o).isPresent(); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ObjectMappers.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ObjectMappers.java new file mode 100644 index 00000000..ee160b93 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/QueryStringMapper.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/QueryStringMapper.java new file mode 100644 index 00000000..b35c7174 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/RequestOptions.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/RequestOptions.java new file mode 100644 index 00000000..b70c02df --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/RequestOptions.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String token; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private RequestOptions( + String token, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers) { + this.token = token; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.token != null) { + headers.put("Authorization", "Bearer " + this.token); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String token = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder token(String token) { + this.token = token; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions(token, timeout, timeoutTimeUnit, headers, headerSuppliers); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ResponseBodyInputStream.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ResponseBodyInputStream.java new file mode 100644 index 00000000..5bb66b4a --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/ResponseBodyReader.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/ResponseBodyReader.java new file mode 100644 index 00000000..e3052b4c --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/RetryInterceptor.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/RetryInterceptor.java new file mode 100644 index 00000000..93e86644 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/Stream.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/Stream.java new file mode 100644 index 00000000..4a984faa --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/Stream.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable { + /** + * The {@link Class} of the objects in the stream. + */ + private final Class valueType; + /** + * The {@link Scanner} used for reading from the input stream and blocking when needed during iteration. + */ + private final Scanner scanner; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.valueType = valueType; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + return new Iterator() { + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + /** + * Removing elements from {@code Stream} is not supported. + * + * @throws UnsupportedOperationException Always, as removal is not supported. + */ + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/Suppliers.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/Suppliers.java new file mode 100644 index 00000000..d3ab5e53 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/BadRequestError.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/BadRequestError.java new file mode 100644 index 00000000..ec08ddf2 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/BadRequestError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.errors; + +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import java.util.Map; +import okhttp3.Response; + +public final class BadRequestError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final Map body; + + public BadRequestError(Map body) { + super("BadRequestError", 400, body); + this.body = body; + } + + public BadRequestError(Map body, Response rawResponse) { + super("BadRequestError", 400, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Map body() { + return this.body; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/HttpStatus.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/HttpStatus.java new file mode 100644 index 00000000..2e1c45d2 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/HttpStatus.java @@ -0,0 +1,15 @@ +package com.skyflow.generated.auth.rest.errors; + +public enum HttpStatus { + BAD_REQUEST("Bad Request"); + + private final String httpStatus; + + HttpStatus(String httpStatus) { + this.httpStatus = httpStatus; + } + + public String getHttpStatus() { + return httpStatus; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/NotFoundError.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/NotFoundError.java new file mode 100644 index 00000000..b889e1b0 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/NotFoundError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.errors; + +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import java.util.Map; +import okhttp3.Response; + +public final class NotFoundError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final Map body; + + public NotFoundError(Map body) { + super("NotFoundError", 404, body); + this.body = body; + } + + public NotFoundError(Map body, Response rawResponse) { + super("NotFoundError", 404, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Map body() { + return this.body; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/UnauthorizedError.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/UnauthorizedError.java new file mode 100644 index 00000000..40ea9c25 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/UnauthorizedError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.errors; + +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import java.util.Map; +import okhttp3.Response; + +public final class UnauthorizedError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final Map body; + + public UnauthorizedError(Map body) { + super("UnauthorizedError", 401, body); + this.body = body; + } + + public UnauthorizedError(Map body, Response rawResponse) { + super("UnauthorizedError", 401, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Map body() { + return this.body; + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncAuthenticationClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncAuthenticationClient.java new file mode 100644 index 00000000..e75fad24 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncAuthenticationClient.java @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.resources.authentication; + +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.RequestOptions; +import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse; +import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest; + +import java.util.concurrent.CompletableFuture; + +public class AsyncAuthenticationClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAuthenticationClient rawClient; + + public AsyncAuthenticationClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAuthenticationClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAuthenticationClient withRawResponse() { + return this.rawClient; + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public CompletableFuture authenticationServiceGetAuthToken(V1GetAuthTokenRequest request) { + return this.rawClient.authenticationServiceGetAuthToken(request).thenApply(response -> response.body()); + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public CompletableFuture authenticationServiceGetAuthToken( + V1GetAuthTokenRequest request, RequestOptions requestOptions) { + return this.rawClient + .authenticationServiceGetAuthToken(request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncRawAuthenticationClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncRawAuthenticationClient.java new file mode 100644 index 00000000..61ff4335 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncRawAuthenticationClient.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.resources.authentication; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.skyflow.generated.auth.rest.errors.BadRequestError; +import com.skyflow.generated.auth.rest.errors.NotFoundError; +import com.skyflow.generated.auth.rest.errors.UnauthorizedError; +import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse; +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import com.skyflow.generated.auth.rest.core.ApiClientException; +import com.skyflow.generated.auth.rest.core.ApiClientHttpResponse; +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.MediaTypes; +import com.skyflow.generated.auth.rest.core.ObjectMappers; +import com.skyflow.generated.auth.rest.core.RequestOptions; + +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAuthenticationClient { + protected final ClientOptions clientOptions; + + public AsyncRawAuthenticationClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public CompletableFuture> authenticationServiceGetAuthToken( + V1GetAuthTokenRequest request) { + return authenticationServiceGetAuthToken(request, null); + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public CompletableFuture> authenticationServiceGetAuthToken( + V1GetAuthTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/auth/sa/oauth/token") + .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(), V1GetAuthTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + 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/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AuthenticationClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AuthenticationClient.java new file mode 100644 index 00000000..a0ba860a --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AuthenticationClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.resources.authentication; + +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.RequestOptions; +import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse; + +public class AuthenticationClient { + protected final ClientOptions clientOptions; + + private final RawAuthenticationClient rawClient; + + public AuthenticationClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAuthenticationClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAuthenticationClient withRawResponse() { + return this.rawClient; + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public V1GetAuthTokenResponse authenticationServiceGetAuthToken(V1GetAuthTokenRequest request) { + return this.rawClient.authenticationServiceGetAuthToken(request).body(); + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public V1GetAuthTokenResponse authenticationServiceGetAuthToken( + V1GetAuthTokenRequest request, RequestOptions requestOptions) { + return this.rawClient + .authenticationServiceGetAuthToken(request, requestOptions) + .body(); + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/RawAuthenticationClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/RawAuthenticationClient.java new file mode 100644 index 00000000..f3211ad1 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/RawAuthenticationClient.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.resources.authentication; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.skyflow.generated.auth.rest.errors.BadRequestError; +import com.skyflow.generated.auth.rest.errors.NotFoundError; +import com.skyflow.generated.auth.rest.errors.UnauthorizedError; +import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse; +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import com.skyflow.generated.auth.rest.core.ApiClientException; +import com.skyflow.generated.auth.rest.core.ApiClientHttpResponse; +import com.skyflow.generated.auth.rest.core.ClientOptions; +import com.skyflow.generated.auth.rest.core.MediaTypes; +import com.skyflow.generated.auth.rest.core.ObjectMappers; +import com.skyflow.generated.auth.rest.core.RequestOptions; +import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest; + +import java.io.IOException; +import java.util.Map; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAuthenticationClient { + protected final ClientOptions clientOptions; + + public RawAuthenticationClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public ApiClientHttpResponse authenticationServiceGetAuthToken( + V1GetAuthTokenRequest request) { + return authenticationServiceGetAuthToken(request, null); + } + + /** + *

<p>Generates a Bearer Token to authenticate with Skyflow. This method doesn't require the <code>Authorization</code> header.</p><p><b>Note:</b> For recommended ways to authenticate, see <a href='/api-authentication/'>API authentication</a>.</p>

+ */ + public ApiClientHttpResponse authenticationServiceGetAuthToken( + V1GetAuthTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/auth/sa/oauth/token") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), V1GetAuthTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/requests/V1GetAuthTokenRequest.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java rename to common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/requests/V1GetAuthTokenRequest.java index 8c4961b1..cd1d22c1 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java +++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/requests/V1GetAuthTokenRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.skyflow.generated.rest.resources.authentication.requests; +package com.skyflow.generated.auth.rest.resources.authentication.requests; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -11,7 +11,8 @@ 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.auth.rest.core.ObjectMappers; + import java.util.HashMap; import java.util.Map; import java.util.Objects; diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/types/GooglerpcStatus.java b/common/src/main/java/com/skyflow/generated/auth/rest/types/GooglerpcStatus.java new file mode 100644 index 00000000..06a9373c --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/types/GooglerpcStatus.java @@ -0,0 +1,144 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.types; + +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.auth.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GooglerpcStatus.Builder.class) +public final class GooglerpcStatus { + private final Optional code; + + private final Optional message; + + private final Optional> details; + + private final Map additionalProperties; + + private GooglerpcStatus( + Optional code, + Optional message, + Optional> details, + Map additionalProperties) { + this.code = code; + this.message = message; + this.details = details; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("code") + public Optional getCode() { + return code; + } + + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @JsonProperty("details") + public Optional> getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GooglerpcStatus && equalTo((GooglerpcStatus) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GooglerpcStatus other) { + return code.equals(other.code) && message.equals(other.message) && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional> details = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GooglerpcStatus other) { + code(other.getCode()); + message(other.getMessage()); + details(other.getDetails()); + return this; + } + + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(Integer code) { + this.code = Optional.ofNullable(code); + return this; + } + + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional> details) { + this.details = details; + return this; + } + + public Builder details(List details) { + this.details = Optional.ofNullable(details); + return this; + } + + public GooglerpcStatus build() { + return new GooglerpcStatus(code, message, details, additionalProperties); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/types/ProtobufAny.java b/common/src/main/java/com/skyflow/generated/auth/rest/types/ProtobufAny.java new file mode 100644 index 00000000..6f5df772 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/types/ProtobufAny.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.types; + +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.auth.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProtobufAny.Builder.class) +public final class ProtobufAny { + private final Optional type; + + private final Map additionalProperties; + + private ProtobufAny(Optional type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("@type") + public Optional getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProtobufAny && equalTo((ProtobufAny) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProtobufAny other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProtobufAny other) { + type(other.getType()); + return this; + } + + @JsonSetter(value = "@type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + public ProtobufAny build() { + return new ProtobufAny(type, additionalProperties); + } + } +} diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/types/V1GetAuthTokenResponse.java b/common/src/main/java/com/skyflow/generated/auth/rest/types/V1GetAuthTokenResponse.java new file mode 100644 index 00000000..3c10fbd3 --- /dev/null +++ b/common/src/main/java/com/skyflow/generated/auth/rest/types/V1GetAuthTokenResponse.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.auth.rest.types; + +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.auth.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1GetAuthTokenResponse.Builder.class) +public final class V1GetAuthTokenResponse { + private final Optional accessToken; + + private final Optional tokenType; + + private final Map additionalProperties; + + private V1GetAuthTokenResponse( + Optional accessToken, Optional tokenType, Map additionalProperties) { + this.accessToken = accessToken; + this.tokenType = tokenType; + this.additionalProperties = additionalProperties; + } + + /** + * @return AccessToken. + */ + @JsonProperty("accessToken") + public Optional getAccessToken() { + return accessToken; + } + + /** + * @return TokenType : Bearer. + */ + @JsonProperty("tokenType") + public Optional getTokenType() { + return tokenType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1GetAuthTokenResponse && equalTo((V1GetAuthTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1GetAuthTokenResponse other) { + return accessToken.equals(other.accessToken) && tokenType.equals(other.tokenType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessToken, this.tokenType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accessToken = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1GetAuthTokenResponse other) { + accessToken(other.getAccessToken()); + tokenType(other.getTokenType()); + return this; + } + + /** + *

AccessToken.

+ */ + @JsonSetter(value = "accessToken", nulls = Nulls.SKIP) + public Builder accessToken(Optional accessToken) { + this.accessToken = accessToken; + return this; + } + + public Builder accessToken(String accessToken) { + this.accessToken = Optional.ofNullable(accessToken); + return this; + } + + /** + *

TokenType : Bearer.

+ */ + @JsonSetter(value = "tokenType", nulls = Nulls.SKIP) + public Builder tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + public Builder tokenType(String tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + public V1GetAuthTokenResponse build() { + return new V1GetAuthTokenResponse(accessToken, tokenType, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/logs/ErrorLogs.java b/common/src/main/java/com/skyflow/logs/ErrorLogs.java similarity index 93% rename from src/main/java/com/skyflow/logs/ErrorLogs.java rename to common/src/main/java/com/skyflow/logs/ErrorLogs.java index 3415860c..8f1156fd 100644 --- a/src/main/java/com/skyflow/logs/ErrorLogs.java +++ b/common/src/main/java/com/skyflow/logs/ErrorLogs.java @@ -66,6 +66,15 @@ public enum ErrorLogs { EMPTY_OR_NULL_TOKEN_IN_DETOKENIZE_DATA("Invalid %s1 request. Token can not be null or empty in detokenize data at index %s2."), REDACTION_IS_REQUIRED("Invalid %s1 request. Redaction is required."), DETOKENIZE_REQUEST_REJECTED("Detokenize request resulted in failure."), + DETOKENIZE_REQUEST_NULL("Invalid %s1 request. Detokenize request can not be null."), + + NULL_TOKEN_REDACTION_GROUP_OBJECT("Invalid %s1 request. Token Redaction group object can not be null or empty."), + + NULL_REDACTION_IN_TOKEN_GROUP("Invalid %s1 request. Redaction can not be null in token redaction group"), + + NULL_TOKEN_GROUP_NAME_IN_TOKEN_GROUP("Invalid %s1 request. Token group name can not be null in token redaction group"), + + EMPTY_OR_NULL_REDACTION_IN_TOKEN_GROUP("Invalid %s1 request. Redaction can not be null or empty in token redaction group"), IDS_IS_REQUIRED("Invalid %s1 request. Ids are required."), EMPTY_IDS("Invalid %s1 request. Ids can not be empty."), EMPTY_OR_NULL_ID_IN_IDS("Invalid %s1 request. Id can not be null or empty in ids at index %s2."), @@ -126,7 +135,10 @@ public enum ErrorLogs { OUTPUT_DIRECTORY_NOT_FOUND("Invalid %s1 request. The output directory does not exist. Please specify a valid output directory."), INVALID_PERMISSIONS_FOR_OUTPUT_DIRECTORY("Invalid %s1 request. The output directory is not writable. Please check the permissions or specify a valid output directory."), EMPTY_FILE_AND_FILE_PATH_IN_DEIDENTIFY_FILE("Invalid %s1 request. The file and file path fields are both empty. Specify a valid file object or file path."), - ; + + UNEXPECTED_ERROR_DURING_BATCH_PROCESSING("Unexpected error occurred during batch processing. Error: %s1"), + + PROCESSING_ERROR_RESPONSE("Processing error response."); private final String log; diff --git a/src/main/java/com/skyflow/logs/InfoLogs.java b/common/src/main/java/com/skyflow/logs/InfoLogs.java similarity index 96% rename from src/main/java/com/skyflow/logs/InfoLogs.java rename to common/src/main/java/com/skyflow/logs/InfoLogs.java index efd81a49..03f80ac7 100644 --- a/src/main/java/com/skyflow/logs/InfoLogs.java +++ b/common/src/main/java/com/skyflow/logs/InfoLogs.java @@ -20,7 +20,8 @@ public enum InfoLogs { GET_SIGNED_DATA_TOKENS_TRIGGERED("getSignedDataTokens method triggered."), GET_SIGNED_DATA_TOKEN_SUCCESS("Signed data tokens generated."), REUSE_BEARER_TOKEN("Reusing bearer token."), - REUSE_API_KEY("Reusing api key."), + USE_CLIENT_PROVIDED_BEARER_TOKEN("Using bearer token provided by client."), + USE_API_KEY("Using api key."), GENERATE_BEARER_TOKEN_FROM_CREDENTIALS_TRIGGERED("generateBearerTokenFromCredentials method triggered."), GENERATE_BEARER_TOKEN_FROM_CREDENTIALS_STRING_TRIGGERED("generateBearerTokenFromCredentialString method triggered."), GENERATE_SIGNED_TOKENS_FROM_CREDENTIALS_FILE_TRIGGERED("generateSignedTokensFromCredentialsFile method triggered."), @@ -90,6 +91,8 @@ public enum InfoLogs { GET_DETECT_RUN_TRIGGERED("Get detect run method triggered."), VALIDATE_GET_DETECT_RUN_REQUEST("Validating get detect run request."), REIDENTIFY_TEXT_SUCCESS("Text data re-identified."), + + PROCESSING_BATCHES("Processing batch") ; diff --git a/common/src/main/java/com/skyflow/logs/WarningLogs.java b/common/src/main/java/com/skyflow/logs/WarningLogs.java new file mode 100644 index 00000000..8905ad12 --- /dev/null +++ b/common/src/main/java/com/skyflow/logs/WarningLogs.java @@ -0,0 +1,17 @@ +package com.skyflow.logs; + +public enum WarningLogs { + INVALID_BATCH_SIZE_PROVIDED("Invalid value for batch size provided, switching to default value."), + INVALID_CONCURRENCY_LIMIT_PROVIDED("Invalid value for concurrency limit provided, switching to default value."), + ; + + private final String log; + + WarningLogs(String log) { + this.log = log; + } + + public final String getLog() { + return log; + } +} diff --git a/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java b/common/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java similarity index 90% rename from src/main/java/com/skyflow/serviceaccount/util/BearerToken.java rename to common/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java index 23d09ab8..9f0fc0e3 100644 --- a/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java +++ b/common/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java @@ -4,19 +4,18 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiClientBuilder; -import com.skyflow.generated.rest.core.ApiClientApiException; -import com.skyflow.generated.rest.resources.authentication.AuthenticationClient; -import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest; -import com.skyflow.generated.rest.types.V1GetAuthTokenResponse; +import com.skyflow.generated.auth.rest.ApiClient; +import com.skyflow.generated.auth.rest.ApiClientBuilder; +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import com.skyflow.generated.auth.rest.resources.authentication.AuthenticationClient; +import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse; import com.skyflow.logs.ErrorLogs; import com.skyflow.logs.InfoLogs; -import com.skyflow.utils.Constants; -import com.skyflow.utils.Utils; +import com.skyflow.utils.BaseConstants; +import com.skyflow.utils.BaseUtils; import com.skyflow.utils.logger.LogUtil; import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; import java.io.File; import java.io.FileNotFoundException; @@ -62,11 +61,11 @@ private static V1GetAuthTokenResponse generateBearerTokenFromCredentials( return getBearerTokenFromCredentials(serviceAccountCredentials, context, roles); } catch (JsonSyntaxException e) { LogUtil.printErrorLog(ErrorLogs.INVALID_CREDENTIALS_FILE_FORMAT.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), Utils.parameterizedString( + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), BaseUtils.parameterizedString( ErrorMessage.FileInvalidJson.getMessage(), credentialsFile.getPath())); } catch (FileNotFoundException e) { LogUtil.printErrorLog(ErrorLogs.CREDENTIALS_FILE_NOT_FOUND.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), Utils.parameterizedString( + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), BaseUtils.parameterizedString( ErrorMessage.FileNotFound.getMessage(), credentialsFile.getPath())); } } @@ -117,17 +116,17 @@ private static V1GetAuthTokenResponse getBearerTokenFromCredentials( throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.MissingTokenUri.getMessage()); } - PrivateKey pvtKey = Utils.getPrivateKeyFromPem(privateKey.getAsString()); + PrivateKey pvtKey = BaseUtils.getPrivateKeyFromPem(privateKey.getAsString()); String signedUserJWT = getSignedToken( clientID.getAsString(), keyID.getAsString(), tokenURI.getAsString(), pvtKey, context ); - String basePath = Utils.getBaseURL(tokenURI.getAsString()); + String basePath = BaseUtils.getBaseURL(tokenURI.getAsString()); apiClientBuilder.url(basePath); ApiClient apiClient = apiClientBuilder.token("token").build(); AuthenticationClient authenticationApi = apiClient.authentication(); - V1GetAuthTokenRequest._FinalStage authTokenBuilder = V1GetAuthTokenRequest.builder().grantType(Constants.GRANT_TYPE).assertion(signedUserJWT); + V1GetAuthTokenRequest._FinalStage authTokenBuilder = V1GetAuthTokenRequest.builder().grantType(BaseConstants.GRANT_TYPE).assertion(signedUserJWT); if (roles != null) { String scopedRoles = getScopeUsingRoles(roles); @@ -155,8 +154,8 @@ private static String getSignedToken( .claim("aud", tokenURI) .claim("sub", clientID) .claim("ctx", context) - .setExpiration(expirationDate) - .signWith(SignatureAlgorithm.RS256, pvtKey) + .expiration(expirationDate) + .signWith(pvtKey, Jwts.SIG.RS256) .compact(); } diff --git a/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokenResponse.java b/common/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokenResponse.java similarity index 83% rename from src/main/java/com/skyflow/serviceaccount/util/SignedDataTokenResponse.java rename to common/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokenResponse.java index 7c9f4674..874b47c5 100644 --- a/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokenResponse.java +++ b/common/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokenResponse.java @@ -1,10 +1,10 @@ package com.skyflow.serviceaccount.util; import com.google.gson.Gson; -import com.skyflow.utils.Constants; +import com.skyflow.utils.BaseConstants; public class SignedDataTokenResponse { - private static final String prefix = Constants.SIGNED_DATA_TOKEN_PREFIX; + private static final String prefix = BaseConstants.SIGNED_DATA_TOKEN_PREFIX; private final String token; private final String signedToken; diff --git a/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokens.java b/common/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokens.java similarity index 96% rename from src/main/java/com/skyflow/serviceaccount/util/SignedDataTokens.java rename to common/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokens.java index ecdfa89f..ed0026ef 100644 --- a/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokens.java +++ b/common/src/main/java/com/skyflow/serviceaccount/util/SignedDataTokens.java @@ -9,10 +9,9 @@ import com.skyflow.errors.SkyflowException; import com.skyflow.logs.ErrorLogs; import com.skyflow.logs.InfoLogs; -import com.skyflow.utils.Utils; +import com.skyflow.utils.BaseUtils; import com.skyflow.utils.logger.LogUtil; import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; import java.io.File; import java.io.FileNotFoundException; @@ -59,11 +58,11 @@ private static List generateSignedTokenFromCredentialsF responseToken = generateSignedTokensFromCredentials(serviceAccountCredentials, dataTokens, timeToLive, context); } catch (JsonSyntaxException e) { LogUtil.printErrorLog(ErrorLogs.INVALID_CREDENTIALS_FILE_FORMAT.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), Utils.parameterizedString( + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), BaseUtils.parameterizedString( ErrorMessage.FileInvalidJson.getMessage(), credentialsFile.getPath())); } catch (FileNotFoundException e) { LogUtil.printErrorLog(ErrorLogs.CREDENTIALS_FILE_NOT_FOUND.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), Utils.parameterizedString( + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), BaseUtils.parameterizedString( ErrorMessage.FileNotFound.getMessage(), credentialsFile.getPath())); } return responseToken; @@ -111,7 +110,7 @@ private static List generateSignedTokensFromCredentials LogUtil.printErrorLog(ErrorLogs.KEY_ID_IS_REQUIRED.getLog()); throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.MissingKeyId.getMessage()); } - PrivateKey pvtKey = Utils.getPrivateKeyFromPem(privateKey.getAsString()); + PrivateKey pvtKey = BaseUtils.getPrivateKeyFromPem(privateKey.getAsString()); signedDataTokens = getSignedToken( clientID.getAsString(), keyID.getAsString(), pvtKey, dataTokens, timeToLive, context); } catch (RuntimeException e) { @@ -143,8 +142,8 @@ private static List getSignedToken( .claim("sub", clientID) .claim("ctx", context) .claim("tok", dataToken) - .setExpiration(expirationDate) - .signWith(SignatureAlgorithm.RS256, pvtKey) + .expiration(expirationDate) + .signWith(pvtKey, Jwts.SIG.RS256) .compact(); SignedDataTokenResponse responseObject = new SignedDataTokenResponse(dataToken, eachSignedDataToken); list.add(responseObject); diff --git a/src/main/java/com/skyflow/serviceaccount/util/Token.java b/common/src/main/java/com/skyflow/serviceaccount/util/Token.java similarity index 100% rename from src/main/java/com/skyflow/serviceaccount/util/Token.java rename to common/src/main/java/com/skyflow/serviceaccount/util/Token.java diff --git a/src/main/java/com/skyflow/utils/Constants.java b/common/src/main/java/com/skyflow/utils/BaseConstants.java similarity index 71% rename from src/main/java/com/skyflow/utils/Constants.java rename to common/src/main/java/com/skyflow/utils/BaseConstants.java index b9264a22..0880034f 100644 --- a/src/main/java/com/skyflow/utils/Constants.java +++ b/common/src/main/java/com/skyflow/utils/BaseConstants.java @@ -1,21 +1,24 @@ package com.skyflow.utils; -public final class Constants { +public class BaseConstants { + public static final String SDK_NAME= "Skyflow Java SDK "; + public static final String SDK_VERSION = "1.0.0"; + public static final String SDK_PREFIX = SDK_NAME + SDK_VERSION; + public static final String ORDER_ASCENDING = "ASCENDING"; + public static final String ENV_CREDENTIALS_KEY_NAME = "SKYFLOW_CREDENTIALS"; public static final String SECURE_PROTOCOL = "https://"; - public static final String DEV_DOMAIN = ".vault.skyflowapis.dev"; - public static final String STAGE_DOMAIN = ".vault.skyflowapis.tech"; - public static final String SANDBOX_DOMAIN = ".vault.skyflowapis-preview.com"; - public static final String PROD_DOMAIN = ".vault.skyflowapis.com"; + + public static final String V2_VAULT_DOMAIN = ".vault."; + public static final String V3_VAULT_DOMAIN = ".skyvault."; + public static final String DEV_DOMAIN = "skyflowapis.dev"; + public static final String STAGE_DOMAIN = "skyflowapis.tech"; + public static final String SANDBOX_DOMAIN = "skyflowapis-preview.com"; + public static final String PROD_DOMAIN = "skyflowapis.com"; public static final String PKCS8_PRIVATE_HEADER = "-----BEGIN PRIVATE KEY-----"; public static final String PKCS8_PRIVATE_FOOTER = "-----END PRIVATE KEY-----"; public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer"; public static final String SIGNED_DATA_TOKEN_PREFIX = "signed_token_"; - public static final String ORDER_ASCENDING = "ASCENDING"; public static final String API_KEY_REGEX = "^sky-[a-zA-Z0-9]{5}-[a-fA-F0-9]{32}$"; - public static final String ENV_CREDENTIALS_KEY_NAME = "SKYFLOW_CREDENTIALS"; - public static final String SDK_NAME = "Skyflow Java SDK "; - public static final String SDK_VERSION = "v2"; - public static final String SDK_PREFIX = SDK_NAME + SDK_VERSION; public static final String SDK_METRIC_NAME_VERSION = "sdk_name_version"; public static final String SDK_METRIC_NAME_VERSION_PREFIX = "skyflow-java@"; public static final String SDK_METRIC_CLIENT_DEVICE_MODEL = "sdk_client_device_model"; @@ -25,7 +28,6 @@ public final class Constants { public static final String SDK_AUTH_HEADER_KEY = "x-skyflow-authorization"; public static final String SDK_METRICS_HEADER_KEY = "sky-metadata"; public static final String REQUEST_ID_HEADER_KEY = "x-request-id"; - public static final String PROCESSED_FILE_NAME_PREFIX = "processed-"; - public static final String ERROR_FROM_CLIENT_HEADER_KEY = "eror-from-client"; - public static final String DEIDENTIFIED_FILE_PREFIX = "deidentified";; + public static final String ERROR_FROM_CLIENT_HEADER_KEY = "error-from-client"; + } diff --git a/src/main/java/com/skyflow/utils/Utils.java b/common/src/main/java/com/skyflow/utils/BaseUtils.java similarity index 63% rename from src/main/java/com/skyflow/utils/Utils.java rename to common/src/main/java/com/skyflow/utils/BaseUtils.java index cc8d572a..b7cf6bb0 100644 --- a/src/main/java/com/skyflow/utils/Utils.java +++ b/common/src/main/java/com/skyflow/utils/BaseUtils.java @@ -1,7 +1,6 @@ package com.skyflow.utils; import com.google.gson.JsonObject; -import com.skyflow.config.ConnectionConfig; import com.skyflow.config.Credentials; import com.skyflow.enums.Env; import com.skyflow.errors.ErrorCode; @@ -10,8 +9,8 @@ import com.skyflow.logs.ErrorLogs; import com.skyflow.logs.InfoLogs; import com.skyflow.serviceaccount.util.BearerToken; +import com.skyflow.serviceaccount.util.Token; import com.skyflow.utils.logger.LogUtil; -import com.skyflow.vault.connection.InvokeConnectionRequest; import org.apache.commons.codec.binary.Base64; import java.io.File; @@ -22,54 +21,59 @@ import java.security.PrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; -import java.util.HashMap; -import java.util.Map; -public final class Utils { - public static String getVaultURL(String clusterId, Env env) { - StringBuilder sb = new StringBuilder(Constants.SECURE_PROTOCOL); - sb.append(clusterId); +public class BaseUtils { + public static String getVaultURL(String clusterId, Env env, String vaultDomain) { + StringBuilder sb = buildBaseUrl(clusterId, vaultDomain); switch (env) { case DEV: - sb.append(Constants.DEV_DOMAIN); + sb.append(BaseConstants.DEV_DOMAIN); break; case STAGE: - sb.append(Constants.STAGE_DOMAIN); + sb.append(BaseConstants.STAGE_DOMAIN); break; case SANDBOX: - sb.append(Constants.SANDBOX_DOMAIN); + sb.append(BaseConstants.SANDBOX_DOMAIN); break; case PROD: default: - sb.append(Constants.PROD_DOMAIN); + sb.append(BaseConstants.PROD_DOMAIN); break; } return sb.toString(); } public static String generateBearerToken(Credentials credentials) throws SkyflowException { + String bearerToken; if (credentials.getPath() != null) { - return BearerToken.builder() + bearerToken = BearerToken.builder() .setCredentials(new File(credentials.getPath())) .setRoles(credentials.getRoles()) .setCtx(credentials.getContext()) .build() .getBearerToken(); } else if (credentials.getCredentialsString() != null) { - return BearerToken.builder() + bearerToken = BearerToken.builder() .setCredentials(credentials.getCredentialsString()) .setRoles(credentials.getRoles()) .setCtx(credentials.getContext()) .build() .getBearerToken(); } else { - return credentials.getToken(); + LogUtil.printInfoLog(InfoLogs.USE_CLIENT_PROVIDED_BEARER_TOKEN.getLog()); + bearerToken = credentials.getToken(); + } + // check expiry for generated token + if (Token.isExpired(bearerToken)) { + LogUtil.printErrorLog(ErrorLogs.INVALID_BEARER_TOKEN.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.BearerTokenExpired.getMessage()); } + return bearerToken; } public static PrivateKey getPrivateKeyFromPem(String pemKey) throws SkyflowException { - String PKCS8PrivateHeader = Constants.PKCS8_PRIVATE_HEADER; - String PKCS8PrivateFooter = Constants.PKCS8_PRIVATE_FOOTER; + String PKCS8PrivateHeader = BaseConstants.PKCS8_PRIVATE_HEADER; + String PKCS8PrivateFooter = BaseConstants.PKCS8_PRIVATE_FOOTER; String privateKeyContent = pemKey; PrivateKey privateKey = null; @@ -101,43 +105,8 @@ public static String parameterizedString(String base, String... args) { return base; } - public static String constructConnectionURL(ConnectionConfig config, InvokeConnectionRequest invokeConnectionRequest) { - StringBuilder filledURL = new StringBuilder(config.getConnectionUrl()); - - if (invokeConnectionRequest.getPathParams() != null && !invokeConnectionRequest.getPathParams().isEmpty()) { - for (Map.Entry entry : invokeConnectionRequest.getPathParams().entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - filledURL = new StringBuilder(filledURL.toString().replace(String.format("{%s}", key), value)); - } - } - - if (invokeConnectionRequest.getQueryParams() != null && !invokeConnectionRequest.getQueryParams().isEmpty()) { - filledURL.append("?"); - for (Map.Entry entry : invokeConnectionRequest.getQueryParams().entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - filledURL.append(key).append("=").append(value).append("&"); - } - filledURL = new StringBuilder(filledURL.substring(0, filledURL.length() - 1)); - } - - return filledURL.toString(); - } - - public static Map constructConnectionHeadersMap(Map requestHeaders) { - Map headersMap = new HashMap<>(); - for (Map.Entry entry : requestHeaders.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - headersMap.put(key.toLowerCase(), value); - } - return headersMap; - } - - public static JsonObject getMetrics() { + protected static JsonObject getCommonMetrics() { JsonObject details = new JsonObject(); - String sdkVersion = Constants.SDK_VERSION; String deviceModel; String osDetails; String javaVersion; @@ -148,7 +117,7 @@ public static JsonObject getMetrics() { } catch (Exception e) { LogUtil.printInfoLog(parameterizedString( InfoLogs.UNABLE_TO_GENERATE_SDK_METRIC.getLog(), - Constants.SDK_METRIC_CLIENT_DEVICE_MODEL + BaseConstants.SDK_METRIC_CLIENT_DEVICE_MODEL )); deviceModel = ""; } @@ -160,7 +129,7 @@ public static JsonObject getMetrics() { } catch (Exception e) { LogUtil.printInfoLog(parameterizedString( InfoLogs.UNABLE_TO_GENERATE_SDK_METRIC.getLog(), - Constants.SDK_METRIC_CLIENT_OS_DETAILS + BaseConstants.SDK_METRIC_CLIENT_OS_DETAILS )); osDetails = ""; } @@ -172,14 +141,13 @@ public static JsonObject getMetrics() { } catch (Exception e) { LogUtil.printInfoLog(parameterizedString( InfoLogs.UNABLE_TO_GENERATE_SDK_METRIC.getLog(), - Constants.SDK_METRIC_RUNTIME_DETAILS + BaseConstants.SDK_METRIC_RUNTIME_DETAILS )); javaVersion = ""; } - details.addProperty(Constants.SDK_METRIC_NAME_VERSION, Constants.SDK_METRIC_NAME_VERSION_PREFIX + sdkVersion); - details.addProperty(Constants.SDK_METRIC_CLIENT_DEVICE_MODEL, deviceModel); - details.addProperty(Constants.SDK_METRIC_RUNTIME_DETAILS, Constants.SDK_METRIC_RUNTIME_DETAILS_PREFIX + javaVersion); - details.addProperty(Constants.SDK_METRIC_CLIENT_OS_DETAILS, osDetails); + details.addProperty(BaseConstants.SDK_METRIC_CLIENT_DEVICE_MODEL, deviceModel); + details.addProperty(BaseConstants.SDK_METRIC_RUNTIME_DETAILS, BaseConstants.SDK_METRIC_RUNTIME_DETAILS_PREFIX + javaVersion); + details.addProperty(BaseConstants.SDK_METRIC_CLIENT_OS_DETAILS, osDetails); return details; } @@ -199,4 +167,11 @@ private static PrivateKey parsePkcs8PrivateKey(byte[] pkcs8Bytes) throws Skyflow } return privateKey; } + + private static StringBuilder buildBaseUrl(String clusterId, String vaultDomain) { + StringBuilder sb = new StringBuilder(BaseConstants.SECURE_PROTOCOL); + sb.append(clusterId); + sb.append(vaultDomain); + return sb; + } } diff --git a/common/src/main/java/com/skyflow/utils/SdkVersion.java b/common/src/main/java/com/skyflow/utils/SdkVersion.java new file mode 100644 index 00000000..8136d8c9 --- /dev/null +++ b/common/src/main/java/com/skyflow/utils/SdkVersion.java @@ -0,0 +1,13 @@ +package com.skyflow.utils; + +public class SdkVersion { + private static String sdkPrefix = BaseConstants.SDK_PREFIX; + + public static String getSdkPrefix() { + return sdkPrefix; + } + + public static void setSdkPrefix(String sdkPrefix) { + SdkVersion.sdkPrefix = sdkPrefix; + } +} diff --git a/src/main/java/com/skyflow/utils/logger/LogUtil.java b/common/src/main/java/com/skyflow/utils/logger/LogUtil.java similarity index 96% rename from src/main/java/com/skyflow/utils/logger/LogUtil.java rename to common/src/main/java/com/skyflow/utils/logger/LogUtil.java index 78cfa038..54fc7d47 100644 --- a/src/main/java/com/skyflow/utils/logger/LogUtil.java +++ b/common/src/main/java/com/skyflow/utils/logger/LogUtil.java @@ -2,13 +2,13 @@ import com.skyflow.enums.LogLevel; import com.skyflow.logs.InfoLogs; -import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import java.util.logging.*; public final class LogUtil { private static final Logger LOGGER = Logger.getLogger(LogUtil.class.getName()); - private static final String SDK_LOG_PREFIX = "[" + Constants.SDK_PREFIX + "] "; + private static final String SDK_LOG_PREFIX = "[" + SdkVersion.getSdkPrefix() + "] "; private static boolean IS_LOGGER_SETUP_DONE = false; synchronized public static void setupLogger(LogLevel logLevel) { diff --git a/common/src/main/java/com/skyflow/utils/validations/BaseValidations.java b/common/src/main/java/com/skyflow/utils/validations/BaseValidations.java new file mode 100644 index 00000000..8460ec1d --- /dev/null +++ b/common/src/main/java/com/skyflow/utils/validations/BaseValidations.java @@ -0,0 +1,108 @@ +package com.skyflow.utils.validations; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.logs.ErrorLogs; +import com.skyflow.utils.BaseConstants; +import com.skyflow.utils.BaseUtils; +import com.skyflow.utils.logger.LogUtil; + +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class BaseValidations { + BaseValidations() { + } + + public static void validateVaultConfig(VaultConfig vaultConfig) throws SkyflowException { + String vaultId = vaultConfig.getVaultId(); + String clusterId = vaultConfig.getClusterId(); + Credentials credentials = vaultConfig.getCredentials(); + if (vaultId == null) { + LogUtil.printErrorLog(ErrorLogs.VAULT_ID_IS_REQUIRED.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidVaultId.getMessage()); + } else if (vaultId.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_VAULT_ID.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyVaultId.getMessage()); + } else if (clusterId == null) { + LogUtil.printErrorLog(ErrorLogs.CLUSTER_ID_IS_REQUIRED.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidClusterId.getMessage()); + } else if (clusterId.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_CLUSTER_ID.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyClusterId.getMessage()); + } else if (credentials != null) { + validateCredentials(credentials); + } + } + + public static void validateCredentials(Credentials credentials) throws SkyflowException { + int nonNullMembers = 0; + String path = credentials.getPath(); + String credentialsString = credentials.getCredentialsString(); + String token = credentials.getToken(); + String apiKey = credentials.getApiKey(); + String context = credentials.getContext(); + ArrayList roles = credentials.getRoles(); + + if (path != null) nonNullMembers++; + if (credentialsString != null) nonNullMembers++; + if (token != null) nonNullMembers++; + if (apiKey != null) nonNullMembers++; + + if (nonNullMembers > 1) { + LogUtil.printErrorLog(ErrorLogs.MULTIPLE_TOKEN_GENERATION_MEANS_PASSED.getLog()); + throw new SkyflowException( + ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.MultipleTokenGenerationMeansPassed.getMessage() + ); + } else if (nonNullMembers < 1) { + LogUtil.printErrorLog(ErrorLogs.NO_TOKEN_GENERATION_MEANS_PASSED.getLog()); + throw new SkyflowException( + ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.NoTokenGenerationMeansPassed.getMessage() + ); + } else if (path != null && path.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_CREDENTIALS_PATH.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyCredentialFilePath.getMessage()); + } else if (credentialsString != null && credentialsString.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_CREDENTIALS_STRING.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyCredentialsString.getMessage()); + } else if (token != null && token.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_TOKEN_VALUE.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyToken.getMessage()); + } else if (apiKey != null) { + if (apiKey.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_API_KEY_VALUE.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyApikey.getMessage()); + } else { + Pattern pattern = Pattern.compile(BaseConstants.API_KEY_REGEX); + Matcher matcher = pattern.matcher(apiKey); + if (!matcher.matches()) { + LogUtil.printErrorLog(ErrorLogs.INVALID_API_KEY.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidApikey.getMessage()); + } + } + } else if (roles != null) { + if (roles.isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_ROLES.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyRoles.getMessage()); + } else { + for (int index = 0; index < roles.size(); index++) { + String role = roles.get(index); + if (role == null || role.trim().isEmpty()) { + LogUtil.printErrorLog(BaseUtils.parameterizedString( + ErrorLogs.EMPTY_OR_NULL_ROLE_IN_ROLES.getLog(), Integer.toString(index) + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyRoleInRoles.getMessage()); + } + } + } + } + if (context != null && context.trim().isEmpty()) { + LogUtil.printErrorLog(ErrorLogs.EMPTY_OR_NULL_CONTEXT.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyContext.getMessage()); + } + } +} diff --git a/common/src/main/java/com/skyflow/vault/data/BaseInsertRequest.java b/common/src/main/java/com/skyflow/vault/data/BaseInsertRequest.java new file mode 100644 index 00000000..b856492d --- /dev/null +++ b/common/src/main/java/com/skyflow/vault/data/BaseInsertRequest.java @@ -0,0 +1,41 @@ +package com.skyflow.vault.data; + +import java.util.ArrayList; +import java.util.HashMap; + +class BaseInsertRequest { + private final BaseInsertRequestBuilder builder; + + protected BaseInsertRequest(BaseInsertRequestBuilder builder) { + this.builder = builder; + } + + public String getTable() { + return this.builder.table; + } + + public ArrayList> getValues() { + return this.builder.values; + } + + static class BaseInsertRequestBuilder { + protected String table; + protected ArrayList> values; + protected String upsert; + + protected BaseInsertRequestBuilder() { + } + + public BaseInsertRequestBuilder table(String table) { + this.table = table; + return this; + } + + public BaseInsertRequestBuilder values(ArrayList> values) { + this.values = values; + return this; + } + + } +} + diff --git a/src/test/java/com/skyflow/config/CredentialsTests.java b/common/test/java/com/skyflow/config/CredentialsTests.java similarity index 89% rename from src/test/java/com/skyflow/config/CredentialsTests.java rename to common/test/java/com/skyflow/config/CredentialsTests.java index ff9fcfda..13cd0644 100644 --- a/src/test/java/com/skyflow/config/CredentialsTests.java +++ b/common/test/java/com/skyflow/config/CredentialsTests.java @@ -3,7 +3,7 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; -import com.skyflow.utils.validations.Validations; +import com.skyflow.utils.validations.BaseValidations; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -45,7 +45,7 @@ public void testValidCredentialsWithPath() { try { Credentials credentials = new Credentials(); credentials.setPath(path); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.assertNull(credentials.getCredentialsString()); Assert.assertNull(credentials.getToken()); Assert.assertNull(credentials.getApiKey()); @@ -59,7 +59,7 @@ public void testValidCredentialsWithCredentialsString() { try { Credentials credentials = new Credentials(); credentials.setCredentialsString(credentialsString); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.assertNull(credentials.getPath()); Assert.assertNull(credentials.getToken()); Assert.assertNull(credentials.getApiKey()); @@ -73,7 +73,7 @@ public void testValidCredentialsWithToken() { try { Credentials credentials = new Credentials(); credentials.setToken(token); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.assertNull(credentials.getPath()); Assert.assertNull(credentials.getCredentialsString()); Assert.assertNull(credentials.getApiKey()); @@ -87,7 +87,7 @@ public void testValidCredentialsWithApikey() { try { Credentials credentials = new Credentials(); credentials.setApiKey(validApiKey); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.assertNull(credentials.getPath()); Assert.assertNull(credentials.getCredentialsString()); Assert.assertNull(credentials.getToken()); @@ -104,7 +104,7 @@ public void testValidCredentialsWithRolesAndContext() { credentials.setApiKey(validApiKey); credentials.setRoles(roles); credentials.setContext(context); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.assertNull(credentials.getPath()); Assert.assertNull(credentials.getCredentialsString()); Assert.assertNull(credentials.getToken()); @@ -120,7 +120,7 @@ public void testEmptyPathInCredentials() { try { Credentials credentials = new Credentials(); credentials.setPath(""); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -133,7 +133,7 @@ public void testEmptyCredentialsStringInCredentials() { try { Credentials credentials = new Credentials(); credentials.setCredentialsString(""); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -146,7 +146,7 @@ public void testEmptyTokenInCredentials() { try { Credentials credentials = new Credentials(); credentials.setToken(""); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -159,7 +159,7 @@ public void testEmptyApikeyInCredentials() { try { Credentials credentials = new Credentials(); credentials.setApiKey(""); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -172,7 +172,7 @@ public void testInvalidApikeyInCredentials() { try { Credentials credentials = new Credentials(); credentials.setApiKey(invalidApiKey); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -186,7 +186,7 @@ public void testBothTokenAndPathInCredentials() { Credentials credentials = new Credentials(); credentials.setPath(path); credentials.setToken(token); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -198,7 +198,7 @@ public void testBothTokenAndPathInCredentials() { public void testNothingPassedInCredentials() { try { Credentials credentials = new Credentials(); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -212,7 +212,7 @@ public void testEmptyRolesInCredentials() { Credentials credentials = new Credentials(); credentials.setPath(path); credentials.setRoles(roles); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -228,7 +228,7 @@ public void testNullRoleInRolesInCredentials() { roles.add(role); roles.add(null); credentials.setRoles(roles); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -244,7 +244,7 @@ public void testEmptyRoleInRolesInCredentials() { roles.add(role); roles.add(""); credentials.setRoles(roles); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -258,7 +258,7 @@ public void testEmptyContextInCredentials() { Credentials credentials = new Credentials(); credentials.setPath(path); credentials.setContext(""); - Validations.validateCredentials(credentials); + BaseValidations.validateCredentials(credentials); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); diff --git a/src/test/java/com/skyflow/config/VaultConfigTests.java b/common/test/java/com/skyflow/config/VaultConfigTests.java similarity index 91% rename from src/test/java/com/skyflow/config/VaultConfigTests.java rename to common/test/java/com/skyflow/config/VaultConfigTests.java index b99f6c9b..2c3cb77d 100644 --- a/src/test/java/com/skyflow/config/VaultConfigTests.java +++ b/common/test/java/com/skyflow/config/VaultConfigTests.java @@ -4,7 +4,7 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; -import com.skyflow.utils.validations.Validations; +import com.skyflow.utils.validations.BaseValidations; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -35,7 +35,7 @@ public void testValidVaultConfigWithCredentialsInValidations() { vaultConfig.setClusterId(clusterID); vaultConfig.setEnv(Env.SANDBOX); vaultConfig.setCredentials(credentials); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.assertEquals(vaultID, vaultConfig.getVaultId()); Assert.assertEquals(clusterID, vaultConfig.getClusterId()); @@ -53,7 +53,7 @@ public void testValidVaultConfigWithoutCredentialsInValidations() { vaultConfig.setVaultId(vaultID); vaultConfig.setClusterId(clusterID); vaultConfig.setEnv(Env.SANDBOX); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.assertEquals(vaultID, vaultConfig.getVaultId()); Assert.assertEquals(clusterID, vaultConfig.getClusterId()); @@ -71,7 +71,7 @@ public void testDefaultEnvInVaultConfigWithCredentialsInValidations() { vaultConfig.setVaultId(vaultID); vaultConfig.setClusterId(clusterID); vaultConfig.setCredentials(credentials); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.assertEquals(vaultID, vaultConfig.getVaultId()); Assert.assertEquals(clusterID, vaultConfig.getClusterId()); @@ -89,7 +89,7 @@ public void testDefaultEnvInVaultConfigWithoutCredentialsInValidations() { vaultConfig.setVaultId(vaultID); vaultConfig.setClusterId(clusterID); vaultConfig.setEnv(null); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.assertEquals(vaultID, vaultConfig.getVaultId()); Assert.assertEquals(clusterID, vaultConfig.getClusterId()); @@ -106,7 +106,7 @@ public void testNoVaultIdInVaultConfigInValidations() { try { vaultConfig.setClusterId(clusterID); vaultConfig.setEnv(Env.SANDBOX); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -121,7 +121,7 @@ public void testEmptyVaultIdInVaultConfigInValidations() { vaultConfig.setVaultId(""); vaultConfig.setClusterId(clusterID); vaultConfig.setEnv(Env.SANDBOX); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -135,7 +135,7 @@ public void testNoClusterIdInVaultConfigInValidations() { VaultConfig vaultConfig = new VaultConfig(); vaultConfig.setVaultId(vaultID); vaultConfig.setEnv(Env.SANDBOX); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); @@ -150,7 +150,7 @@ public void testEmptyClusterIdInVaultConfigInValidations() { vaultConfig.setVaultId(vaultID); vaultConfig.setClusterId(""); vaultConfig.setEnv(Env.SANDBOX); - Validations.validateVaultConfig(vaultConfig); + BaseValidations.validateVaultConfig(vaultConfig); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); diff --git a/src/test/java/com/skyflow/errors/SkyflowExceptionTest.java b/common/test/java/com/skyflow/errors/SkyflowExceptionTest.java similarity index 91% rename from src/test/java/com/skyflow/errors/SkyflowExceptionTest.java rename to common/test/java/com/skyflow/errors/SkyflowExceptionTest.java index 89e0643b..cf35f548 100644 --- a/src/test/java/com/skyflow/errors/SkyflowExceptionTest.java +++ b/common/test/java/com/skyflow/errors/SkyflowExceptionTest.java @@ -59,7 +59,7 @@ public void testConstructorWithJsonErrorBody() { Assert.assertEquals("NOT_FOUND", ex.getHttpStatus()); Assert.assertEquals("req-123", ex.getRequestId()); Assert.assertNotNull(ex.getDetails()); - Assert.assertTrue(ex.getDetails().size() > 0); + Assert.assertFalse(ex.getDetails().isEmpty()); } @@ -67,9 +67,9 @@ public void testConstructorWithJsonErrorBody() { public void testConstructorWithNullErrorBody() { Map> headers = new HashMap<>(); SkyflowException ex = new SkyflowException(500, new RuntimeException("fail"), headers, null); - Assert.assertNull(ex.getMessage()); + Assert.assertEquals(ex.getMessage(), "fail"); + Assert.assertEquals(ex.getHttpStatus(), HttpStatus.BAD_REQUEST.getHttpStatus()); Assert.assertNull(ex.getGrpcCode()); - Assert.assertNull(ex.getHttpStatus()); } @Test @@ -85,11 +85,11 @@ public void testGettersAndSetters() { @Test public void testSetDetailsWithErrorFromClientHeader() { - String json = "{\"error\":{\"message\":\"test error\",\"grpc_code\":13,\"details\":[]}}"; + String jsonString = "{\"error\":{\"message\":\"test error\",\"grpc_code\":13,\"details\":[]}}"; Map> headers = new HashMap<>(); headers.put("error-from-client", Collections.singletonList("client error")); - SkyflowException ex = new SkyflowException(500, new RuntimeException("fail"), headers, json); + SkyflowException ex = new SkyflowException(500, new RuntimeException("fail"), headers, jsonString); Assert.assertNotNull(ex.getDetails()); Assert.assertEquals(1, ex.getDetails().size()); diff --git a/src/test/java/com/skyflow/serviceaccount/util/BearerTokenTests.java b/common/test/java/com/skyflow/serviceaccount/util/BearerTokenTests.java similarity index 90% rename from src/test/java/com/skyflow/serviceaccount/util/BearerTokenTests.java rename to common/test/java/com/skyflow/serviceaccount/util/BearerTokenTests.java index 4bfb697c..cf5bbcd5 100644 --- a/src/test/java/com/skyflow/serviceaccount/util/BearerTokenTests.java +++ b/common/test/java/com/skyflow/serviceaccount/util/BearerTokenTests.java @@ -3,7 +3,7 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; -import com.skyflow.utils.Utils; +import com.skyflow.utils.BaseUtils; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -25,7 +25,7 @@ public class BearerTokenTests { @BeforeClass public static void setup() { credentialsFilePath = "./credentials.json"; - invalidJsonFilePath = "./src/test/resources/notJson.txt"; + invalidJsonFilePath = "./test/resources/notJson.txt"; invalidFilePath = "./src/test/credentials.json"; credentialsString = "{\"key\":\"value\"}"; context = "test_context"; @@ -64,7 +64,7 @@ public void testEmptyCredentialsFilePath() { } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), ""), e.getMessage() + BaseUtils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), ""), e.getMessage() ); } } @@ -79,7 +79,7 @@ public void testInvalidFilePath() { } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), invalidFilePath), + BaseUtils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), invalidFilePath), e.getMessage() ); } @@ -95,7 +95,7 @@ public void testInvalidCredentialsFile() { } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.FileInvalidJson.getMessage(), invalidJsonFilePath), + BaseUtils.parameterizedString(ErrorMessage.FileInvalidJson.getMessage(), invalidJsonFilePath), e.getMessage() ); } @@ -128,7 +128,7 @@ public void testInvalidCredentialsString() { @Test public void testNoPrivateKeyInCredentialsForCredentials() { - String filePath = "./src/test/resources/noPrivateKeyCredentials.json"; + String filePath = "./test/resources/noPrivateKeyCredentials.json"; File file = new File(filePath); try { BearerToken bearerToken = BearerToken.builder().setCredentials(file).build(); @@ -142,7 +142,7 @@ public void testNoPrivateKeyInCredentialsForCredentials() { @Test public void testNoClientIDInCredentialsForCredentials() { - String filePath = "./src/test/resources/noClientIDCredentials.json"; + String filePath = "./test/resources/noClientIDCredentials.json"; File file = new File(filePath); try { BearerToken bearerToken = BearerToken.builder().setCredentials(file).build(); @@ -156,7 +156,7 @@ public void testNoClientIDInCredentialsForCredentials() { @Test public void testNoKeyIDInCredentialsForCredentials() { - String filePath = "./src/test/resources/noKeyIDCredentials.json"; + String filePath = "./test/resources/noKeyIDCredentials.json"; File file = new File(filePath); try { BearerToken bearerToken = BearerToken.builder().setCredentials(file).build(); @@ -170,7 +170,7 @@ public void testNoKeyIDInCredentialsForCredentials() { @Test public void testNoTokenURIInCredentialsForCredentials() { - String filePath = "./src/test/resources/noTokenURICredentials.json"; + String filePath = "./test/resources/noTokenURICredentials.json"; File file = new File(filePath); try { BearerToken bearerToken = BearerToken.builder().setCredentials(file).build(); @@ -184,7 +184,7 @@ public void testNoTokenURIInCredentialsForCredentials() { @Test public void testInvalidPrivateKeyInCredentialsForCredentials() { - String filePath = "./src/test/resources/invalidPrivateKeyCredentials.json"; + String filePath = "./test/resources/invalidPrivateKeyCredentials.json"; File file = new File(filePath); try { BearerToken bearerToken = BearerToken.builder().setCredentials(file).build(); @@ -211,7 +211,7 @@ public void testInvalidKeySpecInCredentialsForCredentials() { @Test public void testInvalidTokenURIInCredentialsForCredentials() throws SkyflowException { - String filePath = "./src/test/resources/invalidTokenURICredentials.json"; + String filePath = "./test/resources/invalidTokenURICredentials.json"; File file = new File(filePath); try { BearerToken bearerToken = BearerToken.builder().setCredentials(file).build(); diff --git a/src/test/java/com/skyflow/serviceaccount/util/SignedDataTokensTests.java b/common/test/java/com/skyflow/serviceaccount/util/SignedDataTokensTests.java similarity index 87% rename from src/test/java/com/skyflow/serviceaccount/util/SignedDataTokensTests.java rename to common/test/java/com/skyflow/serviceaccount/util/SignedDataTokensTests.java index 42ad9bc7..dcda716e 100644 --- a/src/test/java/com/skyflow/serviceaccount/util/SignedDataTokensTests.java +++ b/common/test/java/com/skyflow/serviceaccount/util/SignedDataTokensTests.java @@ -3,7 +3,7 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; -import com.skyflow.utils.Utils; +import com.skyflow.utils.BaseUtils; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -26,7 +26,7 @@ public class SignedDataTokensTests { @BeforeClass public static void setup() { credentialsFilePath = "./credentials.json"; - invalidJsonFilePath = "./src/test/resources/notJson.txt"; + invalidJsonFilePath = "./test/resources/notJson.txt"; invalidFilePath = "./src/test/credentials.json"; credentialsString = "{\"key\":\"value\"}"; context = "test_context"; @@ -69,7 +69,7 @@ public void testEmptyCredentialsFilePath() { Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); - Assert.assertEquals(Utils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), ""), e.getMessage()); + Assert.assertEquals(BaseUtils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), ""), e.getMessage()); } } @@ -83,7 +83,7 @@ public void testInvalidFilePath() { } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), invalidFilePath), + BaseUtils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), invalidFilePath), e.getMessage()); } } @@ -98,7 +98,7 @@ public void testInvalidCredentialsFile() { } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.FileInvalidJson.getMessage(), invalidJsonFilePath), + BaseUtils.parameterizedString(ErrorMessage.FileInvalidJson.getMessage(), invalidJsonFilePath), e.getMessage() ); } @@ -109,19 +109,15 @@ public void testEmptyCredentialsString() { try { SignedDataTokens signedTokens = SignedDataTokens.builder().setCredentials("").build(); signedTokens.getSignedDataTokens(); - System.out.println("in try block"); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { - System.out.println("caught skyflow exception"); - System.out.println(e); Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.InvalidCredentials.getMessage(), invalidJsonFilePath), + BaseUtils.parameterizedString(ErrorMessage.InvalidCredentials.getMessage(), invalidJsonFilePath), e.getMessage() ); } catch (Exception e) { - System.out.println("catching exception"); - System.out.println(e); + Assert.fail(e.getMessage()); } } @@ -134,7 +130,7 @@ public void testInvalidCredentialsString() { } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); Assert.assertEquals( - Utils.parameterizedString(ErrorMessage.CredentialsStringInvalidJson.getMessage(), invalidJsonFilePath), + BaseUtils.parameterizedString(ErrorMessage.CredentialsStringInvalidJson.getMessage(), invalidJsonFilePath), e.getMessage() ); } @@ -142,7 +138,7 @@ public void testInvalidCredentialsString() { @Test public void testNoPrivateKeyInCredentials() { - String filePath = "./src/test/resources/noPrivateKeyCredentials.json"; + String filePath = "./test/resources/noPrivateKeyCredentials.json"; File file = new File(filePath); try { SignedDataTokens signedTokens = SignedDataTokens.builder().setCredentials(file).build(); @@ -156,7 +152,7 @@ public void testNoPrivateKeyInCredentials() { @Test public void testNoClientIDInCredentials() { - String filePath = "./src/test/resources/noClientIDCredentials.json"; + String filePath = "./test/resources/noClientIDCredentials.json"; File file = new File(filePath); try { SignedDataTokens signedTokens = SignedDataTokens.builder().setCredentials(file).build(); @@ -170,7 +166,7 @@ public void testNoClientIDInCredentials() { @Test public void testNoKeyIDInCredentials() { - String filePath = "./src/test/resources/noKeyIDCredentials.json"; + String filePath = "./test/resources/noKeyIDCredentials.json"; File file = new File(filePath); try { SignedDataTokens signedTokens = SignedDataTokens.builder().setCredentials(file).build(); @@ -184,7 +180,7 @@ public void testNoKeyIDInCredentials() { @Test public void testInvalidPrivateKeyInCredentials() { - String filePath = "./src/test/resources/invalidPrivateKeyCredentials.json"; + String filePath = "./test/resources/invalidPrivateKeyCredentials.json"; File file = new File(filePath); try { SignedDataTokens signedTokens = SignedDataTokens.builder().setCredentials(file).build(); diff --git a/src/test/java/com/skyflow/serviceaccount/util/TokenTests.java b/common/test/java/com/skyflow/serviceaccount/util/TokenTests.java similarity index 87% rename from src/test/java/com/skyflow/serviceaccount/util/TokenTests.java rename to common/test/java/com/skyflow/serviceaccount/util/TokenTests.java index ed5c72b2..587527cf 100644 --- a/src/test/java/com/skyflow/serviceaccount/util/TokenTests.java +++ b/common/test/java/com/skyflow/serviceaccount/util/TokenTests.java @@ -1,6 +1,6 @@ package com.skyflow.serviceaccount.util; -import com.skyflow.Skyflow; +// import com.skyflow.Skyflow; import com.skyflow.enums.LogLevel; import io.github.cdimascio.dotenv.Dotenv; import org.junit.Assert; @@ -10,10 +10,10 @@ public class TokenTests { private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; - @BeforeClass - public static void setup() { - Skyflow skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).build(); - } + // @BeforeClass + // public static void setup() { + // Skyflow skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).build(); + // } @Test public void testNoTokenForIsExpiredToken() { diff --git a/common/test/java/com/skyflow/utils/BaseUtilsTests.java b/common/test/java/com/skyflow/utils/BaseUtilsTests.java new file mode 100644 index 00000000..60958841 --- /dev/null +++ b/common/test/java/com/skyflow/utils/BaseUtilsTests.java @@ -0,0 +1,22 @@ +package com.skyflow.utils; + +import com.google.gson.JsonObject; +import org.junit.Assert; +import org.junit.Test; + +public class BaseUtilsTests { + private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; + private static final String EXCEPTION_NOT_THROWN = "Should have thrown an exception"; + + @Test + public void testGetBaseMetrics() { + try { + JsonObject metrics = BaseUtils.getCommonMetrics(); + Assert.assertNotNull(metrics.get(BaseConstants.SDK_METRIC_RUNTIME_DETAILS).getAsString()); + Assert.assertNotNull(metrics.get(BaseConstants.SDK_METRIC_CLIENT_DEVICE_MODEL).getAsString()); + Assert.assertNotNull(metrics.get(BaseConstants.SDK_METRIC_CLIENT_OS_DETAILS).getAsString()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } +} diff --git a/src/test/resources/invalidPrivateKeyCredentials.json b/common/test/resources/invalidPrivateKeyCredentials.json similarity index 100% rename from src/test/resources/invalidPrivateKeyCredentials.json rename to common/test/resources/invalidPrivateKeyCredentials.json diff --git a/src/test/resources/invalidTokenURICredentials.json b/common/test/resources/invalidTokenURICredentials.json similarity index 100% rename from src/test/resources/invalidTokenURICredentials.json rename to common/test/resources/invalidTokenURICredentials.json diff --git a/src/test/resources/noClientIDCredentials.json b/common/test/resources/noClientIDCredentials.json similarity index 100% rename from src/test/resources/noClientIDCredentials.json rename to common/test/resources/noClientIDCredentials.json diff --git a/src/test/resources/noKeyIDCredentials.json b/common/test/resources/noKeyIDCredentials.json similarity index 100% rename from src/test/resources/noKeyIDCredentials.json rename to common/test/resources/noKeyIDCredentials.json diff --git a/src/test/resources/noPrivateKeyCredentials.json b/common/test/resources/noPrivateKeyCredentials.json similarity index 100% rename from src/test/resources/noPrivateKeyCredentials.json rename to common/test/resources/noPrivateKeyCredentials.json diff --git a/src/test/resources/noTokenURICredentials.json b/common/test/resources/noTokenURICredentials.json similarity index 100% rename from src/test/resources/noTokenURICredentials.json rename to common/test/resources/noTokenURICredentials.json diff --git a/src/test/resources/notJson.txt b/common/test/resources/notJson.txt similarity index 100% rename from src/test/resources/notJson.txt rename to common/test/resources/notJson.txt diff --git a/pom.xml b/pom.xml index df054845..1c115553 100644 --- a/pom.xml +++ b/pom.xml @@ -5,9 +5,9 @@ 4.0.0 com.skyflow - skyflow-java - 2.0.0-beta.2 - jar + skyflow + 1.0.0 + pom ${project.groupId}:${project.artifactId} Skyflow SDK for the Java programming language @@ -25,6 +25,11 @@ skyflow + + common + v2 + v3 + scm:git:git://github.com:skyflowapi/skyflow-java.git scm:git:ssh://github.com:skyflowapi/skyflow-java.git @@ -32,6 +37,7 @@ + true 8 8 4.12.0 @@ -45,12 +51,6 @@ - - com.squareup.okhttp3 - okhttp - 4.12.0 - compile - com.fasterxml.jackson.core jackson-databind @@ -170,7 +170,8 @@ 3.2.0 - com.skyflow.generated.rest.* + com.skyflow.generated.rest.*: + com.skyflow.generated.auth.*: @@ -179,6 +180,7 @@ jar + @@ -257,8 +259,22 @@ https://repo.maven.apache.org/maven2/ - + + jfrog + + + central + prekarilabs.jfrog.io-releases + https://prekarilabs.jfrog.io/artifactory/skyflow-java + + + snapshots + prekarilabs.jfrog.io-snapshots + https://prekarilabs.jfrog.io/artifactory/skyflow-java + + + maven-central @@ -287,20 +303,5 @@ - - jfrog - - - central - prekarilabs.jfrog.io-releases - https://prekarilabs.jfrog.io/artifactory/skyflow-java - - - snapshots - prekarilabs.jfrog.io-snapshots - https://prekarilabs.jfrog.io/artifactory/skyflow-java - - - - + \ No newline at end of file diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh index d729ea63..fcc1fd3f 100755 --- a/scripts/bump_version.sh +++ b/scripts/bump_version.sh @@ -1,7 +1,8 @@ # Input Arguments Version=$1 CommitHash=$2 -PomFile="$GITHUB_WORKSPACE/pom.xml" +Module=$3 +PomFile="$GITHUB_WORKSPACE/v3/pom.xml" if [ -z "$Version" ]; then echo "Error: Version argument is required." @@ -26,15 +27,16 @@ if [ -z "$CommitHash" ]; then else echo "Bumping main project version to $Version-dev-$CommitHash" - awk -v version="$Version-dev.$CommitHash" ' - BEGIN { updated = 0 } - // && updated == 0 { - sub(/.*<\/version>/, "" version "") - updated = 1 - } - { print } - ' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile + awk -v version="$Version${CommitHash:+-dev.$CommitHash}" ' + BEGIN { updated = 0 } + //,/<\/parent>/ { print; next } + // && updated == 0 { + sub(/.*<\/version>/, "" version "") + updated = 1 + } + { print } + ' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile - echo "--------------------------" - echo "Done. Main project version now at $Version-dev.$CommitHash" +echo "--------------------------" +echo "Done. v3 module version now at $Version${CommitHash:+-dev.$CommitHash}" fi diff --git a/src/main/java/com/skyflow/config/ManagementConfig.java b/src/main/java/com/skyflow/config/ManagementConfig.java deleted file mode 100644 index a054c8ea..00000000 --- a/src/main/java/com/skyflow/config/ManagementConfig.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.skyflow.config; - -public class ManagementConfig { - // members - - // constructor - ManagementConfig() { - } - - // getters and setters -} diff --git a/src/main/java/com/skyflow/vault/audit/ListEventRequest.java b/src/main/java/com/skyflow/vault/audit/ListEventRequest.java deleted file mode 100644 index b6c26b6d..00000000 --- a/src/main/java/com/skyflow/vault/audit/ListEventRequest.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.skyflow.vault.audit; - -public class ListEventRequest { - // members - - // constructor - public ListEventRequest() { - } - - // getters ans setters -} diff --git a/src/main/java/com/skyflow/vault/audit/ListEventResponse.java b/src/main/java/com/skyflow/vault/audit/ListEventResponse.java deleted file mode 100644 index 2647e617..00000000 --- a/src/main/java/com/skyflow/vault/audit/ListEventResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.skyflow.vault.audit; - -public class ListEventResponse { - // members - - public ListEventResponse() { - } - - // getters ans setters -} diff --git a/src/main/java/com/skyflow/vault/bin/GetBinRequest.java b/src/main/java/com/skyflow/vault/bin/GetBinRequest.java deleted file mode 100644 index d059245f..00000000 --- a/src/main/java/com/skyflow/vault/bin/GetBinRequest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.skyflow.vault.bin; - -public class GetBinRequest { - // members - - public GetBinRequest() { - } - - // getters ans setters -} diff --git a/src/main/java/com/skyflow/vault/bin/GetBinResponse.java b/src/main/java/com/skyflow/vault/bin/GetBinResponse.java deleted file mode 100644 index 86210031..00000000 --- a/src/main/java/com/skyflow/vault/bin/GetBinResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.skyflow.vault.bin; - -public class GetBinResponse { - // members - - public GetBinResponse() { - } - - // getters ans setters -} diff --git a/src/main/java/com/skyflow/vault/controller/AuditController.java b/src/main/java/com/skyflow/vault/controller/AuditController.java deleted file mode 100644 index 2faa04a6..00000000 --- a/src/main/java/com/skyflow/vault/controller/AuditController.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.skyflow.vault.controller; - -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.vault.audit.ListEventRequest; -import com.skyflow.vault.audit.ListEventResponse; - -public class AuditController { - - public AuditController(ApiClient apiClient) { - - } - - // Check for correct return type in python interfaces - public ListEventResponse list(ListEventRequest listEventRequest) { - // return audit events - return null; - } -} diff --git a/src/main/java/com/skyflow/vault/controller/BinLookupController.java b/src/main/java/com/skyflow/vault/controller/BinLookupController.java deleted file mode 100644 index 4eb7a1c8..00000000 --- a/src/main/java/com/skyflow/vault/controller/BinLookupController.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.skyflow.vault.controller; - -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.vault.bin.GetBinRequest; -import com.skyflow.vault.bin.GetBinResponse; - -public class BinLookupController { - - public BinLookupController(ApiClient apiClient) { - } - - public GetBinResponse get(GetBinRequest getBinRequest) { - // return bin lookup response (card metadata associated with BIN) - return null; - } -} diff --git a/v2/pom.xml b/v2/pom.xml new file mode 100644 index 00000000..e239bc85 --- /dev/null +++ b/v2/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + com.skyflow + skyflow + 1.0.0 + ../pom.xml + + + skyflow-java + 2.0.0-beta.3 + com.skyflow + + + 8 + 8 + UTF-8 + + + + + com.skyflow + common + 1.0.0 + + + + \ No newline at end of file diff --git a/src/main/java/com/skyflow/ConnectionClient.java b/v2/src/main/java/com/skyflow/ConnectionClient.java similarity index 95% rename from src/main/java/com/skyflow/ConnectionClient.java rename to v2/src/main/java/com/skyflow/ConnectionClient.java index 7cb10713..79541add 100644 --- a/src/main/java/com/skyflow/ConnectionClient.java +++ b/v2/src/main/java/com/skyflow/ConnectionClient.java @@ -1,12 +1,12 @@ package com.skyflow; +import com.skyflow.serviceaccount.util.Token; import com.skyflow.config.ConnectionConfig; import com.skyflow.config.Credentials; import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.logs.InfoLogs; -import com.skyflow.serviceaccount.util.Token; import com.skyflow.utils.Constants; import com.skyflow.utils.Utils; import com.skyflow.utils.logger.LogUtil; @@ -40,7 +40,7 @@ protected void updateConnectionConfig(ConnectionConfig connectionConfig) throws prioritiseCredentials(); } - protected void setBearerToken() throws SkyflowException { + protected void setBearerToken() throws SkyflowException, com.skyflow.errors.SkyflowException { prioritiseCredentials(); Validations.validateCredentials(this.finalCredentials); if (this.finalCredentials.getApiKey() != null) { @@ -57,7 +57,7 @@ private void setApiKey() { if (apiKey == null) { apiKey = this.finalCredentials.getApiKey(); } else { - LogUtil.printInfoLog(InfoLogs.REUSE_API_KEY.getLog()); + LogUtil.printInfoLog(InfoLogs.USE_API_KEY.getLog()); } } diff --git a/src/main/java/com/skyflow/Skyflow.java b/v2/src/main/java/com/skyflow/Skyflow.java similarity index 95% rename from src/main/java/com/skyflow/Skyflow.java rename to v2/src/main/java/com/skyflow/Skyflow.java index 8e51da57..03e38c3a 100644 --- a/src/main/java/com/skyflow/Skyflow.java +++ b/v2/src/main/java/com/skyflow/Skyflow.java @@ -10,6 +10,8 @@ import com.skyflow.errors.SkyflowException; import com.skyflow.logs.ErrorLogs; import com.skyflow.logs.InfoLogs; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.utils.logger.LogUtil; import com.skyflow.utils.validations.Validations; @@ -19,15 +21,17 @@ import java.util.LinkedHashMap; -public final class Skyflow { +public final class Skyflow extends BaseSkyflow { private final SkyflowClientBuilder builder; private Skyflow(SkyflowClientBuilder builder) { + super(builder); this.builder = builder; LogUtil.printInfoLog(InfoLogs.CLIENT_INITIALIZED.getLog()); } public static SkyflowClientBuilder builder() { + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); return new SkyflowClientBuilder(); } @@ -79,10 +83,6 @@ public Skyflow updateLogLevel(LogLevel logLevel) { return this; } - public LogLevel getLogLevel() { - return this.builder.logLevel; - } - public VaultController vault() throws SkyflowException { Object[] array = this.builder.vaultClientsMap.keySet().toArray(); if (array.length < 1) { @@ -102,7 +102,6 @@ public VaultController vault(String vaultId) throws SkyflowException { return controller; } - public ConnectionController connection() throws SkyflowException { Object[] array = this.builder.connectionsMap.keySet().toArray(); if (array.length < 1) { @@ -141,23 +140,18 @@ public DetectController detect(String vaultId) throws SkyflowException { return controller; } - public static final class SkyflowClientBuilder { + public static final class SkyflowClientBuilder extends BaseSkyflowClientBuilder { private final LinkedHashMap connectionsMap; private final LinkedHashMap vaultClientsMap; private final LinkedHashMap detectClientsMap; - private final LinkedHashMap vaultConfigMap; private final LinkedHashMap connectionConfigMap; - private Credentials skyflowCredentials; - private LogLevel logLevel; public SkyflowClientBuilder() { + super(); this.vaultClientsMap = new LinkedHashMap<>(); this.detectClientsMap = new LinkedHashMap<>(); - this.vaultConfigMap = new LinkedHashMap<>(); this.connectionsMap = new LinkedHashMap<>(); this.connectionConfigMap = new LinkedHashMap<>(); - this.skyflowCredentials = null; - this.logLevel = LogLevel.ERROR; } public SkyflowClientBuilder addVaultConfig(VaultConfig vaultConfig) throws SkyflowException { @@ -271,12 +265,9 @@ public SkyflowClientBuilder addSkyflowCredentials(Credentials credentials) throw return this; } + @Override public SkyflowClientBuilder setLogLevel(LogLevel logLevel) { - this.logLevel = logLevel == null ? LogLevel.ERROR : logLevel; - LogUtil.setupLogger(this.logLevel); - LogUtil.printInfoLog(Utils.parameterizedString( - InfoLogs.CURRENT_LOG_LEVEL.getLog(), String.valueOf(logLevel) - )); + super.setLogLevel(logLevel); return this; } diff --git a/src/main/java/com/skyflow/VaultClient.java b/v2/src/main/java/com/skyflow/VaultClient.java similarity index 99% rename from src/main/java/com/skyflow/VaultClient.java rename to v2/src/main/java/com/skyflow/VaultClient.java index 7536a2c1..e9981523 100644 --- a/src/main/java/com/skyflow/VaultClient.java +++ b/v2/src/main/java/com/skyflow/VaultClient.java @@ -24,8 +24,8 @@ import com.skyflow.generated.rest.resources.tokens.TokensClient; import com.skyflow.generated.rest.resources.tokens.requests.V1DetokenizePayload; import com.skyflow.generated.rest.resources.tokens.requests.V1TokenizePayload; -import com.skyflow.generated.rest.types.*; import com.skyflow.generated.rest.types.Transformations; +import com.skyflow.generated.rest.types.*; import com.skyflow.logs.InfoLogs; import com.skyflow.serviceaccount.util.Token; import com.skyflow.utils.Constants; @@ -34,9 +34,9 @@ import com.skyflow.utils.validations.Validations; import com.skyflow.vault.data.InsertRequest; import com.skyflow.vault.data.UpdateRequest; -import com.skyflow.vault.detect.*; import com.skyflow.vault.detect.DeidentifyFileRequest; import com.skyflow.vault.detect.DeidentifyTextRequest; +import com.skyflow.vault.detect.*; import com.skyflow.vault.tokens.ColumnValue; import com.skyflow.vault.tokens.DetokenizeData; import com.skyflow.vault.tokens.DetokenizeRequest; @@ -78,7 +78,7 @@ protected StringsClient getDetectTextApi() { return this.apiClient.strings(); } - protected FilesClient getDetectFileAPi(){ + protected FilesClient getDetectFileAPi() { return this.apiClient.files(); } @@ -213,8 +213,8 @@ protected void setBearerToken() throws SkyflowException { prioritiseCredentials(); Validations.validateCredentials(this.finalCredentials); if (this.finalCredentials.getApiKey() != null) { - LogUtil.printInfoLog(InfoLogs.REUSE_API_KEY.getLog()); - token=this.finalCredentials.getApiKey(); + LogUtil.printInfoLog(InfoLogs.USE_API_KEY.getLog()); + token = this.finalCredentials.getApiKey(); } else if (Token.isExpired(token)) { LogUtil.printInfoLog(InfoLogs.BEARER_TOKEN_EXPIRED.getLog()); token = Utils.generateBearerToken(this.finalCredentials); @@ -387,7 +387,7 @@ private Transformations getTransformations(com.skyflow.vault.detect.Transformati .build(); } - private List getEntityTypes(List entities){ + private List getEntityTypes(List entities) { List mappedEntityTypes = null; if (entities != null) { mappedEntityTypes = entities.stream() @@ -398,7 +398,7 @@ private List getEntityTypes(List entities){ return mappedEntityTypes; } - protected com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest getDeidentifyTextFileRequest(DeidentifyFileRequest request, String vaultId, String base64Content){ + protected com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest getDeidentifyTextFileRequest(DeidentifyFileRequest request, String vaultId, String base64Content) { List mappedEntityTypes = getEntityTypes(request.getEntities()); TokenFormat tokenFormat = request.getTokenFormat(); diff --git a/src/main/java/com/skyflow/config/ConnectionConfig.java b/v2/src/main/java/com/skyflow/config/ConnectionConfig.java similarity index 100% rename from src/main/java/com/skyflow/config/ConnectionConfig.java rename to v2/src/main/java/com/skyflow/config/ConnectionConfig.java diff --git a/src/main/java/com/skyflow/enums/DeidentifyFileStatus.java b/v2/src/main/java/com/skyflow/enums/DeidentifyFileStatus.java similarity index 100% rename from src/main/java/com/skyflow/enums/DeidentifyFileStatus.java rename to v2/src/main/java/com/skyflow/enums/DeidentifyFileStatus.java diff --git a/src/main/java/com/skyflow/enums/DetectEntities.java b/v2/src/main/java/com/skyflow/enums/DetectEntities.java similarity index 100% rename from src/main/java/com/skyflow/enums/DetectEntities.java rename to v2/src/main/java/com/skyflow/enums/DetectEntities.java diff --git a/src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java b/v2/src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java similarity index 100% rename from src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java rename to v2/src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java diff --git a/src/main/java/com/skyflow/enums/MaskingMethod.java b/v2/src/main/java/com/skyflow/enums/MaskingMethod.java similarity index 100% rename from src/main/java/com/skyflow/enums/MaskingMethod.java rename to v2/src/main/java/com/skyflow/enums/MaskingMethod.java diff --git a/src/main/java/com/skyflow/enums/RedactionType.java b/v2/src/main/java/com/skyflow/enums/RedactionType.java similarity index 100% rename from src/main/java/com/skyflow/enums/RedactionType.java rename to v2/src/main/java/com/skyflow/enums/RedactionType.java diff --git a/src/main/java/com/skyflow/enums/RequestMethod.java b/v2/src/main/java/com/skyflow/enums/RequestMethod.java similarity index 100% rename from src/main/java/com/skyflow/enums/RequestMethod.java rename to v2/src/main/java/com/skyflow/enums/RequestMethod.java diff --git a/src/main/java/com/skyflow/enums/TokenMode.java b/v2/src/main/java/com/skyflow/enums/TokenMode.java similarity index 100% rename from src/main/java/com/skyflow/enums/TokenMode.java rename to v2/src/main/java/com/skyflow/enums/TokenMode.java diff --git a/src/main/java/com/skyflow/enums/TokenType.java b/v2/src/main/java/com/skyflow/enums/TokenType.java similarity index 100% rename from src/main/java/com/skyflow/enums/TokenType.java rename to v2/src/main/java/com/skyflow/enums/TokenType.java diff --git a/src/main/java/com/skyflow/generated/rest/ApiClient.java b/v2/src/main/java/com/skyflow/generated/rest/ApiClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/ApiClient.java rename to v2/src/main/java/com/skyflow/generated/rest/ApiClient.java diff --git a/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java b/v2/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java rename to v2/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java diff --git a/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java b/v2/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/AsyncApiClient.java rename to v2/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java diff --git a/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java b/v2/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java rename to v2/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java diff --git a/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java b/v2/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java index a4487b1e..4fab1d41 100644 --- a/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java +++ b/v2/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java @@ -65,7 +65,7 @@ public Map> headers() { return this.headers; } - @java.lang.Override + @Override public String toString() { return "ApiClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body + "}"; diff --git a/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java b/v2/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/ApiClientException.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java diff --git a/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java b/v2/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java diff --git a/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java b/v2/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/ClientOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java diff --git a/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java b/v2/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java rename to v2/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java diff --git a/src/main/java/com/skyflow/generated/rest/core/Environment.java b/v2/src/main/java/com/skyflow/generated/rest/core/Environment.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/Environment.java rename to v2/src/main/java/com/skyflow/generated/rest/core/Environment.java diff --git a/src/main/java/com/skyflow/generated/rest/core/FileStream.java b/v2/src/main/java/com/skyflow/generated/rest/core/FileStream.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/FileStream.java rename to v2/src/main/java/com/skyflow/generated/rest/core/FileStream.java diff --git a/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java b/v2/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java rename to v2/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java diff --git a/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java b/v2/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/MediaTypes.java rename to v2/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java diff --git a/src/main/java/com/skyflow/generated/rest/core/Nullable.java b/v2/src/main/java/com/skyflow/generated/rest/core/Nullable.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/Nullable.java rename to v2/src/main/java/com/skyflow/generated/rest/core/Nullable.java diff --git a/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java b/v2/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java rename to v2/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java diff --git a/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java b/v2/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java diff --git a/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java b/v2/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java rename to v2/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java diff --git a/src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java b/v2/src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java rename to v2/src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java diff --git a/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java b/v2/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/RequestOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java diff --git a/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java b/v2/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java diff --git a/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java b/v2/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java rename to v2/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java diff --git a/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java b/v2/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java rename to v2/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java diff --git a/src/main/java/com/skyflow/generated/rest/core/Stream.java b/v2/src/main/java/com/skyflow/generated/rest/core/Stream.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/Stream.java rename to v2/src/main/java/com/skyflow/generated/rest/core/Stream.java diff --git a/src/main/java/com/skyflow/generated/rest/core/Suppliers.java b/v2/src/main/java/com/skyflow/generated/rest/core/Suppliers.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/core/Suppliers.java rename to v2/src/main/java/com/skyflow/generated/rest/core/Suppliers.java diff --git a/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java b/v2/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java rename to v2/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java index c8d4bb99..80ae5e7c 100644 --- a/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java +++ b/v2/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java @@ -25,7 +25,7 @@ public BadRequestError(Object body, Response rawResponse) { /** * @return the body */ - @java.lang.Override + @Override public Object body() { return this.body; } diff --git a/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java b/v2/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java rename to v2/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java index d29f2b82..ffeed9d7 100644 --- a/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java +++ b/v2/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java @@ -26,7 +26,7 @@ public InternalServerError(ErrorResponse body, Response rawResponse) { /** * @return the body */ - @java.lang.Override + @Override public ErrorResponse body() { return this.body; } diff --git a/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java b/v2/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java rename to v2/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java index efa94aad..1d0a6ad0 100644 --- a/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java +++ b/v2/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java @@ -25,7 +25,7 @@ public NotFoundError(Object body, Response rawResponse) { /** * @return the body */ - @java.lang.Override + @Override public Object body() { return this.body; } diff --git a/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java b/v2/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java rename to v2/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java index 3b6d6ae1..3bc254bc 100644 --- a/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java +++ b/v2/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java @@ -25,7 +25,7 @@ public UnauthorizedError(Object body, Response rawResponse) { /** * @return the body */ - @java.lang.Override + @Override public Object body() { return this.body; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java index 875ca259..e1516eaf 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java @@ -4,27 +4,15 @@ package com.skyflow.generated.rest.resources.audit; import com.fasterxml.jackson.core.JsonProcessingException; -import com.skyflow.generated.rest.core.ApiClientApiException; -import com.skyflow.generated.rest.core.ApiClientException; -import com.skyflow.generated.rest.core.ApiClientHttpResponse; -import com.skyflow.generated.rest.core.ClientOptions; -import com.skyflow.generated.rest.core.ObjectMappers; -import com.skyflow.generated.rest.core.QueryStringMapper; -import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.core.*; import com.skyflow.generated.rest.errors.NotFoundError; import com.skyflow.generated.rest.resources.audit.requests.AuditServiceListAuditEventsRequest; import com.skyflow.generated.rest.types.V1AuditResponse; +import okhttp3.*; +import org.jetbrains.annotations.NotNull; + import java.io.IOException; import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; public class AsyncRawAuditClient { protected final ClientOptions clientOptions; diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java index 3da04589..8b6686e4 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java @@ -430,7 +430,7 @@ public Optional getOffset() { return offset; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AuditServiceListAuditEventsRequest @@ -478,7 +478,7 @@ private boolean equalTo(AuditServiceListAuditEventsRequest other) { && offset.equals(other.offset); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.filterOpsContextChangeId, @@ -516,7 +516,7 @@ public int hashCode() { this.offset); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -848,7 +848,7 @@ public static final class Builder implements FilterOpsAccountIdStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(AuditServiceListAuditEventsRequest other) { filterOpsContextChangeId(other.getFilterOpsContextChangeId()); filterOpsContextRequestId(other.getFilterOpsContextRequestId()); @@ -890,7 +890,7 @@ public Builder from(AuditServiceListAuditEventsRequest other) { * Resources with the specified account ID.

Resources with the specified account ID.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("filterOps.accountID") public _FinalStage filterOpsAccountId(@NotNull String filterOpsAccountId) { this.filterOpsAccountId = Objects.requireNonNull(filterOpsAccountId, "filterOpsAccountId must not be null"); @@ -901,7 +901,7 @@ public _FinalStage filterOpsAccountId(@NotNull String filterOpsAccountId) { *

Record position at which to start returning results.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; @@ -910,7 +910,7 @@ public _FinalStage offset(Long offset) { /** *

Record position at which to start returning results.

*/ - @java.lang.Override + @Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) public _FinalStage offset(Optional offset) { this.offset = offset; @@ -921,7 +921,7 @@ public _FinalStage offset(Optional offset) { *

Number of results to return.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; @@ -930,7 +930,7 @@ public _FinalStage limit(Long limit) { /** *

Number of results to return.

*/ - @java.lang.Override + @Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) public _FinalStage limit(Optional limit) { this.limit = limit; @@ -941,7 +941,7 @@ public _FinalStage limit(Optional limit) { *

Change ID provided in the previous audit response's nextOps attribute. An alternate way to manage response pagination. Can't be used with sortOps or offset. For the first request in a series of audit requests, leave blank.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage afterOpsChangeId(String afterOpsChangeId) { this.afterOpsChangeId = Optional.ofNullable(afterOpsChangeId); return this; @@ -950,7 +950,7 @@ public _FinalStage afterOpsChangeId(String afterOpsChangeId) { /** *

Change ID provided in the previous audit response's nextOps attribute. An alternate way to manage response pagination. Can't be used with sortOps or offset. For the first request in a series of audit requests, leave blank.

*/ - @java.lang.Override + @Override @JsonSetter(value = "afterOps.changeID", nulls = Nulls.SKIP) public _FinalStage afterOpsChangeId(Optional afterOpsChangeId) { this.afterOpsChangeId = afterOpsChangeId; @@ -961,7 +961,7 @@ public _FinalStage afterOpsChangeId(Optional afterOpsChangeId) { *

Timestamp provided in the previous audit response's nextOps attribute. An alternate way to manage response pagination. Can't be used with sortOps or offset. For the first request in a series of audit requests, leave blank.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage afterOpsTimestamp(String afterOpsTimestamp) { this.afterOpsTimestamp = Optional.ofNullable(afterOpsTimestamp); return this; @@ -970,7 +970,7 @@ public _FinalStage afterOpsTimestamp(String afterOpsTimestamp) { /** *

Timestamp provided in the previous audit response's nextOps attribute. An alternate way to manage response pagination. Can't be used with sortOps or offset. For the first request in a series of audit requests, leave blank.

*/ - @java.lang.Override + @Override @JsonSetter(value = "afterOps.timestamp", nulls = Nulls.SKIP) public _FinalStage afterOpsTimestamp(Optional afterOpsTimestamp) { this.afterOpsTimestamp = afterOpsTimestamp; @@ -981,7 +981,7 @@ public _FinalStage afterOpsTimestamp(Optional afterOpsTimestamp) { *

Ascending or descending ordering of results.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage sortOpsOrderBy(AuditServiceListAuditEventsRequestSortOpsOrderBy sortOpsOrderBy) { this.sortOpsOrderBy = Optional.ofNullable(sortOpsOrderBy); return this; @@ -990,7 +990,7 @@ public _FinalStage sortOpsOrderBy(AuditServiceListAuditEventsRequestSortOpsOrder /** *

Ascending or descending ordering of results.

*/ - @java.lang.Override + @Override @JsonSetter(value = "sortOps.orderBy", nulls = Nulls.SKIP) public _FinalStage sortOpsOrderBy(Optional sortOpsOrderBy) { this.sortOpsOrderBy = sortOpsOrderBy; @@ -1001,7 +1001,7 @@ public _FinalStage sortOpsOrderBy(OptionalFully-qualified field by which to sort results. Field names should be in camel case (for example, "capitalization.camelCase").

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage sortOpsSortBy(String sortOpsSortBy) { this.sortOpsSortBy = Optional.ofNullable(sortOpsSortBy); return this; @@ -1010,7 +1010,7 @@ public _FinalStage sortOpsSortBy(String sortOpsSortBy) { /** *

Fully-qualified field by which to sort results. Field names should be in camel case (for example, "capitalization.camelCase").

*/ - @java.lang.Override + @Override @JsonSetter(value = "sortOps.sortBy", nulls = Nulls.SKIP) public _FinalStage sortOpsSortBy(Optional sortOpsSortBy) { this.sortOpsSortBy = sortOpsSortBy; @@ -1021,7 +1021,7 @@ public _FinalStage sortOpsSortBy(Optional sortOpsSortBy) { *

HTTP URI of the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsHttpUri(String filterOpsHttpUri) { this.filterOpsHttpUri = Optional.ofNullable(filterOpsHttpUri); return this; @@ -1030,7 +1030,7 @@ public _FinalStage filterOpsHttpUri(String filterOpsHttpUri) { /** *

HTTP URI of the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.httpURI", nulls = Nulls.SKIP) public _FinalStage filterOpsHttpUri(Optional filterOpsHttpUri) { this.filterOpsHttpUri = filterOpsHttpUri; @@ -1041,7 +1041,7 @@ public _FinalStage filterOpsHttpUri(Optional filterOpsHttpUri) { *

HTTP method of the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsHttpMethod(String filterOpsHttpMethod) { this.filterOpsHttpMethod = Optional.ofNullable(filterOpsHttpMethod); return this; @@ -1050,7 +1050,7 @@ public _FinalStage filterOpsHttpMethod(String filterOpsHttpMethod) { /** *

HTTP method of the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.httpMethod", nulls = Nulls.SKIP) public _FinalStage filterOpsHttpMethod(Optional filterOpsHttpMethod) { this.filterOpsHttpMethod = filterOpsHttpMethod; @@ -1061,7 +1061,7 @@ public _FinalStage filterOpsHttpMethod(Optional filterOpsHttpMethod) { *

Response message of the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsResponseMessage(String filterOpsResponseMessage) { this.filterOpsResponseMessage = Optional.ofNullable(filterOpsResponseMessage); return this; @@ -1070,7 +1070,7 @@ public _FinalStage filterOpsResponseMessage(String filterOpsResponseMessage) { /** *

Response message of the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.responseMessage", nulls = Nulls.SKIP) public _FinalStage filterOpsResponseMessage(Optional filterOpsResponseMessage) { this.filterOpsResponseMessage = filterOpsResponseMessage; @@ -1081,7 +1081,7 @@ public _FinalStage filterOpsResponseMessage(Optional filterOpsResponseMe *

Name of the API called in the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsApiName(String filterOpsApiName) { this.filterOpsApiName = Optional.ofNullable(filterOpsApiName); return this; @@ -1090,7 +1090,7 @@ public _FinalStage filterOpsApiName(String filterOpsApiName) { /** *

Name of the API called in the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.apiName", nulls = Nulls.SKIP) public _FinalStage filterOpsApiName(Optional filterOpsApiName) { this.filterOpsApiName = filterOpsApiName; @@ -1101,7 +1101,7 @@ public _FinalStage filterOpsApiName(Optional filterOpsApiName) { *

End timestamp for the query, in SQL format.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsEndTime(String filterOpsEndTime) { this.filterOpsEndTime = Optional.ofNullable(filterOpsEndTime); return this; @@ -1110,7 +1110,7 @@ public _FinalStage filterOpsEndTime(String filterOpsEndTime) { /** *

End timestamp for the query, in SQL format.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.endTime", nulls = Nulls.SKIP) public _FinalStage filterOpsEndTime(Optional filterOpsEndTime) { this.filterOpsEndTime = filterOpsEndTime; @@ -1121,7 +1121,7 @@ public _FinalStage filterOpsEndTime(Optional filterOpsEndTime) { *

Start timestamp for the query, in SQL format.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsStartTime(String filterOpsStartTime) { this.filterOpsStartTime = Optional.ofNullable(filterOpsStartTime); return this; @@ -1130,7 +1130,7 @@ public _FinalStage filterOpsStartTime(String filterOpsStartTime) { /** *

Start timestamp for the query, in SQL format.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.startTime", nulls = Nulls.SKIP) public _FinalStage filterOpsStartTime(Optional filterOpsStartTime) { this.filterOpsStartTime = filterOpsStartTime; @@ -1141,7 +1141,7 @@ public _FinalStage filterOpsStartTime(Optional filterOpsStartTime) { *

HTTP response code of the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsResponseCode(Integer filterOpsResponseCode) { this.filterOpsResponseCode = Optional.ofNullable(filterOpsResponseCode); return this; @@ -1150,7 +1150,7 @@ public _FinalStage filterOpsResponseCode(Integer filterOpsResponseCode) { /** *

HTTP response code of the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.responseCode", nulls = Nulls.SKIP) public _FinalStage filterOpsResponseCode(Optional filterOpsResponseCode) { this.filterOpsResponseCode = filterOpsResponseCode; @@ -1161,7 +1161,7 @@ public _FinalStage filterOpsResponseCode(Optional filterOpsResponseCode *

Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, "login, get".

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsTags(String filterOpsTags) { this.filterOpsTags = Optional.ofNullable(filterOpsTags); return this; @@ -1170,7 +1170,7 @@ public _FinalStage filterOpsTags(String filterOpsTags) { /** *

Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, "login, get".

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.tags", nulls = Nulls.SKIP) public _FinalStage filterOpsTags(Optional filterOpsTags) { this.filterOpsTags = filterOpsTags; @@ -1181,7 +1181,7 @@ public _FinalStage filterOpsTags(Optional filterOpsTags) { *

Resources with the specified type.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsResourceType( AuditServiceListAuditEventsRequestFilterOpsResourceType filterOpsResourceType) { this.filterOpsResourceType = Optional.ofNullable(filterOpsResourceType); @@ -1191,7 +1191,7 @@ public _FinalStage filterOpsResourceType( /** *

Resources with the specified type.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.resourceType", nulls = Nulls.SKIP) public _FinalStage filterOpsResourceType( Optional filterOpsResourceType) { @@ -1203,7 +1203,7 @@ public _FinalStage filterOpsResourceType( *

Events with the specified action type.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsActionType( AuditServiceListAuditEventsRequestFilterOpsActionType filterOpsActionType) { this.filterOpsActionType = Optional.ofNullable(filterOpsActionType); @@ -1213,7 +1213,7 @@ public _FinalStage filterOpsActionType( /** *

Events with the specified action type.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.actionType", nulls = Nulls.SKIP) public _FinalStage filterOpsActionType( Optional filterOpsActionType) { @@ -1225,7 +1225,7 @@ public _FinalStage filterOpsActionType( *

Resources with a specified ID. If a resource matches at least one ID, the associated event is returned. Format is a comma-separated list of "<resourceType>/<resourceID>". For example, "VAULT/12345, USER/67890".

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsResourceIDs(String filterOpsResourceIDs) { this.filterOpsResourceIDs = Optional.ofNullable(filterOpsResourceIDs); return this; @@ -1234,7 +1234,7 @@ public _FinalStage filterOpsResourceIDs(String filterOpsResourceIDs) { /** *

Resources with a specified ID. If a resource matches at least one ID, the associated event is returned. Format is a comma-separated list of "<resourceType>/<resourceID>". For example, "VAULT/12345, USER/67890".

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.resourceIDs", nulls = Nulls.SKIP) public _FinalStage filterOpsResourceIDs(Optional filterOpsResourceIDs) { this.filterOpsResourceIDs = filterOpsResourceIDs; @@ -1245,7 +1245,7 @@ public _FinalStage filterOpsResourceIDs(Optional filterOpsResourceIDs) { *

Resources with the specified vault ID.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsVaultId(String filterOpsVaultId) { this.filterOpsVaultId = Optional.ofNullable(filterOpsVaultId); return this; @@ -1254,7 +1254,7 @@ public _FinalStage filterOpsVaultId(String filterOpsVaultId) { /** *

Resources with the specified vault ID.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.vaultID", nulls = Nulls.SKIP) public _FinalStage filterOpsVaultId(Optional filterOpsVaultId) { this.filterOpsVaultId = filterOpsVaultId; @@ -1265,7 +1265,7 @@ public _FinalStage filterOpsVaultId(Optional filterOpsVaultId) { *

Resources with the specified workspace ID.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsWorkspaceId(String filterOpsWorkspaceId) { this.filterOpsWorkspaceId = Optional.ofNullable(filterOpsWorkspaceId); return this; @@ -1274,7 +1274,7 @@ public _FinalStage filterOpsWorkspaceId(String filterOpsWorkspaceId) { /** *

Resources with the specified workspace ID.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.workspaceID", nulls = Nulls.SKIP) public _FinalStage filterOpsWorkspaceId(Optional filterOpsWorkspaceId) { this.filterOpsWorkspaceId = filterOpsWorkspaceId; @@ -1285,7 +1285,7 @@ public _FinalStage filterOpsWorkspaceId(Optional filterOpsWorkspaceId) { *

Resources with the specified parent account ID.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsParentAccountId(String filterOpsParentAccountId) { this.filterOpsParentAccountId = Optional.ofNullable(filterOpsParentAccountId); return this; @@ -1294,7 +1294,7 @@ public _FinalStage filterOpsParentAccountId(String filterOpsParentAccountId) { /** *

Resources with the specified parent account ID.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.parentAccountID", nulls = Nulls.SKIP) public _FinalStage filterOpsParentAccountId(Optional filterOpsParentAccountId) { this.filterOpsParentAccountId = filterOpsParentAccountId; @@ -1305,7 +1305,7 @@ public _FinalStage filterOpsParentAccountId(Optional filterOpsParentAcco *

Embedded User Context.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextBearerTokenContextId(String filterOpsContextBearerTokenContextId) { this.filterOpsContextBearerTokenContextId = Optional.ofNullable(filterOpsContextBearerTokenContextId); return this; @@ -1314,7 +1314,7 @@ public _FinalStage filterOpsContextBearerTokenContextId(String filterOpsContextB /** *

Embedded User Context.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.bearerTokenContextID", nulls = Nulls.SKIP) public _FinalStage filterOpsContextBearerTokenContextId(Optional filterOpsContextBearerTokenContextId) { this.filterOpsContextBearerTokenContextId = filterOpsContextBearerTokenContextId; @@ -1325,7 +1325,7 @@ public _FinalStage filterOpsContextBearerTokenContextId(Optional filterO *

ID of the JWT token.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextJwtId(String filterOpsContextJwtId) { this.filterOpsContextJwtId = Optional.ofNullable(filterOpsContextJwtId); return this; @@ -1334,7 +1334,7 @@ public _FinalStage filterOpsContextJwtId(String filterOpsContextJwtId) { /** *

ID of the JWT token.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.jwtID", nulls = Nulls.SKIP) public _FinalStage filterOpsContextJwtId(Optional filterOpsContextJwtId) { this.filterOpsContextJwtId = filterOpsContextJwtId; @@ -1345,7 +1345,7 @@ public _FinalStage filterOpsContextJwtId(Optional filterOpsContextJwtId) *

Authentication mode the actor used.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextAuthMode( AuditServiceListAuditEventsRequestFilterOpsContextAuthMode filterOpsContextAuthMode) { this.filterOpsContextAuthMode = Optional.ofNullable(filterOpsContextAuthMode); @@ -1355,7 +1355,7 @@ public _FinalStage filterOpsContextAuthMode( /** *

Authentication mode the actor used.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.authMode", nulls = Nulls.SKIP) public _FinalStage filterOpsContextAuthMode( Optional filterOpsContextAuthMode) { @@ -1367,7 +1367,7 @@ public _FinalStage filterOpsContextAuthMode( *

HTTP Origin request header (including scheme, hostname, and port) of the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextOrigin(String filterOpsContextOrigin) { this.filterOpsContextOrigin = Optional.ofNullable(filterOpsContextOrigin); return this; @@ -1376,7 +1376,7 @@ public _FinalStage filterOpsContextOrigin(String filterOpsContextOrigin) { /** *

HTTP Origin request header (including scheme, hostname, and port) of the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.origin", nulls = Nulls.SKIP) public _FinalStage filterOpsContextOrigin(Optional filterOpsContextOrigin) { this.filterOpsContextOrigin = filterOpsContextOrigin; @@ -1387,7 +1387,7 @@ public _FinalStage filterOpsContextOrigin(Optional filterOpsContextOrigi *

IP Address of the client that made the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextIpAddress(String filterOpsContextIpAddress) { this.filterOpsContextIpAddress = Optional.ofNullable(filterOpsContextIpAddress); return this; @@ -1396,7 +1396,7 @@ public _FinalStage filterOpsContextIpAddress(String filterOpsContextIpAddress) { /** *

IP Address of the client that made the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.ipAddress", nulls = Nulls.SKIP) public _FinalStage filterOpsContextIpAddress(Optional filterOpsContextIpAddress) { this.filterOpsContextIpAddress = filterOpsContextIpAddress; @@ -1407,7 +1407,7 @@ public _FinalStage filterOpsContextIpAddress(Optional filterOpsContextIp *

Type of access for the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextAccessType( AuditServiceListAuditEventsRequestFilterOpsContextAccessType filterOpsContextAccessType) { this.filterOpsContextAccessType = Optional.ofNullable(filterOpsContextAccessType); @@ -1417,7 +1417,7 @@ public _FinalStage filterOpsContextAccessType( /** *

Type of access for the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.accessType", nulls = Nulls.SKIP) public _FinalStage filterOpsContextAccessType( Optional filterOpsContextAccessType) { @@ -1429,7 +1429,7 @@ public _FinalStage filterOpsContextAccessType( *

Type of member who sent the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextActorType( AuditServiceListAuditEventsRequestFilterOpsContextActorType filterOpsContextActorType) { this.filterOpsContextActorType = Optional.ofNullable(filterOpsContextActorType); @@ -1439,7 +1439,7 @@ public _FinalStage filterOpsContextActorType( /** *

Type of member who sent the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.actorType", nulls = Nulls.SKIP) public _FinalStage filterOpsContextActorType( Optional filterOpsContextActorType) { @@ -1451,7 +1451,7 @@ public _FinalStage filterOpsContextActorType( *

Member who sent the request. Depending on actorType, this may be a user ID or a service account ID.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextActor(String filterOpsContextActor) { this.filterOpsContextActor = Optional.ofNullable(filterOpsContextActor); return this; @@ -1460,7 +1460,7 @@ public _FinalStage filterOpsContextActor(String filterOpsContextActor) { /** *

Member who sent the request. Depending on actorType, this may be a user ID or a service account ID.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.actor", nulls = Nulls.SKIP) public _FinalStage filterOpsContextActor(Optional filterOpsContextActor) { this.filterOpsContextActor = filterOpsContextActor; @@ -1471,7 +1471,7 @@ public _FinalStage filterOpsContextActor(Optional filterOpsContextActor) *

ID for the session in which the request was sent.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextSessionId(String filterOpsContextSessionId) { this.filterOpsContextSessionId = Optional.ofNullable(filterOpsContextSessionId); return this; @@ -1480,7 +1480,7 @@ public _FinalStage filterOpsContextSessionId(String filterOpsContextSessionId) { /** *

ID for the session in which the request was sent.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.sessionID", nulls = Nulls.SKIP) public _FinalStage filterOpsContextSessionId(Optional filterOpsContextSessionId) { this.filterOpsContextSessionId = filterOpsContextSessionId; @@ -1491,7 +1491,7 @@ public _FinalStage filterOpsContextSessionId(Optional filterOpsContextSe *

ID for the request set by the service that received the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextTraceId(String filterOpsContextTraceId) { this.filterOpsContextTraceId = Optional.ofNullable(filterOpsContextTraceId); return this; @@ -1500,7 +1500,7 @@ public _FinalStage filterOpsContextTraceId(String filterOpsContextTraceId) { /** *

ID for the request set by the service that received the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.traceID", nulls = Nulls.SKIP) public _FinalStage filterOpsContextTraceId(Optional filterOpsContextTraceId) { this.filterOpsContextTraceId = filterOpsContextTraceId; @@ -1511,7 +1511,7 @@ public _FinalStage filterOpsContextTraceId(Optional filterOpsContextTrac *

ID for the request that caused the event.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextRequestId(String filterOpsContextRequestId) { this.filterOpsContextRequestId = Optional.ofNullable(filterOpsContextRequestId); return this; @@ -1520,7 +1520,7 @@ public _FinalStage filterOpsContextRequestId(String filterOpsContextRequestId) { /** *

ID for the request that caused the event.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.requestID", nulls = Nulls.SKIP) public _FinalStage filterOpsContextRequestId(Optional filterOpsContextRequestId) { this.filterOpsContextRequestId = filterOpsContextRequestId; @@ -1531,7 +1531,7 @@ public _FinalStage filterOpsContextRequestId(Optional filterOpsContextRe *

ID for the audit event.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage filterOpsContextChangeId(String filterOpsContextChangeId) { this.filterOpsContextChangeId = Optional.ofNullable(filterOpsContextChangeId); return this; @@ -1540,14 +1540,14 @@ public _FinalStage filterOpsContextChangeId(String filterOpsContextChangeId) { /** *

ID for the audit event.

*/ - @java.lang.Override + @Override @JsonSetter(value = "filterOps.context.changeID", nulls = Nulls.SKIP) public _FinalStage filterOpsContextChangeId(Optional filterOpsContextChangeId) { this.filterOpsContextChangeId = filterOpsContextChangeId; return this; } - @java.lang.Override + @Override public AuditServiceListAuditEventsRequest build() { return new AuditServiceListAuditEventsRequest( filterOpsContextChangeId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java index a9fb6d44..9611f8ab 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java @@ -49,7 +49,7 @@ public enum AuditServiceListAuditEventsRequestFilterOpsActionType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java index 0b082305..44ac80d9 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java @@ -21,7 +21,7 @@ public enum AuditServiceListAuditEventsRequestFilterOpsContextAccessType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java index 76a357f4..1948ea9c 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java @@ -19,7 +19,7 @@ public enum AuditServiceListAuditEventsRequestFilterOpsContextActorType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java index cfca2e35..82c375aa 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java @@ -21,7 +21,7 @@ public enum AuditServiceListAuditEventsRequestFilterOpsContextAuthMode { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java index f5d2eafe..864213ec 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java @@ -73,7 +73,7 @@ public enum AuditServiceListAuditEventsRequestFilterOpsResourceType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java index 51fc2715..fe3f928e 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java @@ -17,7 +17,7 @@ public enum AuditServiceListAuditEventsRequestSortOpsOrderBy { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java diff --git a/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java new file mode 100644 index 00000000..182952bc --- /dev/null +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java @@ -0,0 +1,335 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.authentication.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1GetAuthTokenRequest.Builder.class) +public final class V1GetAuthTokenRequest { + private final String grantType; + + private final String assertion; + + private final Optional subjectToken; + + private final Optional subjectTokenType; + + private final Optional requestedTokenUse; + + private final Optional scope; + + private final Map additionalProperties; + + private V1GetAuthTokenRequest( + String grantType, + String assertion, + Optional subjectToken, + Optional subjectTokenType, + Optional requestedTokenUse, + Optional scope, + Map additionalProperties) { + this.grantType = grantType; + this.assertion = assertion; + this.subjectToken = subjectToken; + this.subjectTokenType = subjectTokenType; + this.requestedTokenUse = requestedTokenUse; + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return Grant type of the request. Set this to urn:ietf:params:oauth:grant-type:jwt-bearer. + */ + @JsonProperty("grant_type") + public String getGrantType() { + return grantType; + } + + /** + * @return User-signed JWT token that contains the following fields: <br/> <ul><li><code>iss</code>: Issuer of the JWT.</li><li><code>key</code>: Unique identifier for the key.</li><li><code>aud</code>: Recipient the JWT is intended for.</li><li><code>exp</code>: Time the JWT expires.</li><li><code>sub</code>: Subject of the JWT.</li><li><code>ctx</code>: (Optional) Value for <a href='/context-aware-overview/'>Context-aware authorization</a>.</li></ul> + */ + @JsonProperty("assertion") + public String getAssertion() { + return assertion; + } + + /** + * @return Subject token. + */ + @JsonProperty("subject_token") + public Optional getSubjectToken() { + return subjectToken; + } + + /** + * @return Subject token type. + */ + @JsonProperty("subject_token_type") + public Optional getSubjectTokenType() { + return subjectTokenType; + } + + /** + * @return Token use type. Either delegation or impersonation. + */ + @JsonProperty("requested_token_use") + public Optional getRequestedTokenUse() { + return requestedTokenUse; + } + + /** + * @return Subset of available <a href='#Roles'>roles</a> to associate with the requested token. Uses the format "role:<roleID1> role:<roleID2>". + */ + @JsonProperty("scope") + public Optional getScope() { + return scope; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1GetAuthTokenRequest && equalTo((V1GetAuthTokenRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1GetAuthTokenRequest other) { + return grantType.equals(other.grantType) + && assertion.equals(other.assertion) + && subjectToken.equals(other.subjectToken) + && subjectTokenType.equals(other.subjectTokenType) + && requestedTokenUse.equals(other.requestedTokenUse) + && scope.equals(other.scope); + } + + @Override + public int hashCode() { + return Objects.hash( + this.grantType, + this.assertion, + this.subjectToken, + this.subjectTokenType, + this.requestedTokenUse, + this.scope); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GrantTypeStage builder() { + return new Builder(); + } + + public interface GrantTypeStage { + /** + * Grant type of the request. Set this to `urn:ietf:params:oauth:grant-type:jwt-bearer`. + */ + AssertionStage grantType(@NotNull String grantType); + + Builder from(V1GetAuthTokenRequest other); + } + + public interface AssertionStage { + /** + * User-signed JWT token that contains the following fields:
  • iss: Issuer of the JWT.
  • key: Unique identifier for the key.
  • aud: Recipient the JWT is intended for.
  • exp: Time the JWT expires.
  • sub: Subject of the JWT.
  • ctx: (Optional) Value for Context-aware authorization.
+ */ + _FinalStage assertion(@NotNull String assertion); + } + + public interface _FinalStage { + V1GetAuthTokenRequest build(); + + /** + *

Subject token.

+ */ + _FinalStage subjectToken(Optional subjectToken); + + _FinalStage subjectToken(String subjectToken); + + /** + *

Subject token type.

+ */ + _FinalStage subjectTokenType(Optional subjectTokenType); + + _FinalStage subjectTokenType(String subjectTokenType); + + /** + *

Token use type. Either delegation or impersonation.

+ */ + _FinalStage requestedTokenUse(Optional requestedTokenUse); + + _FinalStage requestedTokenUse(String requestedTokenUse); + + /** + *

Subset of available <a href='#Roles'>roles</a> to associate with the requested token. Uses the format "role:<roleID1> role:<roleID2>".

+ */ + _FinalStage scope(Optional scope); + + _FinalStage scope(String scope); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GrantTypeStage, AssertionStage, _FinalStage { + private String grantType; + + private String assertion; + + private Optional scope = Optional.empty(); + + private Optional requestedTokenUse = Optional.empty(); + + private Optional subjectTokenType = Optional.empty(); + + private Optional subjectToken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @Override + public Builder from(V1GetAuthTokenRequest other) { + grantType(other.getGrantType()); + assertion(other.getAssertion()); + subjectToken(other.getSubjectToken()); + subjectTokenType(other.getSubjectTokenType()); + requestedTokenUse(other.getRequestedTokenUse()); + scope(other.getScope()); + return this; + } + + /** + * Grant type of the request. Set this to `urn:ietf:params:oauth:grant-type:jwt-bearer`.

Grant type of the request. Set this to urn:ietf:params:oauth:grant-type:jwt-bearer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + @JsonSetter("grant_type") + public AssertionStage grantType(@NotNull String grantType) { + this.grantType = Objects.requireNonNull(grantType, "grantType must not be null"); + return this; + } + + /** + * User-signed JWT token that contains the following fields:
  • iss: Issuer of the JWT.
  • key: Unique identifier for the key.
  • aud: Recipient the JWT is intended for.
  • exp: Time the JWT expires.
  • sub: Subject of the JWT.
  • ctx: (Optional) Value for Context-aware authorization.

User-signed JWT token that contains the following fields: <br/> <ul><li><code>iss</code>: Issuer of the JWT.</li><li><code>key</code>: Unique identifier for the key.</li><li><code>aud</code>: Recipient the JWT is intended for.</li><li><code>exp</code>: Time the JWT expires.</li><li><code>sub</code>: Subject of the JWT.</li><li><code>ctx</code>: (Optional) Value for <a href='/context-aware-overview/'>Context-aware authorization</a>.</li></ul>

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + @JsonSetter("assertion") + public _FinalStage assertion(@NotNull String assertion) { + this.assertion = Objects.requireNonNull(assertion, "assertion must not be null"); + return this; + } + + /** + *

Subset of available <a href='#Roles'>roles</a> to associate with the requested token. Uses the format "role:<roleID1> role:<roleID2>".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + public _FinalStage scope(String scope) { + this.scope = Optional.ofNullable(scope); + return this; + } + + /** + *

Subset of available <a href='#Roles'>roles</a> to associate with the requested token. Uses the format "role:<roleID1> role:<roleID2>".

+ */ + @Override + @JsonSetter(value = "scope", nulls = Nulls.SKIP) + public _FinalStage scope(Optional scope) { + this.scope = scope; + return this; + } + + /** + *

Token use type. Either delegation or impersonation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + public _FinalStage requestedTokenUse(String requestedTokenUse) { + this.requestedTokenUse = Optional.ofNullable(requestedTokenUse); + return this; + } + + /** + *

Token use type. Either delegation or impersonation.

+ */ + @Override + @JsonSetter(value = "requested_token_use", nulls = Nulls.SKIP) + public _FinalStage requestedTokenUse(Optional requestedTokenUse) { + this.requestedTokenUse = requestedTokenUse; + return this; + } + + /** + *

Subject token type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + public _FinalStage subjectTokenType(String subjectTokenType) { + this.subjectTokenType = Optional.ofNullable(subjectTokenType); + return this; + } + + /** + *

Subject token type.

+ */ + @Override + @JsonSetter(value = "subject_token_type", nulls = Nulls.SKIP) + public _FinalStage subjectTokenType(Optional subjectTokenType) { + this.subjectTokenType = subjectTokenType; + return this; + } + + /** + *

Subject token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + public _FinalStage subjectToken(String subjectToken) { + this.subjectToken = Optional.ofNullable(subjectToken); + return this; + } + + /** + *

Subject token.

+ */ + @Override + @JsonSetter(value = "subject_token", nulls = Nulls.SKIP) + public _FinalStage subjectToken(Optional subjectToken) { + this.subjectToken = subjectToken; + return this; + } + + @Override + public V1GetAuthTokenRequest build() { + return new V1GetAuthTokenRequest( + grantType, + assertion, + subjectToken, + subjectTokenType, + requestedTokenUse, + scope, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncBinLookupClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncBinLookupClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncBinLookupClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncBinLookupClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java index d4a1c21b..af827e01 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java @@ -74,7 +74,7 @@ public Optional getSkyflowId() { return skyflowId; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1BinListRequest && equalTo((V1BinListRequest) other); @@ -92,12 +92,12 @@ private boolean equalTo(V1BinListRequest other) { && skyflowId.equals(other.skyflowId); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.fields, this.bin, this.vaultSchemaConfig, this.skyflowId); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java index 45997db3..b94cb3d3 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java @@ -37,7 +37,7 @@ public Optional getVaultId() { return vaultId; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DetectServiceDetectStatusRequest && equalTo((DetectServiceDetectStatusRequest) other); @@ -52,12 +52,12 @@ private boolean equalTo(DetectServiceDetectStatusRequest other) { return vaultId.equals(other.vaultId); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.vaultId); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java index 3c4b4ea2..a8263338 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java @@ -156,7 +156,7 @@ public Optional getStoreEntities() { return storeEntities; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DetectServiceDetectTextRequest && equalTo((DetectServiceDetectTextRequest) other); @@ -181,7 +181,7 @@ private boolean equalTo(DetectServiceDetectTextRequest other) { && storeEntities.equals(other.storeEntities); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.text, @@ -197,7 +197,7 @@ public int hashCode() { this.storeEntities); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -309,7 +309,7 @@ public static final class Builder implements TextStage, VaultIdStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DetectServiceDetectTextRequest other) { text(other.getText()); vaultId(other.getVaultId()); @@ -329,7 +329,7 @@ public Builder from(DetectServiceDetectTextRequest other) { * Data to deidentify.

Data to deidentify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("text") public VaultIdStage text(@NotNull String text) { this.text = Objects.requireNonNull(text, "text must not be null"); @@ -340,7 +340,7 @@ public VaultIdStage text(@NotNull String text) { * ID of the vault.

ID of the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("vault_id") public _FinalStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -351,7 +351,7 @@ public _FinalStage vaultId(@NotNull String vaultId) { *

Indicates whether entities should be stored in the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage storeEntities(Boolean storeEntities) { this.storeEntities = Optional.ofNullable(storeEntities); return this; @@ -360,33 +360,33 @@ public _FinalStage storeEntities(Boolean storeEntities) { /** *

Indicates whether entities should be stored in the vault.

*/ - @java.lang.Override + @Override @JsonSetter(value = "store_entities", nulls = Nulls.SKIP) public _FinalStage storeEntities(Optional storeEntities) { this.storeEntities = storeEntities; return this; } - @java.lang.Override + @Override public _FinalStage advancedOptions(V1AdvancedOptions advancedOptions) { this.advancedOptions = Optional.ofNullable(advancedOptions); return this; } - @java.lang.Override + @Override @JsonSetter(value = "advanced_options", nulls = Nulls.SKIP) public _FinalStage advancedOptions(Optional advancedOptions) { this.advancedOptions = advancedOptions; return this; } - @java.lang.Override + @Override public _FinalStage accuracy(DetectDataAccuracy accuracy) { this.accuracy = Optional.ofNullable(accuracy); return this; } - @java.lang.Override + @Override @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) public _FinalStage accuracy(Optional accuracy) { this.accuracy = accuracy; @@ -397,7 +397,7 @@ public _FinalStage accuracy(Optional accuracy) { *

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 + @Override public _FinalStage returnEntities(Boolean returnEntities) { this.returnEntities = Optional.ofNullable(returnEntities); return this; @@ -406,7 +406,7 @@ public _FinalStage returnEntities(Boolean returnEntities) { /** *

If true, returns the details for the detected entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "return_entities", nulls = Nulls.SKIP) public _FinalStage returnEntities(Optional returnEntities) { this.returnEntities = returnEntities; @@ -417,7 +417,7 @@ public _FinalStage returnEntities(Optional returnEntities) { *

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 + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; @@ -426,7 +426,7 @@ public _FinalStage restrictRegex(List restrictRegex) { /** *

Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.

*/ - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; @@ -437,7 +437,7 @@ public _FinalStage restrictRegex(Optional> restrictRegex) { *

Regular expressions to ignore when detecting entities.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; @@ -446,20 +446,20 @@ public _FinalStage allowRegex(List allowRegex) { /** *

Regular expressions to ignore when detecting entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat) { this.deidentifyTokenFormat = Optional.ofNullable(deidentifyTokenFormat); return this; } - @java.lang.Override + @Override @JsonSetter(value = "deidentify_token_format", nulls = Nulls.SKIP) public _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat) { this.deidentifyTokenFormat = deidentifyTokenFormat; @@ -470,7 +470,7 @@ public _FinalStage deidentifyTokenFormat(Optional *

Entities to detect and deidentify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage restrictEntityTypes(List restrictEntityTypes) { this.restrictEntityTypes = Optional.ofNullable(restrictEntityTypes); return this; @@ -479,7 +479,7 @@ public _FinalStage restrictEntityTypes(List restrictEntityTy /** *

Entities to detect and deidentify.

*/ - @java.lang.Override + @Override @JsonSetter(value = "restrict_entity_types", nulls = Nulls.SKIP) public _FinalStage restrictEntityTypes(Optional> restrictEntityTypes) { this.restrictEntityTypes = restrictEntityTypes; @@ -490,7 +490,7 @@ public _FinalStage restrictEntityTypes(Optional> restri *

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 + @Override public _FinalStage sessionId(String sessionId) { this.sessionId = Optional.ofNullable(sessionId); return this; @@ -499,14 +499,14 @@ public _FinalStage sessionId(String sessionId) { /** *

Will give a handle to delete the tokens generated during a specific interaction.

*/ - @java.lang.Override + @Override @JsonSetter(value = "session_id", nulls = Nulls.SKIP) public _FinalStage sessionId(Optional sessionId) { this.sessionId = sessionId; return this; } - @java.lang.Override + @Override public DetectServiceDetectTextRequest build() { return new DetectServiceDetectTextRequest( text, diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java index 8bdee935..a460f3a1 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java @@ -194,7 +194,7 @@ public Optional getDeidentifyTokenFormat() { return deidentifyTokenFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetectFileRequest && equalTo((V1DetectFileRequest) other); @@ -223,7 +223,7 @@ private boolean equalTo(V1DetectFileRequest other) { && deidentifyTokenFormat.equals(other.deidentifyTokenFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.file, @@ -243,7 +243,7 @@ public int hashCode() { this.deidentifyTokenFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -376,7 +376,7 @@ public static final class Builder implements FileStage, DataFormatStage, InputTy private Builder() {} - @java.lang.Override + @Override public Builder from(V1DetectFileRequest other) { file(other.getFile()); dataFormat(other.getDataFormat()); @@ -400,21 +400,21 @@ public Builder from(V1DetectFileRequest other) { * 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 + @Override @JsonSetter("file") public DataFormatStage file(@NotNull String file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @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 + @Override @JsonSetter("input_type") public VaultIdStage inputType(@NotNull DetectFileRequestDataType inputType) { this.inputType = Objects.requireNonNull(inputType, "inputType must not be null"); @@ -425,85 +425,85 @@ public VaultIdStage inputType(@NotNull DetectFileRequestDataType inputType) { * ID of the vault.

ID of the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @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 + @Override public _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat) { this.deidentifyTokenFormat = Optional.ofNullable(deidentifyTokenFormat); return this; } - @java.lang.Override + @Override @JsonSetter(value = "deidentify_token_format", nulls = Nulls.SKIP) public _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat) { this.deidentifyTokenFormat = deidentifyTokenFormat; return this; } - @java.lang.Override + @Override public _FinalStage advancedOptions(V1AdvancedOptions advancedOptions) { this.advancedOptions = Optional.ofNullable(advancedOptions); return this; } - @java.lang.Override + @Override @JsonSetter(value = "advanced_options", nulls = Nulls.SKIP) public _FinalStage advancedOptions(Optional advancedOptions) { this.advancedOptions = advancedOptions; return this; } - @java.lang.Override + @Override public _FinalStage pdf(V1PdfConfig pdf) { this.pdf = Optional.ofNullable(pdf); return this; } - @java.lang.Override + @Override @JsonSetter(value = "pdf", nulls = Nulls.SKIP) public _FinalStage pdf(Optional pdf) { this.pdf = pdf; return this; } - @java.lang.Override + @Override public _FinalStage image(V1ImageOptions image) { this.image = Optional.ofNullable(image); return this; } - @java.lang.Override + @Override @JsonSetter(value = "image", nulls = Nulls.SKIP) public _FinalStage image(Optional image) { this.image = image; return this; } - @java.lang.Override + @Override public _FinalStage audio(V1AudioConfig audio) { this.audio = Optional.ofNullable(audio); return this; } - @java.lang.Override + @Override @JsonSetter(value = "audio", nulls = Nulls.SKIP) public _FinalStage audio(Optional audio) { this.audio = audio; return this; } - @java.lang.Override + @Override public _FinalStage accuracy(DetectDataAccuracy accuracy) { this.accuracy = Optional.ofNullable(accuracy); return this; } - @java.lang.Override + @Override @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) public _FinalStage accuracy(Optional accuracy) { this.accuracy = accuracy; @@ -514,7 +514,7 @@ public _FinalStage accuracy(Optional accuracy) { *

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 + @Override public _FinalStage returnEntities(Boolean returnEntities) { this.returnEntities = Optional.ofNullable(returnEntities); return this; @@ -523,7 +523,7 @@ public _FinalStage returnEntities(Boolean returnEntities) { /** *

If true, returns the details for the detected entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "return_entities", nulls = Nulls.SKIP) public _FinalStage returnEntities(Optional returnEntities) { this.returnEntities = returnEntities; @@ -534,7 +534,7 @@ public _FinalStage returnEntities(Optional returnEntities) { *

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 + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; @@ -543,7 +543,7 @@ public _FinalStage restrictRegex(List restrictRegex) { /** *

Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.

*/ - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; @@ -554,7 +554,7 @@ public _FinalStage restrictRegex(Optional> restrictRegex) { *

Regular expressions to ignore when detecting entities.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; @@ -563,7 +563,7 @@ public _FinalStage allowRegex(List allowRegex) { /** *

Regular expressions to ignore when detecting entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; @@ -574,7 +574,7 @@ public _FinalStage allowRegex(Optional> allowRegex) { *

Entities to detect and deidentify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage restrictEntityTypes(List restrictEntityTypes) { this.restrictEntityTypes = Optional.ofNullable(restrictEntityTypes); return this; @@ -583,7 +583,7 @@ public _FinalStage restrictEntityTypes(List restrictEntityTy /** *

Entities to detect and deidentify.

*/ - @java.lang.Override + @Override @JsonSetter(value = "restrict_entity_types", nulls = Nulls.SKIP) public _FinalStage restrictEntityTypes(Optional> restrictEntityTypes) { this.restrictEntityTypes = restrictEntityTypes; @@ -594,7 +594,7 @@ public _FinalStage restrictEntityTypes(Optional> restri *

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 + @Override public _FinalStage sessionId(String sessionId) { this.sessionId = Optional.ofNullable(sessionId); return this; @@ -603,14 +603,14 @@ public _FinalStage sessionId(String sessionId) { /** *

Will give a handle to delete the tokens generated during a specific interaction.

*/ - @java.lang.Override + @Override @JsonSetter(value = "session_id", nulls = Nulls.SKIP) public _FinalStage sessionId(Optional sessionId) { this.sessionId = sessionId; return this; } - @java.lang.Override + @Override public V1DetectFileRequest build() { return new V1DetectFileRequest( file, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java index 5f4929aa..181693c6 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java @@ -172,7 +172,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyAudioRequest && equalTo((DeidentifyAudioRequest) other); @@ -199,7 +199,7 @@ private boolean equalTo(DeidentifyAudioRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -217,7 +217,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -338,7 +338,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyAudioRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -356,7 +356,7 @@ public Builder from(DeidentifyAudioRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -367,72 +367,72 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyAudioRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; @@ -443,7 +443,7 @@ public _FinalStage entityTypes(Optional> entityTypes) { *

Padding added to the end of a bleep, in seconds.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage bleepStopPadding(Double bleepStopPadding) { this.bleepStopPadding = Optional.ofNullable(bleepStopPadding); return this; @@ -452,7 +452,7 @@ public _FinalStage bleepStopPadding(Double bleepStopPadding) { /** *

Padding added to the end of a bleep, in seconds.

*/ - @java.lang.Override + @Override @JsonSetter(value = "bleep_stop_padding", nulls = Nulls.SKIP) public _FinalStage bleepStopPadding(Optional bleepStopPadding) { this.bleepStopPadding = bleepStopPadding; @@ -463,7 +463,7 @@ public _FinalStage bleepStopPadding(Optional bleepStopPadding) { *

Padding added to the beginning of a bleep, in seconds.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage bleepStartPadding(Double bleepStartPadding) { this.bleepStartPadding = Optional.ofNullable(bleepStartPadding); return this; @@ -472,7 +472,7 @@ public _FinalStage bleepStartPadding(Double bleepStartPadding) { /** *

Padding added to the beginning of a bleep, in seconds.

*/ - @java.lang.Override + @Override @JsonSetter(value = "bleep_start_padding", nulls = Nulls.SKIP) public _FinalStage bleepStartPadding(Optional bleepStartPadding) { this.bleepStartPadding = bleepStartPadding; @@ -483,7 +483,7 @@ public _FinalStage bleepStartPadding(Optional bleepStartPadding) { *

The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage bleepFrequency(Double bleepFrequency) { this.bleepFrequency = Optional.ofNullable(bleepFrequency); return this; @@ -492,7 +492,7 @@ public _FinalStage bleepFrequency(Double bleepFrequency) { /** *

The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch.

*/ - @java.lang.Override + @Override @JsonSetter(value = "bleep_frequency", nulls = Nulls.SKIP) public _FinalStage bleepFrequency(Optional bleepFrequency) { this.bleepFrequency = bleepFrequency; @@ -503,7 +503,7 @@ public _FinalStage bleepFrequency(Optional bleepFrequency) { *

Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage bleepGain(Double bleepGain) { this.bleepGain = Optional.ofNullable(bleepGain); return this; @@ -512,7 +512,7 @@ public _FinalStage bleepGain(Double bleepGain) { /** *

Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it.

*/ - @java.lang.Override + @Override @JsonSetter(value = "bleep_gain", nulls = Nulls.SKIP) public _FinalStage bleepGain(Optional bleepGain) { this.bleepGain = bleepGain; @@ -523,7 +523,7 @@ public _FinalStage bleepGain(Optional bleepGain) { *

Type of transcription to output.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage outputTranscription(DeidentifyAudioRequestOutputTranscription outputTranscription) { this.outputTranscription = Optional.ofNullable(outputTranscription); return this; @@ -532,7 +532,7 @@ public _FinalStage outputTranscription(DeidentifyAudioRequestOutputTranscription /** *

Type of transcription to output.

*/ - @java.lang.Override + @Override @JsonSetter(value = "output_transcription", nulls = Nulls.SKIP) public _FinalStage outputTranscription( Optional outputTranscription) { @@ -544,7 +544,7 @@ public _FinalStage outputTranscription( *

If true, includes processed audio file in the response.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage outputProcessedAudio(Boolean outputProcessedAudio) { this.outputProcessedAudio = Optional.ofNullable(outputProcessedAudio); return this; @@ -553,14 +553,14 @@ public _FinalStage outputProcessedAudio(Boolean outputProcessedAudio) { /** *

If true, includes processed audio file in the response.

*/ - @java.lang.Override + @Override @JsonSetter(value = "output_processed_audio", nulls = Nulls.SKIP) public _FinalStage outputProcessedAudio(Optional outputProcessedAudio) { this.outputProcessedAudio = outputProcessedAudio; return this; } - @java.lang.Override + @Override public DeidentifyAudioRequest build() { return new DeidentifyAudioRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java index bf6f307e..80e8fff1 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java @@ -99,7 +99,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyDocumentRequest && equalTo((DeidentifyDocumentRequest) other); @@ -120,7 +120,7 @@ private boolean equalTo(DeidentifyDocumentRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -132,7 +132,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -199,7 +199,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyDocumentRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -211,7 +211,7 @@ public Builder from(DeidentifyDocumentRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -222,79 +222,79 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyDocumentRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifyDocumentRequest build() { return new DeidentifyDocumentRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java index 1cbcd8f1..bd8ec3a7 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java @@ -99,7 +99,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyFileRequest && equalTo((DeidentifyFileRequest) other); @@ -120,7 +120,7 @@ private boolean equalTo(DeidentifyFileRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -132,7 +132,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -199,7 +199,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyFileRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -211,7 +211,7 @@ public Builder from(DeidentifyFileRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -222,79 +222,79 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyFileRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifyFileRequest build() { return new DeidentifyFileRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java index 41de24b2..94159f02 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java @@ -136,7 +136,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyImageRequest && equalTo((DeidentifyImageRequest) other); @@ -160,7 +160,7 @@ private boolean equalTo(DeidentifyImageRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -175,7 +175,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -269,7 +269,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyImageRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -284,7 +284,7 @@ public Builder from(DeidentifyImageRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -295,72 +295,72 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyImageRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; @@ -371,7 +371,7 @@ public _FinalStage entityTypes(Optional> entityTypes) { *

Method to mask the entities in the image.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage maskingMethod(DeidentifyImageRequestMaskingMethod maskingMethod) { this.maskingMethod = Optional.ofNullable(maskingMethod); return this; @@ -380,7 +380,7 @@ public _FinalStage maskingMethod(DeidentifyImageRequestMaskingMethod maskingMeth /** *

Method to mask the entities in the image.

*/ - @java.lang.Override + @Override @JsonSetter(value = "masking_method", nulls = Nulls.SKIP) public _FinalStage maskingMethod(Optional maskingMethod) { this.maskingMethod = maskingMethod; @@ -391,7 +391,7 @@ public _FinalStage maskingMethod(Optional m *

If true, includes OCR text output in the response.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage outputOcrText(Boolean outputOcrText) { this.outputOcrText = Optional.ofNullable(outputOcrText); return this; @@ -400,7 +400,7 @@ public _FinalStage outputOcrText(Boolean outputOcrText) { /** *

If true, includes OCR text output in the response.

*/ - @java.lang.Override + @Override @JsonSetter(value = "output_ocr_text", nulls = Nulls.SKIP) public _FinalStage outputOcrText(Optional outputOcrText) { this.outputOcrText = outputOcrText; @@ -411,7 +411,7 @@ public _FinalStage outputOcrText(Optional outputOcrText) { *

If true, includes processed image in the output.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage outputProcessedImage(Boolean outputProcessedImage) { this.outputProcessedImage = Optional.ofNullable(outputProcessedImage); return this; @@ -420,14 +420,14 @@ public _FinalStage outputProcessedImage(Boolean outputProcessedImage) { /** *

If true, includes processed image in the output.

*/ - @java.lang.Override + @Override @JsonSetter(value = "output_processed_image", nulls = Nulls.SKIP) public _FinalStage outputProcessedImage(Optional outputProcessedImage) { this.outputProcessedImage = outputProcessedImage; return this; } - @java.lang.Override + @Override public DeidentifyImageRequest build() { return new DeidentifyImageRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java index 83fbb14f..624bc497 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java @@ -123,7 +123,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyPdfRequest && equalTo((DeidentifyPdfRequest) other); @@ -146,7 +146,7 @@ private boolean equalTo(DeidentifyPdfRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -160,7 +160,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -245,7 +245,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyPdfRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -259,7 +259,7 @@ public Builder from(DeidentifyPdfRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -270,72 +270,72 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyPdfRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; @@ -346,7 +346,7 @@ public _FinalStage entityTypes(Optional> entityTypes) { *

Max resolution at which to process the PDF file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage maxResolution(Integer maxResolution) { this.maxResolution = Optional.ofNullable(maxResolution); return this; @@ -355,7 +355,7 @@ public _FinalStage maxResolution(Integer maxResolution) { /** *

Max resolution at which to process the PDF file.

*/ - @java.lang.Override + @Override @JsonSetter(value = "max_resolution", nulls = Nulls.SKIP) public _FinalStage maxResolution(Optional maxResolution) { this.maxResolution = maxResolution; @@ -366,7 +366,7 @@ public _FinalStage maxResolution(Optional maxResolution) { *

Pixel density at which to process the PDF file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage density(Integer density) { this.density = Optional.ofNullable(density); return this; @@ -375,14 +375,14 @@ public _FinalStage density(Integer density) { /** *

Pixel density at which to process the PDF file.

*/ - @java.lang.Override + @Override @JsonSetter(value = "density", nulls = Nulls.SKIP) public _FinalStage density(Optional density) { this.density = density; return this; } - @java.lang.Override + @Override public DeidentifyPdfRequest build() { return new DeidentifyPdfRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java index 47a63a5b..127becec 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java @@ -99,7 +99,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyPresentationRequest && equalTo((DeidentifyPresentationRequest) other); @@ -120,7 +120,7 @@ private boolean equalTo(DeidentifyPresentationRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -132,7 +132,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -199,7 +199,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyPresentationRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -211,7 +211,7 @@ public Builder from(DeidentifyPresentationRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -222,79 +222,79 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyPresentationRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifyPresentationRequest build() { return new DeidentifyPresentationRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java index b72b412b..33d1f705 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java @@ -99,7 +99,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifySpreadsheetRequest && equalTo((DeidentifySpreadsheetRequest) other); @@ -120,7 +120,7 @@ private boolean equalTo(DeidentifySpreadsheetRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -132,7 +132,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -199,7 +199,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifySpreadsheetRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -211,7 +211,7 @@ public Builder from(DeidentifySpreadsheetRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -222,79 +222,79 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifySpreadsheetRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifySpreadsheetRequest build() { return new DeidentifySpreadsheetRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java index a61a5ba0..38521a18 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java @@ -99,7 +99,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyStructuredTextRequest && equalTo((DeidentifyStructuredTextRequest) other); @@ -120,7 +120,7 @@ private boolean equalTo(DeidentifyStructuredTextRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -132,7 +132,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -199,7 +199,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyStructuredTextRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -211,7 +211,7 @@ public Builder from(DeidentifyStructuredTextRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -222,79 +222,79 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyStructuredTextRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifyStructuredTextRequest build() { return new DeidentifyStructuredTextRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java index 4eb0ac6c..5c6572b9 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java @@ -99,7 +99,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyTextRequest && equalTo((DeidentifyTextRequest) other); @@ -120,7 +120,7 @@ private boolean equalTo(DeidentifyTextRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -132,7 +132,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -199,7 +199,7 @@ public static final class Builder implements VaultIdStage, FileStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyTextRequest other) { vaultId(other.getVaultId()); file(other.getFile()); @@ -211,7 +211,7 @@ public Builder from(DeidentifyTextRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public FileStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -222,79 +222,79 @@ public FileStage vaultId(@NotNull String vaultId) { * File to de-identify. Files are specified as Base64-encoded data.

File to de-identify. Files are specified as Base64-encoded data.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("file") public _FinalStage file(@NotNull DeidentifyTextRequestFile file) { this.file = Objects.requireNonNull(file, "file must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifyTextRequest build() { return new DeidentifyTextRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java index 390d2090..c1a4051c 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java @@ -36,7 +36,7 @@ public String getVaultId() { return vaultId; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof GetRunRequest && equalTo((GetRunRequest) other); @@ -51,12 +51,12 @@ private boolean equalTo(GetRunRequest other) { return vaultId.equals(other.vaultId); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.vaultId); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -87,7 +87,7 @@ public static final class Builder implements VaultIdStage, _FinalStage { private Builder() {} - @java.lang.Override + @Override public Builder from(GetRunRequest other) { vaultId(other.getVaultId()); return this; @@ -97,14 +97,14 @@ public Builder from(GetRunRequest other) { * ID of the vault.

ID of the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @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 + @Override public GetRunRequest build() { return new GetRunRequest(vaultId, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java index ad124de0..e45ced48 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java @@ -48,7 +48,7 @@ public DeidentifyAudioRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyAudioRequestFile && equalTo((DeidentifyAudioRequestFile) other); @@ -63,12 +63,12 @@ private boolean equalTo(DeidentifyAudioRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -108,7 +108,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyAudioRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -119,7 +119,7 @@ public Builder from(DeidentifyAudioRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -130,14 +130,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifyAudioRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyAudioRequestFile build() { return new DeidentifyAudioRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java index 05203b05..1a9ac79a 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java @@ -17,7 +17,7 @@ public enum DeidentifyAudioRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java index bd2d8aac..728e3d77 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java @@ -23,7 +23,7 @@ public enum DeidentifyAudioRequestOutputTranscription { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java index 76c7972c..1bdeb84a 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java @@ -50,7 +50,7 @@ public DeidentifyDocumentRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyDocumentRequestFile && equalTo((DeidentifyDocumentRequestFile) other); @@ -65,12 +65,12 @@ private boolean equalTo(DeidentifyDocumentRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -110,7 +110,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyDocumentRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -121,7 +121,7 @@ public Builder from(DeidentifyDocumentRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -132,14 +132,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifyDocumentRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyDocumentRequestFile build() { return new DeidentifyDocumentRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java index 6b741b95..ea1e0930 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java @@ -19,7 +19,7 @@ public enum DeidentifyDocumentRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java index f21ddeef..08e0bbb1 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java @@ -48,7 +48,7 @@ public DeidentifyFileRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyFileRequestFile && equalTo((DeidentifyFileRequestFile) other); @@ -63,12 +63,12 @@ private boolean equalTo(DeidentifyFileRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -108,7 +108,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyFileRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -119,7 +119,7 @@ public Builder from(DeidentifyFileRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -130,14 +130,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifyFileRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyFileRequestFile build() { return new DeidentifyFileRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java index afc90bc3..6d42ba53 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java @@ -51,7 +51,7 @@ public enum DeidentifyFileRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java index 116fd94d..89a54aaf 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java @@ -48,7 +48,7 @@ public DeidentifyImageRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyImageRequestFile && equalTo((DeidentifyImageRequestFile) other); @@ -63,12 +63,12 @@ private boolean equalTo(DeidentifyImageRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -108,7 +108,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyImageRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -119,7 +119,7 @@ public Builder from(DeidentifyImageRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -130,14 +130,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifyImageRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyImageRequestFile build() { return new DeidentifyImageRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java index cfb324d9..27e241d6 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java @@ -25,7 +25,7 @@ public enum DeidentifyImageRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java index 8cf5bf3c..e4a0fd19 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java @@ -17,7 +17,7 @@ public enum DeidentifyImageRequestMaskingMethod { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java index 14028aab..1d9bb8d9 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java @@ -44,7 +44,7 @@ public String getDataFormat() { return "pdf"; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyPdfRequestFile && equalTo((DeidentifyPdfRequestFile) other); @@ -59,12 +59,12 @@ private boolean equalTo(DeidentifyPdfRequestFile other) { return base64.equals(other.base64); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -95,7 +95,7 @@ public static final class Builder implements Base64Stage, _FinalStage { private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyPdfRequestFile other) { base64(other.getBase64()); return this; @@ -105,14 +105,14 @@ public Builder from(DeidentifyPdfRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public _FinalStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyPdfRequestFile build() { return new DeidentifyPdfRequestFile(base64, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java index 1b2e247f..60a013ce 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java @@ -50,7 +50,7 @@ public DeidentifyPresentationRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyPresentationRequestFile && equalTo((DeidentifyPresentationRequestFile) other); @@ -65,12 +65,12 @@ private boolean equalTo(DeidentifyPresentationRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -110,7 +110,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyPresentationRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -121,7 +121,7 @@ public Builder from(DeidentifyPresentationRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -132,14 +132,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifyPresentationRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyPresentationRequestFile build() { return new DeidentifyPresentationRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java index e6bcd268..7770a61e 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java @@ -17,7 +17,7 @@ public enum DeidentifyPresentationRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java index 2e291563..b749ebe0 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java @@ -50,7 +50,7 @@ public DeidentifySpreadsheetRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifySpreadsheetRequestFile && equalTo((DeidentifySpreadsheetRequestFile) other); @@ -65,12 +65,12 @@ private boolean equalTo(DeidentifySpreadsheetRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -110,7 +110,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifySpreadsheetRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -121,7 +121,7 @@ public Builder from(DeidentifySpreadsheetRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -132,14 +132,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifySpreadsheetRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifySpreadsheetRequestFile build() { return new DeidentifySpreadsheetRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java index 795a2666..c44e4fb2 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java @@ -19,7 +19,7 @@ public enum DeidentifySpreadsheetRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java index d8d5193a..14b34a29 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java @@ -50,7 +50,7 @@ public DeidentifyStructuredTextRequestFileDataFormat getDataFormat() { return dataFormat; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyStructuredTextRequestFile @@ -66,12 +66,12 @@ private boolean equalTo(DeidentifyStructuredTextRequestFile other) { return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64, this.dataFormat); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -111,7 +111,7 @@ public static final class Builder implements Base64Stage, DataFormatStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyStructuredTextRequestFile other) { base64(other.getBase64()); dataFormat(other.getDataFormat()); @@ -122,7 +122,7 @@ public Builder from(DeidentifyStructuredTextRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public DataFormatStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); @@ -133,14 +133,14 @@ public DataFormatStage base64(@NotNull String base64) { * Data format of the file.

Data format of the file.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("data_format") public _FinalStage dataFormat(@NotNull DeidentifyStructuredTextRequestFileDataFormat dataFormat) { this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyStructuredTextRequestFile build() { return new DeidentifyStructuredTextRequestFile(base64, dataFormat, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java index 11b30288..8182b567 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java @@ -17,7 +17,7 @@ public enum DeidentifyStructuredTextRequestFileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java index c7cbc5b3..953a9075 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java @@ -44,7 +44,7 @@ public String getDataFormat() { return "txt"; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyTextRequestFile && equalTo((DeidentifyTextRequestFile) other); @@ -59,12 +59,12 @@ private boolean equalTo(DeidentifyTextRequestFile other) { return base64.equals(other.base64); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.base64); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -95,7 +95,7 @@ public static final class Builder implements Base64Stage, _FinalStage { private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyTextRequestFile other) { base64(other.getBase64()); return this; @@ -105,14 +105,14 @@ public Builder from(DeidentifyTextRequestFile other) { * Base64-encoded data of the file to de-identify.

Base64-encoded data of the file to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("base64") public _FinalStage base64(@NotNull String base64) { this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyTextRequestFile build() { return new DeidentifyTextRequestFile(base64, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java b/v2/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java index dfa21d15..60565eb5 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java @@ -37,7 +37,7 @@ public Optional getQuery() { return query; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof QueryServiceExecuteQueryBody && equalTo((QueryServiceExecuteQueryBody) other); @@ -52,12 +52,12 @@ private boolean equalTo(QueryServiceExecuteQueryBody other) { return query.equals(other.query); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.query); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/RecordsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/RecordsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/records/RecordsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/RecordsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java index d1b64906..e073b0a1 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java @@ -21,7 +21,7 @@ private FileServiceUploadFileRequest(Map additionalProperties) { this.additionalProperties = additionalProperties; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof FileServiceUploadFileRequest; @@ -32,7 +32,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java index 33b92483..48586839 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java @@ -63,7 +63,7 @@ public Optional getByot() { return byot; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof RecordServiceBatchOperationBody && equalTo((RecordServiceBatchOperationBody) other); @@ -80,12 +80,12 @@ private boolean equalTo(RecordServiceBatchOperationBody other) { && byot.equals(other.byot); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records, this.continueOnError, this.byot); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java index b2c991f9..b417adbb 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java @@ -39,7 +39,7 @@ public Optional> getSkyflowIds() { return skyflowIds; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof RecordServiceBulkDeleteRecordBody && equalTo((RecordServiceBulkDeleteRecordBody) other); @@ -54,12 +54,12 @@ private boolean equalTo(RecordServiceBulkDeleteRecordBody other) { return skyflowIds.equals(other.skyflowIds); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.skyflowIds); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java index f8cccf09..22c9090c 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java @@ -151,7 +151,7 @@ public Optional getOrderBy() { return orderBy; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof RecordServiceBulkGetRecordRequest && equalTo((RecordServiceBulkGetRecordRequest) other); @@ -175,7 +175,7 @@ private boolean equalTo(RecordServiceBulkGetRecordRequest other) { && orderBy.equals(other.orderBy); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.skyflowIds, @@ -190,7 +190,7 @@ public int hashCode() { this.orderBy); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java index 0fa5319d..eef17665 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java @@ -78,7 +78,7 @@ public Optional getDownloadUrl() { return downloadUrl; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof RecordServiceGetRecordRequest && equalTo((RecordServiceGetRecordRequest) other); @@ -96,12 +96,12 @@ private boolean equalTo(RecordServiceGetRecordRequest other) { && downloadUrl.equals(other.downloadUrl); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.fields, this.redaction, this.tokenization, this.downloadUrl); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java index 4ac78692..e1de00f7 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java @@ -87,7 +87,7 @@ public Optional getByot() { return byot; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof RecordServiceInsertRecordBody && equalTo((RecordServiceInsertRecordBody) other); @@ -106,12 +106,12 @@ private boolean equalTo(RecordServiceInsertRecordBody other) { && byot.equals(other.byot); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records, this.tokenization, this.upsert, this.homogeneous, this.byot); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java index 19e0ae23..e52af2e4 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java @@ -59,7 +59,7 @@ public Optional getByot() { return byot; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof RecordServiceUpdateRecordBody && equalTo((RecordServiceUpdateRecordBody) other); @@ -74,12 +74,12 @@ private boolean equalTo(RecordServiceUpdateRecordBody other) { return record.equals(other.record) && tokenization.equals(other.tokenization) && byot.equals(other.byot); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.record, this.tokenization, this.byot); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java index 2563652f..1f25b38d 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java @@ -19,7 +19,7 @@ public enum RecordServiceBulkGetRecordRequestOrderBy { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java index b20f2541..12bbc291 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java @@ -21,7 +21,7 @@ public enum RecordServiceBulkGetRecordRequestRedaction { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java b/v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java index 468e3edd..4f546262 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java @@ -21,7 +21,7 @@ public enum RecordServiceGetRecordRequestRedaction { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/StringsClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/StringsClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/strings/StringsClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/StringsClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java index 4a74fcba..d20d14a9 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java @@ -98,7 +98,7 @@ public Optional getTransformations() { return transformations; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyStringRequest && equalTo((DeidentifyStringRequest) other); @@ -119,7 +119,7 @@ private boolean equalTo(DeidentifyStringRequest other) { && transformations.equals(other.transformations); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.vaultId, @@ -131,7 +131,7 @@ public int hashCode() { this.transformations); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -198,7 +198,7 @@ public static final class Builder implements VaultIdStage, TextStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyStringRequest other) { vaultId(other.getVaultId()); text(other.getText()); @@ -210,7 +210,7 @@ public Builder from(DeidentifyStringRequest other) { return this; } - @java.lang.Override + @Override @JsonSetter("vault_id") public TextStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -221,79 +221,79 @@ public TextStage vaultId(@NotNull String vaultId) { * String to de-identify.

String to de-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("text") public _FinalStage text(@NotNull String text) { this.text = Objects.requireNonNull(text, "text must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage transformations(Transformations transformations) { this.transformations = Optional.ofNullable(transformations); return this; } - @java.lang.Override + @Override @JsonSetter(value = "transformations", nulls = Nulls.SKIP) public _FinalStage transformations(Optional transformations) { this.transformations = transformations; return this; } - @java.lang.Override + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; return this; } - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; } - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage tokenType(TokenType tokenType) { this.tokenType = Optional.ofNullable(tokenType); return this; } - @java.lang.Override + @Override @JsonSetter(value = "token_type", nulls = Nulls.SKIP) public _FinalStage tokenType(Optional tokenType) { this.tokenType = tokenType; return this; } - @java.lang.Override + @Override public _FinalStage entityTypes(List entityTypes) { this.entityTypes = Optional.ofNullable(entityTypes); return this; } - @java.lang.Override + @Override @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) public _FinalStage entityTypes(Optional> entityTypes) { this.entityTypes = entityTypes; return this; } - @java.lang.Override + @Override public DeidentifyStringRequest build() { return new DeidentifyStringRequest( vaultId, diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java index e61cb5a2..e18b2169 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java @@ -65,7 +65,7 @@ public Optional getFormat() { return format; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof ReidentifyStringRequest && equalTo((ReidentifyStringRequest) other); @@ -80,12 +80,12 @@ private boolean equalTo(ReidentifyStringRequest other) { return text.equals(other.text) && vaultId.equals(other.vaultId) && format.equals(other.format); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.text, this.vaultId, this.format); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -134,7 +134,7 @@ public static final class Builder implements TextStage, VaultIdStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(ReidentifyStringRequest other) { text(other.getText()); vaultId(other.getVaultId()); @@ -146,7 +146,7 @@ public Builder from(ReidentifyStringRequest other) { * String to re-identify.

String to re-identify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("text") public VaultIdStage text(@NotNull String text) { this.text = Objects.requireNonNull(text, "text must not be null"); @@ -157,7 +157,7 @@ public VaultIdStage text(@NotNull String text) { * ID of the vault where the entities are stored.

ID of the vault where the entities are stored.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("vault_id") public _FinalStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -168,7 +168,7 @@ public _FinalStage vaultId(@NotNull String vaultId) { *

Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage format(ReidentifyStringRequestFormat format) { this.format = Optional.ofNullable(format); return this; @@ -177,14 +177,14 @@ public _FinalStage format(ReidentifyStringRequestFormat format) { /** *

Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request.

*/ - @java.lang.Override + @Override @JsonSetter(value = "format", nulls = Nulls.SKIP) public _FinalStage format(Optional format) { this.format = format; return this; } - @java.lang.Override + @Override public ReidentifyStringRequest build() { return new ReidentifyStringRequest(text, vaultId, format, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java index 68c5209f..748cc2f6 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java @@ -65,7 +65,7 @@ public Optional> getPlaintext() { return plaintext; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof ReidentifyStringRequestFormat && equalTo((ReidentifyStringRequestFormat) other); @@ -80,12 +80,12 @@ private boolean equalTo(ReidentifyStringRequestFormat other) { return redacted.equals(other.redacted) && masked.equals(other.masked) && plaintext.equals(other.plaintext); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.redacted, this.masked, this.plaintext); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/TokensClient.java b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/TokensClient.java similarity index 100% rename from src/main/java/com/skyflow/generated/rest/resources/tokens/TokensClient.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/tokens/TokensClient.java diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java index 1d3cb407..59318aa8 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java @@ -65,7 +65,7 @@ public Optional getContinueOnError() { return continueOnError; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetokenizePayload && equalTo((V1DetokenizePayload) other); @@ -82,12 +82,12 @@ private boolean equalTo(V1DetokenizePayload other) { && continueOnError.equals(other.continueOnError); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.detokenizationParameters, this.downloadUrl, this.continueOnError); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java rename to v2/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java index 30bdde6a..9729023e 100644 --- a/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java +++ b/v2/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java @@ -40,7 +40,7 @@ public Optional> getTokenizationParameters() { return tokenizationParameters; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1TokenizePayload && equalTo((V1TokenizePayload) other); @@ -55,12 +55,12 @@ private boolean equalTo(V1TokenizePayload other) { return tokenizationParameters.equals(other.tokenizationParameters); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.tokenizationParameters); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java b/v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java index 0f5d1fc2..139ab3e5 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java @@ -65,7 +65,7 @@ public Optional> getEntityColumnMap() { return entityColumnMap; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AdvancedOptionsColumnMapping && equalTo((AdvancedOptionsColumnMapping) other); @@ -82,12 +82,12 @@ private boolean equalTo(AdvancedOptionsColumnMapping other) { && entityColumnMap.equals(other.entityColumnMap); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.sessionId, this.default_, this.entityColumnMap); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -136,7 +136,7 @@ public static final class Builder implements SessionIdStage, DefaultStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(AdvancedOptionsColumnMapping other) { sessionId(other.getSessionId()); default_(other.getDefault()); @@ -148,7 +148,7 @@ public Builder from(AdvancedOptionsColumnMapping other) { * Table name of the vault.

Table name of the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("session_id") public DefaultStage sessionId(@NotNull String sessionId) { this.sessionId = Objects.requireNonNull(sessionId, "sessionId must not be null"); @@ -159,7 +159,7 @@ public DefaultStage sessionId(@NotNull String sessionId) { * Name of column to store data in when no explicit mapping exists.

Name of column to store data in when no explicit mapping exists.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("default") public _FinalStage default_(@NotNull String default_) { this.default_ = Objects.requireNonNull(default_, "default_ must not be null"); @@ -170,7 +170,7 @@ public _FinalStage default_(@NotNull String default_) { *

Column mapping for different entities.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage entityColumnMap(List entityColumnMap) { this.entityColumnMap = Optional.ofNullable(entityColumnMap); return this; @@ -179,14 +179,14 @@ public _FinalStage entityColumnMap(List entityCo /** *

Column mapping for different entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "entity_column_map", nulls = Nulls.SKIP) public _FinalStage entityColumnMap(Optional> entityColumnMap) { this.entityColumnMap = entityColumnMap; return this; } - @java.lang.Override + @Override public AdvancedOptionsColumnMapping build() { return new AdvancedOptionsColumnMapping(sessionId, default_, entityColumnMap, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java b/v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java index 3df03da3..f0860ead 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java @@ -48,7 +48,7 @@ public Optional getColumnName() { return columnName; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AdvancedOptionsEntityColumnMap && equalTo((AdvancedOptionsEntityColumnMap) other); @@ -63,12 +63,12 @@ private boolean equalTo(AdvancedOptionsEntityColumnMap other) { return entityType.equals(other.entityType) && columnName.equals(other.columnName); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.entityType, this.columnName); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java b/v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java index dcacb09f..f396ed7e 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java @@ -45,7 +45,7 @@ public AdvancedOptionsColumnMapping getMapping() { return mapping; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AdvancedOptionsVaultSchema && equalTo((AdvancedOptionsVaultSchema) other); @@ -60,12 +60,12 @@ private boolean equalTo(AdvancedOptionsVaultSchema other) { return tableName.equals(other.tableName) && mapping.equals(other.mapping); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.tableName, this.mapping); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -102,7 +102,7 @@ public static final class Builder implements TableNameStage, MappingStage, _Fina private Builder() {} - @java.lang.Override + @Override public Builder from(AdvancedOptionsVaultSchema other) { tableName(other.getTableName()); mapping(other.getMapping()); @@ -113,21 +113,21 @@ public Builder from(AdvancedOptionsVaultSchema other) { * Table name of the vault.

Table name of the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("table_name") public MappingStage tableName(@NotNull String tableName) { this.tableName = Objects.requireNonNull(tableName, "tableName must not be null"); return this; } - @java.lang.Override + @Override @JsonSetter("mapping") public _FinalStage mapping(@NotNull AdvancedOptionsColumnMapping mapping) { this.mapping = Objects.requireNonNull(mapping, "mapping must not be null"); return this; } - @java.lang.Override + @Override public AdvancedOptionsVaultSchema build() { return new AdvancedOptionsVaultSchema(tableName, mapping, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java b/v2/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java index e9052d16..fe61faa5 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java @@ -33,7 +33,7 @@ public enum AudioConfigTranscriptionType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java index 4264996a..d16caf10 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java @@ -73,7 +73,7 @@ public enum AuditEventAuditResourceType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java index 2a5c104a..210f96c0 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java @@ -162,7 +162,7 @@ public Optional getBearerTokenContextId() { return bearerTokenContextId; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AuditEventContext && equalTo((AuditEventContext) other); @@ -188,7 +188,7 @@ private boolean equalTo(AuditEventContext other) { && bearerTokenContextId.equals(other.bearerTokenContextId); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.changeId, @@ -205,7 +205,7 @@ public int hashCode() { this.bearerTokenContextId); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/AuditEventData.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java index 45d15be1..e2028fba 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java @@ -37,7 +37,7 @@ public Optional getContent() { return content; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AuditEventData && equalTo((AuditEventData) other); @@ -52,12 +52,12 @@ private boolean equalTo(AuditEventData other) { return content.equals(other.content); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.content); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java rename to v2/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java index 91126cc0..1352c42f 100644 --- a/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java @@ -49,7 +49,7 @@ public Optional getMethod() { return method; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof AuditEventHttpInfo && equalTo((AuditEventHttpInfo) other); @@ -64,12 +64,12 @@ private boolean equalTo(AuditEventHttpInfo other) { return uri.equals(other.uri) && method.equals(other.method); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.uri, this.method); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java b/v2/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java rename to v2/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java index c50f618d..a6f5e673 100644 --- a/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java @@ -23,7 +23,7 @@ public enum BatchRecordMethod { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java b/v2/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java similarity index 94% rename from src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java index b1b6072c..163e862e 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java @@ -19,7 +19,7 @@ public enum ContextAccessType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java b/v2/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java index 349ca23a..204ad039 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java @@ -21,7 +21,7 @@ public enum ContextAuthMode { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java index 59839994..4938361f 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java @@ -63,7 +63,7 @@ public Optional getProcessedFileExtension() { return processedFileExtension; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyFileOutput && equalTo((DeidentifyFileOutput) other); @@ -80,12 +80,12 @@ private boolean equalTo(DeidentifyFileOutput other) { && processedFileExtension.equals(other.processedFileExtension); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.processedFile, this.processedFileType, this.processedFileExtension); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java index c560dc9e..8b602431 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java @@ -33,7 +33,7 @@ public enum DeidentifyFileOutputProcessedFileType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java index 460058dc..6b06d486 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java @@ -36,7 +36,7 @@ public String getRunId() { return runId; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyFileResponse && equalTo((DeidentifyFileResponse) other); @@ -51,12 +51,12 @@ private boolean equalTo(DeidentifyFileResponse other) { return runId.equals(other.runId); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.runId); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -87,7 +87,7 @@ public static final class Builder implements RunIdStage, _FinalStage { private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyFileResponse other) { runId(other.getRunId()); return this; @@ -97,14 +97,14 @@ public Builder from(DeidentifyFileResponse other) { * Status URL for the detect run.

Status URL for the detect run.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("run_id") public _FinalStage runId(@NotNull String runId) { this.runId = Objects.requireNonNull(runId, "runId must not be null"); return this; } - @java.lang.Override + @Override public DeidentifyFileResponse build() { return new DeidentifyFileResponse(runId, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java index 9f73e9ad..95f93828 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java @@ -150,7 +150,7 @@ public Optional getSlides() { return slides; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyStatusResponse && equalTo((DeidentifyStatusResponse) other); @@ -174,7 +174,7 @@ private boolean equalTo(DeidentifyStatusResponse other) { && slides.equals(other.slides); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.status, @@ -189,7 +189,7 @@ public int hashCode() { this.slides); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -303,7 +303,7 @@ public static final class Builder implements StatusStage, OutputTypeStage, Messa private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyStatusResponse other) { status(other.getStatus()); output(other.getOutput()); @@ -322,7 +322,7 @@ public Builder from(DeidentifyStatusResponse other) { * Status of the detect run.

Status of the detect run.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("status") public OutputTypeStage status(@NotNull DeidentifyStatusResponseStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); @@ -333,7 +333,7 @@ public OutputTypeStage status(@NotNull DeidentifyStatusResponseStatus status) { * How the output file is specified.

How the output file is specified.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("output_type") public MessageStage outputType(@NotNull DeidentifyStatusResponseOutputType outputType) { this.outputType = Objects.requireNonNull(outputType, "outputType must not be null"); @@ -344,7 +344,7 @@ public MessageStage outputType(@NotNull DeidentifyStatusResponseOutputType outpu * Status details about the detect run.

Status details about the detect run.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("message") public _FinalStage message(@NotNull String message) { this.message = Objects.requireNonNull(message, "message must not be null"); @@ -355,7 +355,7 @@ public _FinalStage message(@NotNull String message) { *

Number of slides in the processed presentation.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage slides(Integer slides) { this.slides = Optional.ofNullable(slides); return this; @@ -364,7 +364,7 @@ public _FinalStage slides(Integer slides) { /** *

Number of slides in the processed presentation.

*/ - @java.lang.Override + @Override @JsonSetter(value = "slides", nulls = Nulls.SKIP) public _FinalStage slides(Optional slides) { this.slides = slides; @@ -375,7 +375,7 @@ public _FinalStage slides(Optional slides) { *

Number of pages in the processed PDF.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage pages(Integer pages) { this.pages = Optional.ofNullable(pages); return this; @@ -384,7 +384,7 @@ public _FinalStage pages(Integer pages) { /** *

Number of pages in the processed PDF.

*/ - @java.lang.Override + @Override @JsonSetter(value = "pages", nulls = Nulls.SKIP) public _FinalStage pages(Optional pages) { this.pages = pages; @@ -395,7 +395,7 @@ public _FinalStage pages(Optional pages) { *

Duration of the processed audio in seconds.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage duration(Integer duration) { this.duration = Optional.ofNullable(duration); return this; @@ -404,7 +404,7 @@ public _FinalStage duration(Integer duration) { /** *

Duration of the processed audio in seconds.

*/ - @java.lang.Override + @Override @JsonSetter(value = "duration", nulls = Nulls.SKIP) public _FinalStage duration(Optional duration) { this.duration = duration; @@ -415,7 +415,7 @@ public _FinalStage duration(Optional duration) { *

Size of the processed text in kilobytes (KB).

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage size(Integer size) { this.size = Optional.ofNullable(size); return this; @@ -424,7 +424,7 @@ public _FinalStage size(Integer size) { /** *

Size of the processed text in kilobytes (KB).

*/ - @java.lang.Override + @Override @JsonSetter(value = "size", nulls = Nulls.SKIP) public _FinalStage size(Optional size) { this.size = size; @@ -435,7 +435,7 @@ public _FinalStage size(Optional size) { *

Number of characters in the processed text.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage characterCount(Integer characterCount) { this.characterCount = Optional.ofNullable(characterCount); return this; @@ -444,7 +444,7 @@ public _FinalStage characterCount(Integer characterCount) { /** *

Number of characters in the processed text.

*/ - @java.lang.Override + @Override @JsonSetter(value = "character_count", nulls = Nulls.SKIP) public _FinalStage characterCount(Optional characterCount) { this.characterCount = characterCount; @@ -455,7 +455,7 @@ public _FinalStage characterCount(Optional characterCount) { *

Number of words in the processed text.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage wordCount(Integer wordCount) { this.wordCount = Optional.ofNullable(wordCount); return this; @@ -464,7 +464,7 @@ public _FinalStage wordCount(Integer wordCount) { /** *

Number of words in the processed text.

*/ - @java.lang.Override + @Override @JsonSetter(value = "word_count", nulls = Nulls.SKIP) public _FinalStage wordCount(Optional wordCount) { this.wordCount = wordCount; @@ -475,7 +475,7 @@ public _FinalStage wordCount(Optional wordCount) { *

How the input file was specified.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage addAllOutput(List output) { this.output.addAll(output); return this; @@ -485,7 +485,7 @@ public _FinalStage addAllOutput(List output) { *

How the input file was specified.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage addOutput(DeidentifyFileOutput output) { this.output.add(output); return this; @@ -494,7 +494,7 @@ public _FinalStage addOutput(DeidentifyFileOutput output) { /** *

How the input file was specified.

*/ - @java.lang.Override + @Override @JsonSetter(value = "output", nulls = Nulls.SKIP) public _FinalStage output(List output) { this.output.clear(); @@ -502,7 +502,7 @@ public _FinalStage output(List output) { return this; } - @java.lang.Override + @Override public DeidentifyStatusResponse build() { return new DeidentifyStatusResponse( status, diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java index 547bf414..5df3f85a 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java @@ -19,7 +19,7 @@ public enum DeidentifyStatusResponseOutputType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java index 4e51e5cf..67653c66 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java @@ -19,7 +19,7 @@ public enum DeidentifyStatusResponseStatus { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java index 5b768610..b78bb43e 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java @@ -77,7 +77,7 @@ public int getCharacterCount() { return characterCount; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DeidentifyStringResponse && equalTo((DeidentifyStringResponse) other); @@ -95,12 +95,12 @@ private boolean equalTo(DeidentifyStringResponse other) { && characterCount == other.characterCount; } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.processedText, this.entities, this.wordCount, this.characterCount); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -160,7 +160,7 @@ public static final class Builder implements ProcessedTextStage, WordCountStage, private Builder() {} - @java.lang.Override + @Override public Builder from(DeidentifyStringResponse other) { processedText(other.getProcessedText()); entities(other.getEntities()); @@ -173,7 +173,7 @@ public Builder from(DeidentifyStringResponse other) { * De-identified text.

De-identified text.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("processed_text") public WordCountStage processedText(@NotNull String processedText) { this.processedText = Objects.requireNonNull(processedText, "processedText must not be null"); @@ -184,7 +184,7 @@ public WordCountStage processedText(@NotNull String processedText) { * Number of words from the input text.

Number of words from the input text.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("word_count") public CharacterCountStage wordCount(int wordCount) { this.wordCount = wordCount; @@ -195,7 +195,7 @@ public CharacterCountStage wordCount(int wordCount) { * Number of characters from the input text.

Number of characters from the input text.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("character_count") public _FinalStage characterCount(int characterCount) { this.characterCount = characterCount; @@ -206,7 +206,7 @@ public _FinalStage characterCount(int characterCount) { *

Detected entities.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage addAllEntities(List entities) { this.entities.addAll(entities); return this; @@ -216,7 +216,7 @@ public _FinalStage addAllEntities(List entities) { *

Detected entities.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage addEntities(DetectedEntity entities) { this.entities.add(entities); return this; @@ -225,7 +225,7 @@ public _FinalStage addEntities(DetectedEntity entities) { /** *

Detected entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "entities", nulls = Nulls.SKIP) public _FinalStage entities(List entities) { this.entities.clear(); @@ -233,7 +233,7 @@ public _FinalStage entities(List entities) { return this; } - @java.lang.Override + @Override public DeidentifyStringResponse build() { return new DeidentifyStringResponse( processedText, entities, wordCount, characterCount, additionalProperties); diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java b/v2/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java index 64afed64..605b21ed 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java @@ -29,7 +29,7 @@ public enum DetectDataAccuracy { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java b/v2/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java index d655bb64..723f3392 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java @@ -139,7 +139,7 @@ public enum DetectDataEntities { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java b/v2/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java similarity index 94% rename from src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java index e039bc86..b73459fe 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java @@ -17,7 +17,7 @@ public enum DetectFileRequestDataType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java b/v2/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java index bdc82ccf..637b3031 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java @@ -19,7 +19,7 @@ public enum DetectRequestDeidentifyOption { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java b/v2/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java index 6de2200a..840a62a9 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java @@ -84,7 +84,7 @@ public Optional> getEntityScores() { return entityScores; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof DetectedEntity && equalTo((DetectedEntity) other); @@ -103,12 +103,12 @@ private boolean equalTo(DetectedEntity other) { && entityScores.equals(other.entityScores); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.token, this.value, this.location, this.entityType, this.entityScores); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java b/v2/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java index f192c14f..e9f4be2a 100644 --- a/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java @@ -31,7 +31,7 @@ public enum DetokenizeRecordResponseValueType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java b/v2/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/EntityLocation.java rename to v2/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java index 6e711422..197afeda 100644 --- a/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java @@ -75,7 +75,7 @@ public Optional getEndIndexProcessed() { return endIndexProcessed; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof EntityLocation && equalTo((EntityLocation) other); @@ -93,12 +93,12 @@ private boolean equalTo(EntityLocation other) { && endIndexProcessed.equals(other.endIndexProcessed); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.startIndex, this.endIndex, this.startIndexProcessed, this.endIndexProcessed); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/EntityType.java b/v2/src/main/java/com/skyflow/generated/rest/types/EntityType.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/EntityType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/EntityType.java index 605282ed..206dfb3c 100644 --- a/src/main/java/com/skyflow/generated/rest/types/EntityType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/EntityType.java @@ -139,7 +139,7 @@ public enum EntityType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java similarity index 94% rename from src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java index 68778cb1..565714eb 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java @@ -33,7 +33,7 @@ public ErrorResponseError getError() { return error; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof ErrorResponse && equalTo((ErrorResponse) other); @@ -48,12 +48,12 @@ private boolean equalTo(ErrorResponse other) { return error.equals(other.error); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.error); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -81,20 +81,20 @@ public static final class Builder implements ErrorStage, _FinalStage { private Builder() {} - @java.lang.Override + @Override public Builder from(ErrorResponse other) { error(other.getError()); return this; } - @java.lang.Override + @Override @JsonSetter("error") public _FinalStage error(@NotNull ErrorResponseError error) { this.error = Objects.requireNonNull(error, "error must not be null"); return this; } - @java.lang.Override + @Override public ErrorResponse build() { return new ErrorResponse(error, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java b/v2/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java index 5d0ee57d..21799203 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java @@ -83,7 +83,7 @@ public Optional>> getDetails() { return details; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof ErrorResponseError && equalTo((ErrorResponseError) other); @@ -102,12 +102,12 @@ private boolean equalTo(ErrorResponseError other) { && details.equals(other.details); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.grpcCode, this.httpCode, this.httpStatus, this.message, this.details); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -169,7 +169,7 @@ public static final class Builder private Builder() {} - @java.lang.Override + @Override public Builder from(ErrorResponseError other) { grpcCode(other.getGrpcCode()); httpCode(other.getHttpCode()); @@ -183,7 +183,7 @@ public Builder from(ErrorResponseError other) { * gRPC status codes. See https://grpc.io/docs/guides/status-codes.

gRPC status codes. See https://grpc.io/docs/guides/status-codes.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("grpc_code") public HttpCodeStage grpcCode(int grpcCode) { this.grpcCode = grpcCode; @@ -194,7 +194,7 @@ public HttpCodeStage grpcCode(int grpcCode) { * HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.

HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("http_code") public HttpStatusStage httpCode(int httpCode) { this.httpCode = httpCode; @@ -205,34 +205,34 @@ public HttpStatusStage httpCode(int httpCode) { * HTTP status message.

HTTP status message.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("http_status") public MessageStage httpStatus(@NotNull String httpStatus) { this.httpStatus = Objects.requireNonNull(httpStatus, "httpStatus must not be null"); return this; } - @java.lang.Override + @Override @JsonSetter("message") public _FinalStage message(@NotNull String message) { this.message = Objects.requireNonNull(message, "message must not be null"); return this; } - @java.lang.Override + @Override public _FinalStage details(List> details) { this.details = Optional.ofNullable(details); return this; } - @java.lang.Override + @Override @JsonSetter(value = "details", nulls = Nulls.SKIP) public _FinalStage details(Optional>> details) { this.details = details; return this; } - @java.lang.Override + @Override public ErrorResponseError build() { return new ErrorResponseError(grpcCode, httpCode, httpStatus, message, details, additionalProperties); } diff --git a/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java b/v2/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java rename to v2/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java index d0290573..807aee4e 100644 --- a/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java @@ -55,7 +55,7 @@ public Optional> getDetails() { return details; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof GooglerpcStatus && equalTo((GooglerpcStatus) other); @@ -70,12 +70,12 @@ private boolean equalTo(GooglerpcStatus other) { return code.equals(other.code) && message.equals(other.message) && details.equals(other.details); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.code, this.message, this.details); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java b/v2/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java index 0563503c..a8f574a4 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java @@ -33,7 +33,7 @@ public enum ProcessedFileOutputProcessedFileType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java b/v2/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java index 37555aae..9f019b66 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java @@ -34,7 +34,7 @@ public Optional getType() { return type; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof ProtobufAny && equalTo((ProtobufAny) other); @@ -49,12 +49,12 @@ private boolean equalTo(ProtobufAny other) { return type.equals(other.type); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.type); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java b/v2/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java rename to v2/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java index 3e83052b..88022df8 100644 --- a/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java @@ -21,7 +21,7 @@ public enum RedactionEnumRedaction { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java index ba305e63..dad2f08f 100644 --- a/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java @@ -37,7 +37,7 @@ public Optional getText() { return text; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof ReidentifyStringResponse && equalTo((ReidentifyStringResponse) other); @@ -52,12 +52,12 @@ private boolean equalTo(ReidentifyStringResponse other) { return text.equals(other.text); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.text); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java b/v2/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/RequestActionType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java index 436a1de8..ad0a32a7 100644 --- a/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java @@ -49,7 +49,7 @@ public enum RequestActionType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenType.java b/v2/src/main/java/com/skyflow/generated/rest/types/TokenType.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/TokenType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/TokenType.java index a50e861b..eb30f761 100644 --- a/src/main/java/com/skyflow/generated/rest/types/TokenType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/TokenType.java @@ -73,7 +73,7 @@ public Optional> getEntityOnly() { return entityOnly; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof TokenType && equalTo((TokenType) other); @@ -91,12 +91,12 @@ private boolean equalTo(TokenType other) { && entityOnly.equals(other.entityOnly); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.default_, this.vaultToken, this.entityUnqCounter, this.entityOnly); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java b/v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java rename to v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java index 14ab8f0f..5eeed0a7 100644 --- a/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java @@ -19,7 +19,7 @@ public enum TokenTypeDefault { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java b/v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java rename to v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java index 5f5938a0..4bf8dffb 100644 --- a/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java @@ -61,7 +61,7 @@ public Optional> getEntityOnly() { return entityOnly; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof TokenTypeWithoutVault && equalTo((TokenTypeWithoutVault) other); @@ -78,12 +78,12 @@ private boolean equalTo(TokenTypeWithoutVault other) { && entityOnly.equals(other.entityOnly); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.default_, this.entityUnqCounter, this.entityOnly); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java b/v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java rename to v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java index 45dba579..d7d0d573 100644 --- a/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java @@ -17,7 +17,7 @@ public enum TokenTypeWithoutVaultDefault { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/Transformations.java b/v2/src/main/java/com/skyflow/generated/rest/types/Transformations.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/Transformations.java rename to v2/src/main/java/com/skyflow/generated/rest/types/Transformations.java index 46022faa..bef63c2a 100644 --- a/src/main/java/com/skyflow/generated/rest/types/Transformations.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/Transformations.java @@ -37,7 +37,7 @@ public Optional getShiftDates() { return shiftDates; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof Transformations && equalTo((Transformations) other); @@ -52,12 +52,12 @@ private boolean equalTo(Transformations other) { return shiftDates.equals(other.shiftDates); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.shiftDates); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java b/v2/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java rename to v2/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java index 1e11938b..e9206467 100644 --- a/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java @@ -64,7 +64,7 @@ public Optional> getEntityTypes() return entityTypes; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof TransformationsShiftDates && equalTo((TransformationsShiftDates) other); @@ -79,12 +79,12 @@ private boolean equalTo(TransformationsShiftDates other) { return maxDays.equals(other.maxDays) && minDays.equals(other.minDays) && entityTypes.equals(other.entityTypes); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.maxDays, this.minDays, this.entityTypes); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java b/v2/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java rename to v2/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java index 148cea23..3da8eb6d 100644 --- a/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java @@ -19,7 +19,7 @@ public enum TransformationsShiftDatesEntityTypesItem { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java index 999153e4..2aee86d5 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java @@ -60,7 +60,7 @@ public Optional getSchema() { return schema; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AdvancedOptions && equalTo((V1AdvancedOptions) other); @@ -77,12 +77,12 @@ private boolean equalTo(V1AdvancedOptions other) { && schema.equals(other.schema); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.dateShift, this.customClient, this.schema); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java index 50e5508a..3d2c9102 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java @@ -57,7 +57,7 @@ public Optional getOptions() { return options; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AudioConfig && equalTo((V1AudioConfig) other); @@ -74,12 +74,12 @@ private boolean equalTo(V1AudioConfig other) { && options.equals(other.options); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.outputTranscription, this.outputProcessedAudio, this.options); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java index d71b77a0..c4d88e7a 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java @@ -87,7 +87,7 @@ public Optional getBleepGain() { return bleepGain; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AudioOptions && equalTo((V1AudioOptions) other); @@ -106,7 +106,7 @@ private boolean equalTo(V1AudioOptions other) { && bleepGain.equals(other.bleepGain); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.bleepStartPadding, @@ -116,7 +116,7 @@ public int hashCode() { this.bleepGain); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java index 1453dd99..d942fdcd 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java @@ -49,7 +49,7 @@ public Optional getChangeId() { return changeId; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AuditAfterOptions && equalTo((V1AuditAfterOptions) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1AuditAfterOptions other) { return timestamp.equals(other.timestamp) && changeId.equals(other.changeId); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.timestamp, this.changeId); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java index 2dd2ca4e..c582d06d 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java @@ -72,7 +72,7 @@ public Optional getTimestamp() { return timestamp; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AuditEventResponse && equalTo((V1AuditEventResponse) other); @@ -90,12 +90,12 @@ private boolean equalTo(V1AuditEventResponse other) { && timestamp.equals(other.timestamp); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.code, this.message, this.data, this.timestamp); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java index 88496f03..dd23d77c 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java @@ -49,7 +49,7 @@ public Optional getNextOps() { return nextOps; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AuditResponse && equalTo((V1AuditResponse) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1AuditResponse other) { return event.equals(other.event) && nextOps.equals(other.nextOps); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.event, this.nextOps); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java index 595b724c..ca2bfdc2 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java @@ -91,7 +91,7 @@ public Optional> getResourceIDs() { return resourceIDs; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AuditResponseEvent && equalTo((V1AuditResponseEvent) other); @@ -111,13 +111,13 @@ private boolean equalTo(V1AuditResponseEvent other) { && resourceIDs.equals(other.resourceIDs); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.context, this.request, this.response, this.parentAccountId, this.accountId, this.resourceIDs); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java index c77bc31f..046c8fb4 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java @@ -124,7 +124,7 @@ public Optional getHttpInfo() { return httpInfo; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1AuditResponseEventRequest && equalTo((V1AuditResponseEventRequest) other); @@ -147,7 +147,7 @@ private boolean equalTo(V1AuditResponseEventRequest other) { && httpInfo.equals(other.httpInfo); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.data, @@ -161,7 +161,7 @@ public int hashCode() { this.httpInfo); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java index 03d752d9..a557da82 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java @@ -52,7 +52,7 @@ public Optional>> getResponses() { return responses; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1BatchOperationResponse && equalTo((V1BatchOperationResponse) other); @@ -67,12 +67,12 @@ private boolean equalTo(V1BatchOperationResponse other) { return vaultId.equals(other.vaultId) && responses.equals(other.responses); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.vaultId, this.responses); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java index 39eb2e68..afc572cf 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java @@ -141,7 +141,7 @@ public Optional> getTokens() { return tokens; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1BatchRecord && equalTo((V1BatchRecord) other); @@ -165,7 +165,7 @@ private boolean equalTo(V1BatchRecord other) { && tokens.equals(other.tokens); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.fields, @@ -180,7 +180,7 @@ public int hashCode() { this.tokens); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java index cf3a3326..58472a8b 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java @@ -38,7 +38,7 @@ public Optional> getCardsData() { return cardsData; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1BinListResponse && equalTo((V1BinListResponse) other); @@ -53,12 +53,12 @@ private boolean equalTo(V1BinListResponse other) { return cardsData.equals(other.cardsData); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.cardsData); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java index 5f781686..ddb0d213 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java @@ -39,7 +39,7 @@ public Optional> getRecordIdResponse() { return recordIdResponse; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1BulkDeleteRecordResponse && equalTo((V1BulkDeleteRecordResponse) other); @@ -54,12 +54,12 @@ private boolean equalTo(V1BulkDeleteRecordResponse other) { return recordIdResponse.equals(other.recordIdResponse); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.recordIdResponse); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java index 70d31034..c2d3790a 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java @@ -38,7 +38,7 @@ public Optional> getRecords() { return records; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1BulkGetRecordResponse && equalTo((V1BulkGetRecordResponse) other); @@ -53,12 +53,12 @@ private boolean equalTo(V1BulkGetRecordResponse other) { return records.equals(other.records); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1Byot.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1Byot.java similarity index 94% rename from src/main/java/com/skyflow/generated/rest/types/V1Byot.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1Byot.java index 819fdb42..bafd7a09 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1Byot.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1Byot.java @@ -19,7 +19,7 @@ public enum V1Byot { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1Card.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1Card.java similarity index 99% rename from src/main/java/com/skyflow/generated/rest/types/V1Card.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1Card.java index d19d3099..f2a9db90 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1Card.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1Card.java @@ -135,7 +135,7 @@ public Optional getCardExpiry() { return cardExpiry; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1Card && equalTo((V1Card) other); @@ -158,7 +158,7 @@ private boolean equalTo(V1Card other) { && cardExpiry.equals(other.cardExpiry); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.bin, @@ -172,7 +172,7 @@ public int hashCode() { this.cardExpiry); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java index efdb8e42..4ec85903 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java @@ -49,7 +49,7 @@ public Optional getDeleted() { return deleted; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DeleteFileResponse && equalTo((V1DeleteFileResponse) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1DeleteFileResponse other) { return skyflowId.equals(other.skyflowId) && deleted.equals(other.deleted); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.skyflowId, this.deleted); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java index 700bfe2f..2f3bde14 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java @@ -49,7 +49,7 @@ public Optional getDeleted() { return deleted; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DeleteRecordResponse && equalTo((V1DeleteRecordResponse) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1DeleteRecordResponse other) { return skyflowId.equals(other.skyflowId) && deleted.equals(other.deleted); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.skyflowId, this.deleted); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java index 0c309cb9..26b8320e 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java @@ -37,7 +37,7 @@ public Optional getStatusUrl() { return statusUrl; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetectFileResponse && equalTo((V1DetectFileResponse) other); @@ -52,12 +52,12 @@ private boolean equalTo(V1DetectFileResponse other) { return statusUrl.equals(other.statusUrl); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.statusUrl); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java index 95e7845c..183cd103 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java @@ -61,7 +61,7 @@ public Optional getMessage() { return message; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetectStatusResponse && equalTo((V1DetectStatusResponse) other); @@ -76,12 +76,12 @@ private boolean equalTo(V1DetectStatusResponse other) { return status.equals(other.status) && output.equals(other.output) && message.equals(other.message); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.status, this.output, this.message); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java index c819b167..58f848ca 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java @@ -21,7 +21,7 @@ public enum V1DetectStatusResponseStatus { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java index 57778d80..6f518de6 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java @@ -152,7 +152,7 @@ public Optional getStoreEntities() { return storeEntities; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetectTextRequest && equalTo((V1DetectTextRequest) other); @@ -177,7 +177,7 @@ private boolean equalTo(V1DetectTextRequest other) { && storeEntities.equals(other.storeEntities); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash( this.text, @@ -193,7 +193,7 @@ public int hashCode() { this.storeEntities); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } @@ -305,7 +305,7 @@ public static final class Builder implements TextStage, VaultIdStage, _FinalStag private Builder() {} - @java.lang.Override + @Override public Builder from(V1DetectTextRequest other) { text(other.getText()); vaultId(other.getVaultId()); @@ -325,7 +325,7 @@ public Builder from(V1DetectTextRequest other) { * Data to deidentify.

Data to deidentify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("text") public VaultIdStage text(@NotNull String text) { this.text = Objects.requireNonNull(text, "text must not be null"); @@ -336,7 +336,7 @@ public VaultIdStage text(@NotNull String text) { * ID of the vault.

ID of the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override @JsonSetter("vault_id") public _FinalStage vaultId(@NotNull String vaultId) { this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); @@ -347,7 +347,7 @@ public _FinalStage vaultId(@NotNull String vaultId) { *

Indicates whether entities should be stored in the vault.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage storeEntities(Boolean storeEntities) { this.storeEntities = Optional.ofNullable(storeEntities); return this; @@ -356,33 +356,33 @@ public _FinalStage storeEntities(Boolean storeEntities) { /** *

Indicates whether entities should be stored in the vault.

*/ - @java.lang.Override + @Override @JsonSetter(value = "store_entities", nulls = Nulls.SKIP) public _FinalStage storeEntities(Optional storeEntities) { this.storeEntities = storeEntities; return this; } - @java.lang.Override + @Override public _FinalStage advancedOptions(V1AdvancedOptions advancedOptions) { this.advancedOptions = Optional.ofNullable(advancedOptions); return this; } - @java.lang.Override + @Override @JsonSetter(value = "advanced_options", nulls = Nulls.SKIP) public _FinalStage advancedOptions(Optional advancedOptions) { this.advancedOptions = advancedOptions; return this; } - @java.lang.Override + @Override public _FinalStage accuracy(DetectDataAccuracy accuracy) { this.accuracy = Optional.ofNullable(accuracy); return this; } - @java.lang.Override + @Override @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) public _FinalStage accuracy(Optional accuracy) { this.accuracy = accuracy; @@ -393,7 +393,7 @@ public _FinalStage accuracy(Optional accuracy) { *

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 + @Override public _FinalStage returnEntities(Boolean returnEntities) { this.returnEntities = Optional.ofNullable(returnEntities); return this; @@ -402,7 +402,7 @@ public _FinalStage returnEntities(Boolean returnEntities) { /** *

If true, returns the details for the detected entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "return_entities", nulls = Nulls.SKIP) public _FinalStage returnEntities(Optional returnEntities) { this.returnEntities = returnEntities; @@ -413,7 +413,7 @@ public _FinalStage returnEntities(Optional returnEntities) { *

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 + @Override public _FinalStage restrictRegex(List restrictRegex) { this.restrictRegex = Optional.ofNullable(restrictRegex); return this; @@ -422,7 +422,7 @@ public _FinalStage restrictRegex(List restrictRegex) { /** *

Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.

*/ - @java.lang.Override + @Override @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) public _FinalStage restrictRegex(Optional> restrictRegex) { this.restrictRegex = restrictRegex; @@ -433,7 +433,7 @@ public _FinalStage restrictRegex(Optional> restrictRegex) { *

Regular expressions to ignore when detecting entities.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage allowRegex(List allowRegex) { this.allowRegex = Optional.ofNullable(allowRegex); return this; @@ -442,20 +442,20 @@ public _FinalStage allowRegex(List allowRegex) { /** *

Regular expressions to ignore when detecting entities.

*/ - @java.lang.Override + @Override @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) public _FinalStage allowRegex(Optional> allowRegex) { this.allowRegex = allowRegex; return this; } - @java.lang.Override + @Override public _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat) { this.deidentifyTokenFormat = Optional.ofNullable(deidentifyTokenFormat); return this; } - @java.lang.Override + @Override @JsonSetter(value = "deidentify_token_format", nulls = Nulls.SKIP) public _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat) { this.deidentifyTokenFormat = deidentifyTokenFormat; @@ -466,7 +466,7 @@ public _FinalStage deidentifyTokenFormat(Optional *

Entities to detect and deidentify.

* @return Reference to {@code this} so that method calls can be chained together. */ - @java.lang.Override + @Override public _FinalStage restrictEntityTypes(List restrictEntityTypes) { this.restrictEntityTypes = Optional.ofNullable(restrictEntityTypes); return this; @@ -475,7 +475,7 @@ public _FinalStage restrictEntityTypes(List restrictEntityTy /** *

Entities to detect and deidentify.

*/ - @java.lang.Override + @Override @JsonSetter(value = "restrict_entity_types", nulls = Nulls.SKIP) public _FinalStage restrictEntityTypes(Optional> restrictEntityTypes) { this.restrictEntityTypes = restrictEntityTypes; @@ -486,7 +486,7 @@ public _FinalStage restrictEntityTypes(Optional> restri *

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 + @Override public _FinalStage sessionId(String sessionId) { this.sessionId = Optional.ofNullable(sessionId); return this; @@ -495,14 +495,14 @@ public _FinalStage sessionId(String sessionId) { /** *

Will give a handle to delete the tokens generated during a specific interaction.

*/ - @java.lang.Override + @Override @JsonSetter(value = "session_id", nulls = Nulls.SKIP) public _FinalStage sessionId(Optional sessionId) { this.sessionId = sessionId; return this; } - @java.lang.Override + @Override public V1DetectTextRequest build() { return new V1DetectTextRequest( text, diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java index a07c3344..de6090d6 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java @@ -52,7 +52,7 @@ public Optional> getEntities() { return entities; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetectTextResponse && equalTo((V1DetectTextResponse) other); @@ -67,12 +67,12 @@ private boolean equalTo(V1DetectTextResponse other) { return processedText.equals(other.processedText) && entities.equals(other.entities); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.processedText, this.entities); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java index 5b6927d1..3cf5b59c 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java @@ -48,7 +48,7 @@ public Optional getRedaction() { return redaction; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetokenizeRecordRequest && equalTo((V1DetokenizeRecordRequest) other); @@ -63,12 +63,12 @@ private boolean equalTo(V1DetokenizeRecordRequest other) { return token.equals(other.token) && redaction.equals(other.redaction); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.token, this.redaction); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java index 423abfe8..ba0abbfa 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java @@ -72,7 +72,7 @@ public Optional getError() { return error; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetokenizeRecordResponse && equalTo((V1DetokenizeRecordResponse) other); @@ -90,12 +90,12 @@ private boolean equalTo(V1DetokenizeRecordResponse other) { && error.equals(other.error); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.token, this.valueType, this.value, this.error); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java index 20d7d8e4..74f4f6e6 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java @@ -39,7 +39,7 @@ public Optional> getRecords() { return records; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1DetokenizeResponse && equalTo((V1DetokenizeResponse) other); @@ -54,12 +54,12 @@ private boolean equalTo(V1DetokenizeResponse other) { return records.equals(other.records); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java index 8d520d3b..dfbccb8b 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java @@ -51,7 +51,7 @@ public Optional> getTokens() { return tokens; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1FieldRecords && equalTo((V1FieldRecords) other); @@ -66,12 +66,12 @@ private boolean equalTo(V1FieldRecords other) { return fields.equals(other.fields) && tokens.equals(other.tokens); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.fields, this.tokens); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java index afe545fe..02658ef2 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java @@ -31,7 +31,7 @@ public enum V1FileAvScanStatus { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java similarity index 96% rename from src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java index a384af7f..8e4b568c 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java @@ -51,7 +51,7 @@ public enum V1FileDataFormat { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java index 9b6be70b..f5669085 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java @@ -49,7 +49,7 @@ public Optional getTokenType() { return tokenType; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1GetAuthTokenResponse && equalTo((V1GetAuthTokenResponse) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1GetAuthTokenResponse other) { return accessToken.equals(other.accessToken) && tokenType.equals(other.tokenType); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.accessToken, this.tokenType); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java index 27100e6d..4bd67013 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java @@ -35,7 +35,7 @@ public Optional getAvScanStatus() { return avScanStatus; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1GetFileScanStatusResponse && equalTo((V1GetFileScanStatusResponse) other); @@ -50,12 +50,12 @@ private boolean equalTo(V1GetFileScanStatusResponse other) { return avScanStatus.equals(other.avScanStatus); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.avScanStatus); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java index 6a8689ae..821d1f06 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java @@ -38,7 +38,7 @@ public Optional> getRecords() { return records; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1GetQueryResponse && equalTo((V1GetQueryResponse) other); @@ -53,12 +53,12 @@ private boolean equalTo(V1GetQueryResponse other) { return records.equals(other.records); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java index cd40fb5b..f457b11b 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java @@ -51,7 +51,7 @@ public Optional getOutputOcrText() { return outputOcrText; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1ImageOptions && equalTo((V1ImageOptions) other); @@ -66,12 +66,12 @@ private boolean equalTo(V1ImageOptions other) { return outputProcessedImage.equals(other.outputProcessedImage) && outputOcrText.equals(other.outputOcrText); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.outputProcessedImage, this.outputOcrText); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java index 724bee91..0addf786 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java @@ -39,7 +39,7 @@ public Optional> getRecords() { return records; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1InsertRecordResponse && equalTo((V1InsertRecordResponse) other); @@ -54,12 +54,12 @@ private boolean equalTo(V1InsertRecordResponse other) { return records.equals(other.records); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1Locations.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1Locations.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1Locations.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1Locations.java index ef1593ca..07a7b7e7 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1Locations.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1Locations.java @@ -75,7 +75,7 @@ public Optional getEndIndexProcessed() { return endIndexProcessed; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1Locations && equalTo((V1Locations) other); @@ -93,12 +93,12 @@ private boolean equalTo(V1Locations other) { && endIndexProcessed.equals(other.endIndexProcessed); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.startIndex, this.endIndex, this.startIndexProcessed, this.endIndexProcessed); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java similarity index 95% rename from src/main/java/com/skyflow/generated/rest/types/V1MemberType.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java index dacca1b9..48e96379 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java @@ -19,7 +19,7 @@ public enum V1MemberType { } @JsonValue - @java.lang.Override + @Override public String toString() { return this.value; } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java index 8731c1b9..b8a6efde 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java @@ -34,7 +34,7 @@ public Optional getOptions() { return options; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1PdfConfig && equalTo((V1PdfConfig) other); @@ -49,12 +49,12 @@ private boolean equalTo(V1PdfConfig other) { return options.equals(other.options); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.options); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java index 63de909b..312d2702 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java @@ -49,7 +49,7 @@ public Optional getMaxResolution() { return maxResolution; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1PdfOptions && equalTo((V1PdfOptions) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1PdfOptions other) { return density.equals(other.density) && maxResolution.equals(other.maxResolution); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.density, this.maxResolution); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java index e4117109..ba09f5bc 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java @@ -57,7 +57,7 @@ public Optional getProcessedFileType() { return processedFileType; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1ProcessedFileOutput && equalTo((V1ProcessedFileOutput) other); @@ -74,12 +74,12 @@ private boolean equalTo(V1ProcessedFileOutput other) { && processedFileType.equals(other.processedFileType); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.outputType, this.processedFile, this.processedFileType); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java index 419b8e16..f69719cf 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java @@ -51,7 +51,7 @@ public Optional> getTokens() { return tokens; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1RecordMetaProperties && equalTo((V1RecordMetaProperties) other); @@ -66,12 +66,12 @@ private boolean equalTo(V1RecordMetaProperties other) { return skyflowId.equals(other.skyflowId) && tokens.equals(other.tokens); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.skyflowId, this.tokens); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java index c02ab39f..001fa29e 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java @@ -84,7 +84,7 @@ public Optional> getLabels() { return labels; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1ResponseEntities && equalTo((V1ResponseEntities) other); @@ -103,12 +103,12 @@ private boolean equalTo(V1ResponseEntities other) { && labels.equals(other.labels); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.processedText, this.originalText, this.location, this.bestLabel, this.labels); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java index 03c5ef89..2c15ceac 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java @@ -49,7 +49,7 @@ public Optional getColumnGroup() { return columnGroup; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1TokenizeRecordRequest && equalTo((V1TokenizeRecordRequest) other); @@ -64,12 +64,12 @@ private boolean equalTo(V1TokenizeRecordRequest other) { return value.equals(other.value) && columnGroup.equals(other.columnGroup); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.value, this.columnGroup); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java index 4cd41dd0..201a4f60 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java @@ -37,7 +37,7 @@ public Optional getToken() { return token; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1TokenizeRecordResponse && equalTo((V1TokenizeRecordResponse) other); @@ -52,12 +52,12 @@ private boolean equalTo(V1TokenizeRecordResponse other) { return token.equals(other.token); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.token); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java similarity index 97% rename from src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java index 38159283..62d77bed 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java @@ -39,7 +39,7 @@ public Optional> getRecords() { return records; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1TokenizeResponse && equalTo((V1TokenizeResponse) other); @@ -54,12 +54,12 @@ private boolean equalTo(V1TokenizeResponse other) { return records.equals(other.records); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.records); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java index 658926b9..03ed7b58 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java @@ -51,7 +51,7 @@ public Optional> getTokens() { return tokens; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1UpdateRecordResponse && equalTo((V1UpdateRecordResponse) other); @@ -66,12 +66,12 @@ private boolean equalTo(V1UpdateRecordResponse other) { return skyflowId.equals(other.skyflowId) && tokens.equals(other.tokens); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.skyflowId, this.tokens); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java index bad4474a..c19d1cb5 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java @@ -63,7 +63,7 @@ public Optional getCardExpiry() { return cardExpiry; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1VaultFieldMapping && equalTo((V1VaultFieldMapping) other); @@ -80,12 +80,12 @@ private boolean equalTo(V1VaultFieldMapping other) { && cardExpiry.equals(other.cardExpiry); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.cardNumber, this.cardLastFourDigits, this.cardExpiry); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java b/v2/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java similarity index 98% rename from src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java rename to v2/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java index 28a609b6..cd838305 100644 --- a/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java +++ b/v2/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java @@ -60,7 +60,7 @@ public Optional getMapping() { return mapping; } - @java.lang.Override + @Override public boolean equals(Object other) { if (this == other) return true; return other instanceof V1VaultSchemaConfig && equalTo((V1VaultSchemaConfig) other); @@ -75,12 +75,12 @@ private boolean equalTo(V1VaultSchemaConfig other) { return id.equals(other.id) && tableName.equals(other.tableName) && mapping.equals(other.mapping); } - @java.lang.Override + @Override public int hashCode() { return Objects.hash(this.id, this.tableName, this.mapping); } - @java.lang.Override + @Override public String toString() { return ObjectMappers.stringify(this); } diff --git a/v2/src/main/java/com/skyflow/utils/Constants.java b/v2/src/main/java/com/skyflow/utils/Constants.java new file mode 100644 index 00000000..9b850bf0 --- /dev/null +++ b/v2/src/main/java/com/skyflow/utils/Constants.java @@ -0,0 +1,10 @@ +package com.skyflow.utils; + +public final class Constants extends BaseConstants { + public static final String SDK_NAME = "Skyflow Java SDK "; + public static final String SDK_VERSION = "2.0.0-beta.2"; + public static final String SDK_PREFIX = SDK_NAME + SDK_VERSION; + public static final String VAULT_DOMAIN = ".vault."; + public static final String PROCESSED_FILE_NAME_PREFIX = "processed-"; + public static final String DEIDENTIFIED_FILE_PREFIX = "deidentified"; +} diff --git a/src/main/java/com/skyflow/utils/HttpUtility.java b/v2/src/main/java/com/skyflow/utils/HttpUtility.java similarity index 100% rename from src/main/java/com/skyflow/utils/HttpUtility.java rename to v2/src/main/java/com/skyflow/utils/HttpUtility.java diff --git a/v2/src/main/java/com/skyflow/utils/Utils.java b/v2/src/main/java/com/skyflow/utils/Utils.java new file mode 100644 index 00000000..ff43c089 --- /dev/null +++ b/v2/src/main/java/com/skyflow/utils/Utils.java @@ -0,0 +1,57 @@ +package com.skyflow.utils; + +import com.google.gson.JsonObject; +import com.skyflow.config.ConnectionConfig; +import com.skyflow.enums.Env; +import com.skyflow.vault.connection.InvokeConnectionRequest; + +import java.util.HashMap; +import java.util.Map; + +public final class Utils extends BaseUtils { + + public static String getVaultURL(String clusterId, Env env) { + return getVaultURL(clusterId, env, Constants.VAULT_DOMAIN); + } + + public static String constructConnectionURL(ConnectionConfig config, InvokeConnectionRequest invokeConnectionRequest) { + StringBuilder filledURL = new StringBuilder(config.getConnectionUrl()); + + if (invokeConnectionRequest.getPathParams() != null && !invokeConnectionRequest.getPathParams().isEmpty()) { + for (Map.Entry entry : invokeConnectionRequest.getPathParams().entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + filledURL = new StringBuilder(filledURL.toString().replace(String.format("{%s}", key), value)); + } + } + + if (invokeConnectionRequest.getQueryParams() != null && !invokeConnectionRequest.getQueryParams().isEmpty()) { + filledURL.append("?"); + for (Map.Entry entry : invokeConnectionRequest.getQueryParams().entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + filledURL.append(key).append("=").append(value).append("&"); + } + filledURL = new StringBuilder(filledURL.substring(0, filledURL.length() - 1)); + } + + return filledURL.toString(); + } + + public static Map constructConnectionHeadersMap(Map requestHeaders) { + Map headersMap = new HashMap<>(); + for (Map.Entry entry : requestHeaders.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + headersMap.put(key.toLowerCase(), value); + } + return headersMap; + } + + public static JsonObject getMetrics() { + JsonObject details = getCommonMetrics(); + String sdkVersion = Constants.SDK_VERSION; + details.addProperty(Constants.SDK_METRIC_NAME_VERSION, Constants.SDK_METRIC_NAME_VERSION_PREFIX + sdkVersion); + return details; + } +} diff --git a/src/main/java/com/skyflow/utils/validations/Validations.java b/v2/src/main/java/com/skyflow/utils/validations/Validations.java similarity index 88% rename from src/main/java/com/skyflow/utils/validations/Validations.java rename to v2/src/main/java/com/skyflow/utils/validations/Validations.java index 841c03b6..ccc1790d 100644 --- a/src/main/java/com/skyflow/utils/validations/Validations.java +++ b/v2/src/main/java/com/skyflow/utils/validations/Validations.java @@ -3,8 +3,6 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; import com.skyflow.config.ConnectionConfig; -import com.skyflow.config.Credentials; -import com.skyflow.config.VaultConfig; import com.skyflow.enums.InterfaceName; import com.skyflow.enums.RedactionType; import com.skyflow.enums.TokenMode; @@ -12,12 +10,14 @@ import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.logs.ErrorLogs; -import com.skyflow.utils.Constants; import com.skyflow.utils.Utils; import com.skyflow.utils.logger.LogUtil; import com.skyflow.vault.connection.InvokeConnectionRequest; import com.skyflow.vault.data.*; -import com.skyflow.vault.detect.*; +import com.skyflow.vault.detect.DeidentifyFileRequest; +import com.skyflow.vault.detect.DeidentifyTextRequest; +import com.skyflow.vault.detect.GetDetectRunRequest; +import com.skyflow.vault.detect.ReidentifyTextRequest; import com.skyflow.vault.tokens.ColumnValue; import com.skyflow.vault.tokens.DetokenizeData; import com.skyflow.vault.tokens.DetokenizeRequest; @@ -29,32 +29,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -public class Validations { +public class Validations extends BaseValidations { private Validations() { - } - - public static void validateVaultConfig(VaultConfig vaultConfig) throws SkyflowException { - String vaultId = vaultConfig.getVaultId(); - String clusterId = vaultConfig.getClusterId(); - Credentials credentials = vaultConfig.getCredentials(); - if (vaultId == null) { - LogUtil.printErrorLog(ErrorLogs.VAULT_ID_IS_REQUIRED.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidVaultId.getMessage()); - } else if (vaultId.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_VAULT_ID.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyVaultId.getMessage()); - } else if (clusterId == null) { - LogUtil.printErrorLog(ErrorLogs.CLUSTER_ID_IS_REQUIRED.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidClusterId.getMessage()); - } else if (clusterId.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_CLUSTER_ID.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyClusterId.getMessage()); - } else if (credentials != null) { - validateCredentials(credentials); - } + super(); } public static void validateConnectionConfig(ConnectionConfig connectionConfig) throws SkyflowException { @@ -147,73 +125,6 @@ public static void validateInvokeConnectionRequest(InvokeConnectionRequest invok } } - public static void validateCredentials(Credentials credentials) throws SkyflowException { - int nonNullMembers = 0; - String path = credentials.getPath(); - String credentialsString = credentials.getCredentialsString(); - String token = credentials.getToken(); - String apiKey = credentials.getApiKey(); - String context = credentials.getContext(); - ArrayList roles = credentials.getRoles(); - - if (path != null) nonNullMembers++; - if (credentialsString != null) nonNullMembers++; - if (token != null) nonNullMembers++; - if (apiKey != null) nonNullMembers++; - - if (nonNullMembers > 1) { - LogUtil.printErrorLog(ErrorLogs.MULTIPLE_TOKEN_GENERATION_MEANS_PASSED.getLog()); - throw new SkyflowException( - ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.MultipleTokenGenerationMeansPassed.getMessage() - ); - } else if (nonNullMembers < 1) { - LogUtil.printErrorLog(ErrorLogs.NO_TOKEN_GENERATION_MEANS_PASSED.getLog()); - throw new SkyflowException( - ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.NoTokenGenerationMeansPassed.getMessage() - ); - } else if (path != null && path.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_CREDENTIALS_PATH.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyCredentialFilePath.getMessage()); - } else if (credentialsString != null && credentialsString.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_CREDENTIALS_STRING.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyCredentialsString.getMessage()); - } else if (token != null && token.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_TOKEN_VALUE.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyToken.getMessage()); - } else if (apiKey != null) { - if (apiKey.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_API_KEY_VALUE.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyApikey.getMessage()); - } else { - Pattern pattern = Pattern.compile(Constants.API_KEY_REGEX); - Matcher matcher = pattern.matcher(apiKey); - if (!matcher.matches()) { - LogUtil.printErrorLog(ErrorLogs.INVALID_API_KEY.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidApikey.getMessage()); - } - } - } else if (roles != null) { - if (roles.isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_ROLES.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyRoles.getMessage()); - } else { - for (int index = 0; index < roles.size(); index++) { - String role = roles.get(index); - if (role == null || role.trim().isEmpty()) { - LogUtil.printErrorLog(Utils.parameterizedString( - ErrorLogs.EMPTY_OR_NULL_ROLE_IN_ROLES.getLog(), Integer.toString(index) - )); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyRoleInRoles.getMessage()); - } - } - } - } - if (context != null && context.trim().isEmpty()) { - LogUtil.printErrorLog(ErrorLogs.EMPTY_OR_NULL_CONTEXT.getLog()); - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyContext.getMessage()); - } - } - public static void validateDetokenizeRequest(DetokenizeRequest detokenizeRequest) throws SkyflowException { ArrayList detokenizeData = detokenizeRequest.getDetokenizeData(); if (detokenizeData == null) { @@ -802,7 +713,7 @@ public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.BothFileAndFilePathProvided.getMessage()); } - if (filePath != null && filePath.trim().isEmpty()){ + if (filePath != null && filePath.trim().isEmpty()) { throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidFilePath.getMessage()); } @@ -838,7 +749,7 @@ public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) if (request.getBleep() != null) { if (request.getBleep().getFrequency() == null || request.getBleep().getFrequency() <= 0) { LogUtil.printErrorLog(Utils.parameterizedString( - ErrorLogs.INVALID_BLEEP_TO_DEIDENTIFY_AUDIO.getLog(), InterfaceName.DETECT.getName() + ErrorLogs.INVALID_BLEEP_TO_DEIDENTIFY_AUDIO.getLog(), InterfaceName.DETECT.getName() )); throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidRequestBody.getMessage()); } @@ -858,13 +769,13 @@ public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) File outDir = new File(request.getOutputDirectory()); if (!outDir.exists() || !outDir.isDirectory()) { LogUtil.printErrorLog(Utils.parameterizedString( - ErrorLogs.OUTPUT_DIRECTORY_NOT_FOUND.getLog(), InterfaceName.DETECT.getName() + ErrorLogs.OUTPUT_DIRECTORY_NOT_FOUND.getLog(), InterfaceName.DETECT.getName() )); throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.OutputDirectoryNotFound.getMessage()); } if (!outDir.canWrite()) { LogUtil.printErrorLog(Utils.parameterizedString( - ErrorLogs.INVALID_PERMISSIONS_FOR_OUTPUT_DIRECTORY.getLog(), InterfaceName.DETECT.getName() + ErrorLogs.INVALID_PERMISSIONS_FOR_OUTPUT_DIRECTORY.getLog(), InterfaceName.DETECT.getName() )); throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidPermission.getMessage()); } @@ -874,7 +785,7 @@ public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) if (request.getWaitTime() != null && request.getWaitTime() <= 0) { throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidWaitTime.getMessage()); } - if(request.getWaitTime() > 64) { + if (request.getWaitTime() > 64) { throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.WaitTimeExceedsLimit.getMessage()); } } diff --git a/src/main/java/com/skyflow/vault/connection/InvokeConnectionRequest.java b/v2/src/main/java/com/skyflow/vault/connection/InvokeConnectionRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/connection/InvokeConnectionRequest.java rename to v2/src/main/java/com/skyflow/vault/connection/InvokeConnectionRequest.java diff --git a/src/main/java/com/skyflow/vault/connection/InvokeConnectionResponse.java b/v2/src/main/java/com/skyflow/vault/connection/InvokeConnectionResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/connection/InvokeConnectionResponse.java rename to v2/src/main/java/com/skyflow/vault/connection/InvokeConnectionResponse.java diff --git a/src/main/java/com/skyflow/vault/controller/ConnectionController.java b/v2/src/main/java/com/skyflow/vault/controller/ConnectionController.java similarity index 100% rename from src/main/java/com/skyflow/vault/controller/ConnectionController.java rename to v2/src/main/java/com/skyflow/vault/controller/ConnectionController.java diff --git a/src/main/java/com/skyflow/vault/controller/DetectController.java b/v2/src/main/java/com/skyflow/vault/controller/DetectController.java similarity index 99% rename from src/main/java/com/skyflow/vault/controller/DetectController.java rename to v2/src/main/java/com/skyflow/vault/controller/DetectController.java index 411658ae..c16c167b 100644 --- a/src/main/java/com/skyflow/vault/controller/DetectController.java +++ b/v2/src/main/java/com/skyflow/vault/controller/DetectController.java @@ -137,9 +137,9 @@ public DeidentifyFileResponse deidentifyFile(DeidentifyFileRequest request) thro outputFile = new File(outputFileName); } try { - java.nio.file.Files.write(outputFile.toPath(), decodedBytes); + Files.write(outputFile.toPath(), decodedBytes); } catch (IOException ioe) { - throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FailedtoSaveProcessedFile.getMessage()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FailedToSaveProcessedFile.getMessage()); } } diff --git a/src/main/java/com/skyflow/vault/controller/VaultController.java b/v2/src/main/java/com/skyflow/vault/controller/VaultController.java similarity index 99% rename from src/main/java/com/skyflow/vault/controller/VaultController.java rename to v2/src/main/java/com/skyflow/vault/controller/VaultController.java index 84e528b0..adac6e0c 100644 --- a/src/main/java/com/skyflow/vault/controller/VaultController.java +++ b/v2/src/main/java/com/skyflow/vault/controller/VaultController.java @@ -22,6 +22,7 @@ import com.skyflow.utils.validations.Validations; import com.skyflow.vault.data.*; import com.skyflow.vault.tokens.*; + import java.util.*; public final class VaultController extends VaultClient { diff --git a/src/main/java/com/skyflow/vault/data/DeleteRequest.java b/v2/src/main/java/com/skyflow/vault/data/DeleteRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/DeleteRequest.java rename to v2/src/main/java/com/skyflow/vault/data/DeleteRequest.java diff --git a/src/main/java/com/skyflow/vault/data/DeleteResponse.java b/v2/src/main/java/com/skyflow/vault/data/DeleteResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/DeleteResponse.java rename to v2/src/main/java/com/skyflow/vault/data/DeleteResponse.java diff --git a/src/main/java/com/skyflow/vault/data/GetRequest.java b/v2/src/main/java/com/skyflow/vault/data/GetRequest.java similarity index 96% rename from src/main/java/com/skyflow/vault/data/GetRequest.java rename to v2/src/main/java/com/skyflow/vault/data/GetRequest.java index 04626e35..5fa59852 100644 --- a/src/main/java/com/skyflow/vault/data/GetRequest.java +++ b/v2/src/main/java/com/skyflow/vault/data/GetRequest.java @@ -1,6 +1,7 @@ package com.skyflow.vault.data; import com.skyflow.enums.RedactionType; +import com.skyflow.utils.BaseConstants; import com.skyflow.utils.Constants; import java.util.ArrayList; @@ -24,10 +25,6 @@ public ArrayList getIds() { return this.builder.ids; } - public RedactionType getRedactionType() { - return this.builder.redactionType; - } - public Boolean getReturnTokens() { return this.builder.returnTokens; } @@ -60,10 +57,13 @@ public String getOrderBy() { return this.builder.orderBy; } + public RedactionType getRedactionType() { + return this.builder.redactionType; + } + public static final class GetRequestBuilder { private String table; private ArrayList ids; - private RedactionType redactionType; private Boolean returnTokens; private ArrayList fields; private String offset; @@ -72,6 +72,7 @@ public static final class GetRequestBuilder { private String columnName; private ArrayList columnValues; private String orderBy; + private RedactionType redactionType; private GetRequestBuilder() { this.downloadURL = true; @@ -129,7 +130,7 @@ public GetRequestBuilder columnValues(ArrayList columnValues) { } public GetRequestBuilder orderBy(String orderBy) { - this.orderBy = orderBy == null ? Constants.ORDER_ASCENDING : orderBy; + this.orderBy = orderBy == null ? BaseConstants.ORDER_ASCENDING : orderBy; return this; } diff --git a/src/main/java/com/skyflow/vault/data/GetResponse.java b/v2/src/main/java/com/skyflow/vault/data/GetResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/GetResponse.java rename to v2/src/main/java/com/skyflow/vault/data/GetResponse.java diff --git a/src/main/java/com/skyflow/vault/data/InsertRequest.java b/v2/src/main/java/com/skyflow/vault/data/InsertRequest.java similarity index 84% rename from src/main/java/com/skyflow/vault/data/InsertRequest.java rename to v2/src/main/java/com/skyflow/vault/data/InsertRequest.java index 54093467..9758e98f 100644 --- a/src/main/java/com/skyflow/vault/data/InsertRequest.java +++ b/v2/src/main/java/com/skyflow/vault/data/InsertRequest.java @@ -5,10 +5,11 @@ import java.util.ArrayList; import java.util.HashMap; -public class InsertRequest { +public class InsertRequest extends BaseInsertRequest { private final InsertRequestBuilder builder; private InsertRequest(InsertRequestBuilder builder) { + super(builder); this.builder = builder; } @@ -16,26 +17,6 @@ public static InsertRequestBuilder builder() { return new InsertRequestBuilder(); } - public String getTable() { - return this.builder.table; - } - - public ArrayList> getValues() { - return this.builder.values; - } - - public ArrayList> getTokens() { - return this.builder.tokens; - } - - public Boolean getReturnTokens() { - return this.builder.returnTokens; - } - - public String getUpsert() { - return this.builder.upsert; - } - public Boolean getHomogeneous() { return this.builder.homogeneous; } @@ -47,35 +28,46 @@ public Boolean getContinueOnError() { public TokenMode getTokenMode() { return this.builder.tokenMode; } + public String getUpsert() { + return this.builder.upsert; + } + public Boolean getReturnTokens() { + return this.builder.returnTokens; + } + + public ArrayList> getTokens() { + return this.builder.tokens; + } - public static final class InsertRequestBuilder { - private String table; - private ArrayList> values; - private ArrayList> tokens; - private Boolean returnTokens; - private String upsert; + public static final class InsertRequestBuilder extends BaseInsertRequestBuilder { private Boolean homogeneous; private Boolean continueOnError; private TokenMode tokenMode; + private ArrayList> tokens; + private Boolean returnTokens; + private InsertRequestBuilder() { - this.returnTokens = false; + super(); this.continueOnError = false; this.tokenMode = TokenMode.DISABLE; + this.returnTokens = false; } + @Override public InsertRequestBuilder table(String table) { - this.table = table; + super.table(table); return this; } + @Override public InsertRequestBuilder values(ArrayList> values) { - this.values = values; + super.values(values); return this; } public InsertRequestBuilder tokens(ArrayList> tokens) { - this.tokens = tokens; + this.tokens = tokens ; return this; } diff --git a/src/main/java/com/skyflow/vault/data/InsertResponse.java b/v2/src/main/java/com/skyflow/vault/data/InsertResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/InsertResponse.java rename to v2/src/main/java/com/skyflow/vault/data/InsertResponse.java diff --git a/src/main/java/com/skyflow/vault/data/QueryRequest.java b/v2/src/main/java/com/skyflow/vault/data/QueryRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/QueryRequest.java rename to v2/src/main/java/com/skyflow/vault/data/QueryRequest.java diff --git a/src/main/java/com/skyflow/vault/data/QueryResponse.java b/v2/src/main/java/com/skyflow/vault/data/QueryResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/QueryResponse.java rename to v2/src/main/java/com/skyflow/vault/data/QueryResponse.java diff --git a/src/main/java/com/skyflow/vault/data/UpdateRequest.java b/v2/src/main/java/com/skyflow/vault/data/UpdateRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/data/UpdateRequest.java rename to v2/src/main/java/com/skyflow/vault/data/UpdateRequest.java diff --git a/src/main/java/com/skyflow/vault/data/UpdateResponse.java b/v2/src/main/java/com/skyflow/vault/data/UpdateResponse.java similarity index 97% rename from src/main/java/com/skyflow/vault/data/UpdateResponse.java rename to v2/src/main/java/com/skyflow/vault/data/UpdateResponse.java index 068b29be..b1013cb9 100644 --- a/src/main/java/com/skyflow/vault/data/UpdateResponse.java +++ b/v2/src/main/java/com/skyflow/vault/data/UpdateResponse.java @@ -1,7 +1,6 @@ package com.skyflow.vault.data; import com.google.gson.Gson; -import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/src/main/java/com/skyflow/vault/detect/AudioBleep.java b/v2/src/main/java/com/skyflow/vault/detect/AudioBleep.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/AudioBleep.java rename to v2/src/main/java/com/skyflow/vault/detect/AudioBleep.java diff --git a/src/main/java/com/skyflow/vault/detect/DateTransformation.java b/v2/src/main/java/com/skyflow/vault/detect/DateTransformation.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/DateTransformation.java rename to v2/src/main/java/com/skyflow/vault/detect/DateTransformation.java diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java b/v2/src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java rename to v2/src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java b/v2/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java similarity index 99% rename from src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java rename to v2/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java index 95effea0..5471599c 100644 --- a/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java +++ b/v2/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java @@ -3,7 +3,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import java.io.File; import java.util.List; public class DeidentifyFileResponse { diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java b/v2/src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java rename to v2/src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java b/v2/src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java rename to v2/src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java diff --git a/src/main/java/com/skyflow/vault/detect/EntityInfo.java b/v2/src/main/java/com/skyflow/vault/detect/EntityInfo.java similarity index 91% rename from src/main/java/com/skyflow/vault/detect/EntityInfo.java rename to v2/src/main/java/com/skyflow/vault/detect/EntityInfo.java index 4a84acf9..becb5c5e 100644 --- a/src/main/java/com/skyflow/vault/detect/EntityInfo.java +++ b/v2/src/main/java/com/skyflow/vault/detect/EntityInfo.java @@ -11,7 +11,7 @@ public class EntityInfo { private final String entity; private final Map scores; - public EntityInfo(String token, String value, TextIndex textIndex, TextIndex processedIndex, String entity, java.util.Map scores) { + public EntityInfo(String token, String value, TextIndex textIndex, TextIndex processedIndex, String entity, Map scores) { this.token = token; this.value = value; this.textIndex = textIndex; diff --git a/src/main/java/com/skyflow/vault/detect/FileEntityInfo.java b/v2/src/main/java/com/skyflow/vault/detect/FileEntityInfo.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/FileEntityInfo.java rename to v2/src/main/java/com/skyflow/vault/detect/FileEntityInfo.java diff --git a/src/main/java/com/skyflow/vault/detect/FileInfo.java b/v2/src/main/java/com/skyflow/vault/detect/FileInfo.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/FileInfo.java rename to v2/src/main/java/com/skyflow/vault/detect/FileInfo.java diff --git a/src/main/java/com/skyflow/vault/detect/FileInput.java b/v2/src/main/java/com/skyflow/vault/detect/FileInput.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/FileInput.java rename to v2/src/main/java/com/skyflow/vault/detect/FileInput.java diff --git a/src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java b/v2/src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java rename to v2/src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java diff --git a/src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java b/v2/src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java rename to v2/src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java diff --git a/src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java b/v2/src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java rename to v2/src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java diff --git a/src/main/java/com/skyflow/vault/detect/TextIndex.java b/v2/src/main/java/com/skyflow/vault/detect/TextIndex.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/TextIndex.java rename to v2/src/main/java/com/skyflow/vault/detect/TextIndex.java diff --git a/src/main/java/com/skyflow/vault/detect/TokenFormat.java b/v2/src/main/java/com/skyflow/vault/detect/TokenFormat.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/TokenFormat.java rename to v2/src/main/java/com/skyflow/vault/detect/TokenFormat.java diff --git a/src/main/java/com/skyflow/vault/detect/Transformations.java b/v2/src/main/java/com/skyflow/vault/detect/Transformations.java similarity index 100% rename from src/main/java/com/skyflow/vault/detect/Transformations.java rename to v2/src/main/java/com/skyflow/vault/detect/Transformations.java diff --git a/src/main/java/com/skyflow/vault/tokens/ColumnValue.java b/v2/src/main/java/com/skyflow/vault/tokens/ColumnValue.java similarity index 100% rename from src/main/java/com/skyflow/vault/tokens/ColumnValue.java rename to v2/src/main/java/com/skyflow/vault/tokens/ColumnValue.java diff --git a/src/main/java/com/skyflow/vault/tokens/DetokenizeData.java b/v2/src/main/java/com/skyflow/vault/tokens/DetokenizeData.java similarity index 100% rename from src/main/java/com/skyflow/vault/tokens/DetokenizeData.java rename to v2/src/main/java/com/skyflow/vault/tokens/DetokenizeData.java diff --git a/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java b/v2/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java rename to v2/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java diff --git a/src/main/java/com/skyflow/vault/tokens/DetokenizeRequest.java b/v2/src/main/java/com/skyflow/vault/tokens/DetokenizeRequest.java similarity index 100% rename from src/main/java/com/skyflow/vault/tokens/DetokenizeRequest.java rename to v2/src/main/java/com/skyflow/vault/tokens/DetokenizeRequest.java diff --git a/src/main/java/com/skyflow/vault/tokens/DetokenizeResponse.java b/v2/src/main/java/com/skyflow/vault/tokens/DetokenizeResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/tokens/DetokenizeResponse.java rename to v2/src/main/java/com/skyflow/vault/tokens/DetokenizeResponse.java diff --git a/src/main/java/com/skyflow/vault/tokens/TokenizeRequest.java b/v2/src/main/java/com/skyflow/vault/tokens/TokenizeRequest.java similarity index 91% rename from src/main/java/com/skyflow/vault/tokens/TokenizeRequest.java rename to v2/src/main/java/com/skyflow/vault/tokens/TokenizeRequest.java index a1a5ca33..8f6da5d9 100644 --- a/src/main/java/com/skyflow/vault/tokens/TokenizeRequest.java +++ b/v2/src/main/java/com/skyflow/vault/tokens/TokenizeRequest.java @@ -5,7 +5,7 @@ public class TokenizeRequest { private final TokenizeRequestBuilder builder; - private TokenizeRequest(TokenizeRequest.TokenizeRequestBuilder builder) { + private TokenizeRequest(TokenizeRequestBuilder builder) { this.builder = builder; } diff --git a/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java b/v2/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java similarity index 100% rename from src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java rename to v2/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java diff --git a/src/test/java/com/skyflow/ConnectionClientTests.java b/v2/test/java/com/skyflow/ConnectionClientTests.java similarity index 96% rename from src/test/java/com/skyflow/ConnectionClientTests.java rename to v2/test/java/com/skyflow/ConnectionClientTests.java index 4a69120c..77fdd6df 100644 --- a/src/test/java/com/skyflow/ConnectionClientTests.java +++ b/v2/test/java/com/skyflow/ConnectionClientTests.java @@ -2,6 +2,8 @@ import com.skyflow.config.ConnectionConfig; import com.skyflow.config.Credentials; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import io.github.cdimascio.dotenv.Dotenv; import org.junit.Assert; import org.junit.BeforeClass; @@ -29,6 +31,7 @@ public static void setup() { connectionConfig.setConnectionId(connectionID); connectionConfig.setConnectionUrl(connectionURL); connectionClient = new ConnectionClient(connectionConfig, credentials); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/SkyflowTests.java b/v2/test/java/com/skyflow/SkyflowTests.java similarity index 99% rename from src/test/java/com/skyflow/SkyflowTests.java rename to v2/test/java/com/skyflow/SkyflowTests.java index 0b44c0b4..1db54a46 100644 --- a/src/test/java/com/skyflow/SkyflowTests.java +++ b/v2/test/java/com/skyflow/SkyflowTests.java @@ -8,9 +8,12 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runners.Suite; public class SkyflowTests { private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; @@ -32,6 +35,7 @@ public static void setup() { connectionURL = "https://test.connection.url"; newConnectionURL = "https://new.test.connection.url"; token = "test_token"; + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/VaultClientTests.java b/v2/test/java/com/skyflow/VaultClientTests.java similarity index 99% rename from src/test/java/com/skyflow/VaultClientTests.java rename to v2/test/java/com/skyflow/VaultClientTests.java index 1ebb1b23..f03c7ca3 100644 --- a/src/test/java/com/skyflow/VaultClientTests.java +++ b/v2/test/java/com/skyflow/VaultClientTests.java @@ -22,6 +22,8 @@ import com.skyflow.generated.rest.types.DetectedEntity; import com.skyflow.generated.rest.types.EntityLocation; import com.skyflow.generated.rest.types.V1Byot; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.vault.data.InsertRequest; import com.skyflow.vault.data.UpdateRequest; import com.skyflow.vault.detect.*; @@ -81,6 +83,7 @@ public static void setup() throws SkyflowException { vaultConfig.setCredentials(credentials); vaultClient = new VaultClient(vaultConfig, credentials); vaultClient.setBearerToken(); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test @@ -345,6 +348,7 @@ public void testSetBearerTokenWithEnvCredentials() { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); Assert.assertNull(vaultClient.getVaultConfig().getCredentials()); } catch (Exception e) { + e.printStackTrace(); Assert.fail(INVALID_EXCEPTION_THROWN); } } diff --git a/src/test/java/com/skyflow/config/ConnectionConfigTests.java b/v2/test/java/com/skyflow/config/ConnectionConfigTests.java similarity index 97% rename from src/test/java/com/skyflow/config/ConnectionConfigTests.java rename to v2/test/java/com/skyflow/config/ConnectionConfigTests.java index 00c16af6..8983642e 100644 --- a/src/test/java/com/skyflow/config/ConnectionConfigTests.java +++ b/v2/test/java/com/skyflow/config/ConnectionConfigTests.java @@ -3,6 +3,8 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.validations.Validations; import org.junit.Assert; import org.junit.BeforeClass; @@ -24,6 +26,7 @@ public static void setup() { credentials = new Credentials(); credentials.setToken("valid-token"); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/utils/HttpUtilityTests.java b/v2/test/java/com/skyflow/utils/HttpUtilityTests.java similarity index 100% rename from src/test/java/com/skyflow/utils/HttpUtilityTests.java rename to v2/test/java/com/skyflow/utils/HttpUtilityTests.java diff --git a/src/test/java/com/skyflow/utils/UtilsTests.java b/v2/test/java/com/skyflow/utils/UtilsTests.java similarity index 81% rename from src/test/java/com/skyflow/utils/UtilsTests.java rename to v2/test/java/com/skyflow/utils/UtilsTests.java index 83e5a6ff..00543567 100644 --- a/src/test/java/com/skyflow/utils/UtilsTests.java +++ b/v2/test/java/com/skyflow/utils/UtilsTests.java @@ -49,47 +49,22 @@ public static void setup() { pathParams = new HashMap<>(); queryParams = new HashMap<>(); requestHeaders = new HashMap<>(); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test - public void testGetVaultURLForDev() { + public void testGetVaultURLForDifferentENVs() { try { - String vaultURL = Utils.getVaultURL(clusterId, Env.DEV); - String devUrl = "https://test_cluster_id.vault.skyflowapis.dev"; - Assert.assertEquals(devUrl, vaultURL); - } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); - } - } - - @Test - public void testGetVaultURLForStage() { - try { - String vaultURL = Utils.getVaultURL(clusterId, Env.STAGE); - String stageUrl = "https://test_cluster_id.vault.skyflowapis.tech"; - Assert.assertEquals(stageUrl, vaultURL); - } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); - } - } - - @Test - public void testGetVaultURLForSandbox() { - try { - String vaultURL = Utils.getVaultURL(clusterId, Env.SANDBOX); - String sandboxUrl = "https://test_cluster_id.vault.skyflowapis-preview.com"; - Assert.assertEquals(sandboxUrl, vaultURL); - } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); - } - } - - @Test - public void testGetVaultURLForProd() { - try { - String vaultURL = Utils.getVaultURL(clusterId, Env.PROD); - String prodUrl = "https://test_cluster_id.vault.skyflowapis.com"; - Assert.assertEquals(prodUrl, vaultURL); + Map map = new HashMap<>(); + map.put(Env.DEV, "https://test_cluster_id.vault.skyflowapis.dev"); + map.put(Env.STAGE, "https://test_cluster_id.vault.skyflowapis.tech"); + map.put(Env.SANDBOX, "https://test_cluster_id.vault.skyflowapis-preview.com"); + map.put(Env.PROD, "https://test_cluster_id.vault.skyflowapis.com"); + + for (Env env : map.keySet()) { + String vaultURL = Utils.getVaultURL(clusterId, env); + Assert.assertEquals(map.get(env), vaultURL); + } } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -147,9 +122,10 @@ public void testGenerateBearerTokenWithToken() { credentials.setContext(context); credentials.setRoles(roles); String bearerToken = Utils.generateBearerToken(credentials); - Assert.assertEquals(token, bearerToken); + Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { - Assert.fail(INVALID_EXCEPTION_THROWN); + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.BearerTokenExpired.getMessage(), e.getMessage()); } } @@ -207,8 +183,9 @@ public void testGetMetricsWithException() { System.clearProperty("os.version"); System.clearProperty("java.version"); + String sdkVersion = Constants.SDK_VERSION; JsonObject metrics = Utils.getMetrics(); - Assert.assertEquals("skyflow-java@v2", metrics.get(Constants.SDK_METRIC_NAME_VERSION).getAsString()); + Assert.assertEquals("skyflow-java@" + sdkVersion, metrics.get(Constants.SDK_METRIC_NAME_VERSION).getAsString()); Assert.assertEquals("Java@", metrics.get(Constants.SDK_METRIC_RUNTIME_DETAILS).getAsString()); Assert.assertTrue(metrics.get(Constants.SDK_METRIC_CLIENT_DEVICE_MODEL).getAsString().isEmpty()); Assert.assertTrue(metrics.get(Constants.SDK_METRIC_CLIENT_OS_DETAILS).getAsString().isEmpty()); diff --git a/src/test/java/com/skyflow/vault/connection/InvokeConnectionTests.java b/v2/test/java/com/skyflow/vault/connection/InvokeConnectionTests.java similarity index 99% rename from src/test/java/com/skyflow/vault/connection/InvokeConnectionTests.java rename to v2/test/java/com/skyflow/vault/connection/InvokeConnectionTests.java index a29a3335..35b53dca 100644 --- a/src/test/java/com/skyflow/vault/connection/InvokeConnectionTests.java +++ b/v2/test/java/com/skyflow/vault/connection/InvokeConnectionTests.java @@ -5,6 +5,8 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.validations.Validations; import org.junit.Assert; import org.junit.Before; @@ -28,6 +30,7 @@ public static void setup() { pathParams = new HashMap<>(); requestHeaders = new HashMap<>(); requestBody = new HashMap<>(); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Before diff --git a/src/test/java/com/skyflow/vault/controller/ConnectionControllerTests.java b/v2/test/java/com/skyflow/vault/controller/ConnectionControllerTests.java similarity index 94% rename from src/test/java/com/skyflow/vault/controller/ConnectionControllerTests.java rename to v2/test/java/com/skyflow/vault/controller/ConnectionControllerTests.java index b121280a..9e498173 100644 --- a/src/test/java/com/skyflow/vault/controller/ConnectionControllerTests.java +++ b/v2/test/java/com/skyflow/vault/controller/ConnectionControllerTests.java @@ -7,6 +7,8 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.vault.connection.InvokeConnectionRequest; import org.junit.Assert; import org.junit.BeforeClass; @@ -34,6 +36,7 @@ public static void setup() { connectionConfig.setConnectionId(connectionID); connectionConfig.setConnectionUrl(connectionURL); connectionConfig.setCredentials(credentials); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java b/v2/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java similarity index 99% rename from src/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java rename to v2/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java index da8494e1..b8193545 100644 --- a/src/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java +++ b/v2/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java @@ -5,6 +5,8 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.vault.detect.AudioBleep; import com.skyflow.vault.detect.DeidentifyFileRequest; import com.skyflow.vault.detect.FileInput; @@ -39,6 +41,7 @@ public static void setup() { vaultConfig.setCredentials(credentials); detectController = new DetectController(vaultConfig, credentials); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/vault/controller/DetectControllerTests.java b/v2/test/java/com/skyflow/vault/controller/DetectControllerTests.java similarity index 98% rename from src/test/java/com/skyflow/vault/controller/DetectControllerTests.java rename to v2/test/java/com/skyflow/vault/controller/DetectControllerTests.java index aae713b1..e685b0df 100644 --- a/src/test/java/com/skyflow/vault/controller/DetectControllerTests.java +++ b/v2/test/java/com/skyflow/vault/controller/DetectControllerTests.java @@ -9,6 +9,7 @@ import com.skyflow.errors.HttpStatus; import com.skyflow.errors.SkyflowException; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.vault.detect.DeidentifyTextRequest; import com.skyflow.vault.detect.ReidentifyTextRequest; @@ -42,6 +43,7 @@ public static void setup() throws SkyflowException, NoSuchMethodException { .setLogLevel(LogLevel.DEBUG) .addVaultConfig(vaultConfig) .build(); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } diff --git a/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java b/v2/test/java/com/skyflow/vault/controller/VaultControllerTests.java similarity index 98% rename from src/test/java/com/skyflow/vault/controller/VaultControllerTests.java rename to v2/test/java/com/skyflow/vault/controller/VaultControllerTests.java index 5f3ae771..cd32b4a0 100644 --- a/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java +++ b/v2/test/java/com/skyflow/vault/controller/VaultControllerTests.java @@ -11,6 +11,7 @@ import com.skyflow.errors.SkyflowException; import com.skyflow.generated.rest.ApiClient; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.vault.data.*; import com.skyflow.vault.tokens.DetokenizeRequest; @@ -47,7 +48,7 @@ public static void setup() throws SkyflowException, NoSuchMethodException { .setLogLevel(LogLevel.DEBUG) .addVaultConfig(vaultConfig) .build(); - + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/vault/data/DeleteTests.java b/v2/test/java/com/skyflow/vault/data/DeleteTests.java similarity index 98% rename from src/test/java/com/skyflow/vault/data/DeleteTests.java rename to v2/test/java/com/skyflow/vault/data/DeleteTests.java index befc3d26..f54a46b7 100644 --- a/src/test/java/com/skyflow/vault/data/DeleteTests.java +++ b/v2/test/java/com/skyflow/vault/data/DeleteTests.java @@ -8,6 +8,7 @@ import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.utils.validations.Validations; import org.junit.Assert; @@ -42,6 +43,7 @@ public static void setup() { skyflowID = "test_delete_id_1"; ids = new ArrayList<>(); table = "test_table"; + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Before diff --git a/src/test/java/com/skyflow/vault/data/GetTests.java b/v2/test/java/com/skyflow/vault/data/GetTests.java similarity index 99% rename from src/test/java/com/skyflow/vault/data/GetTests.java rename to v2/test/java/com/skyflow/vault/data/GetTests.java index 43b3f132..b1d6da2e 100644 --- a/src/test/java/com/skyflow/vault/data/GetTests.java +++ b/v2/test/java/com/skyflow/vault/data/GetTests.java @@ -9,6 +9,7 @@ import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.utils.validations.Validations; import org.junit.Assert; @@ -57,6 +58,7 @@ public static void setup() { columnValue = "test_column_value"; columnValues = new ArrayList<>(); table = "test_table"; + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Before diff --git a/src/test/java/com/skyflow/vault/data/InsertTests.java b/v2/test/java/com/skyflow/vault/data/InsertTests.java similarity index 99% rename from src/test/java/com/skyflow/vault/data/InsertTests.java rename to v2/test/java/com/skyflow/vault/data/InsertTests.java index 00399f00..6721d3c7 100644 --- a/src/test/java/com/skyflow/vault/data/InsertTests.java +++ b/v2/test/java/com/skyflow/vault/data/InsertTests.java @@ -9,6 +9,7 @@ import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.utils.validations.Validations; import org.junit.Assert; @@ -54,6 +55,7 @@ public static void setup() { valueMap = new HashMap<>(); tokenMap = new HashMap<>(); upsert = "upsert_column"; + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Before diff --git a/src/test/java/com/skyflow/vault/data/QueryTests.java b/v2/test/java/com/skyflow/vault/data/QueryTests.java similarity index 97% rename from src/test/java/com/skyflow/vault/data/QueryTests.java rename to v2/test/java/com/skyflow/vault/data/QueryTests.java index c8e453f5..ac290b6f 100644 --- a/src/test/java/com/skyflow/vault/data/QueryTests.java +++ b/v2/test/java/com/skyflow/vault/data/QueryTests.java @@ -8,6 +8,7 @@ import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.utils.validations.Validations; import org.junit.Assert; @@ -44,6 +45,7 @@ public static void setup() { queryRecord = new HashMap<>(); queryRecord.put("name", "test_name"); queryRecord.put("card_number", "test_card_number"); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Test diff --git a/src/test/java/com/skyflow/vault/data/UpdateTests.java b/v2/test/java/com/skyflow/vault/data/UpdateTests.java similarity index 99% rename from src/test/java/com/skyflow/vault/data/UpdateTests.java rename to v2/test/java/com/skyflow/vault/data/UpdateTests.java index be702d4e..d2ee6369 100644 --- a/src/test/java/com/skyflow/vault/data/UpdateTests.java +++ b/v2/test/java/com/skyflow/vault/data/UpdateTests.java @@ -9,6 +9,7 @@ import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; import com.skyflow.utils.Utils; import com.skyflow.utils.validations.Validations; import org.junit.Assert; @@ -47,6 +48,7 @@ public static void setup() { table = "test_table"; dataMap = new HashMap<>(); tokenMap = new HashMap<>(); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); } @Before diff --git a/src/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java b/v2/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java similarity index 100% rename from src/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java rename to v2/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java diff --git a/src/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java b/v2/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java similarity index 100% rename from src/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java rename to v2/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java diff --git a/src/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java b/v2/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java similarity index 100% rename from src/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java rename to v2/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java diff --git a/src/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java b/v2/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java similarity index 100% rename from src/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java rename to v2/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java diff --git a/src/test/java/com/skyflow/vault/detect/FileInfoTest.java b/v2/test/java/com/skyflow/vault/detect/FileInfoTest.java similarity index 100% rename from src/test/java/com/skyflow/vault/detect/FileInfoTest.java rename to v2/test/java/com/skyflow/vault/detect/FileInfoTest.java diff --git a/src/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java b/v2/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java similarity index 100% rename from src/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java rename to v2/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java diff --git a/src/test/java/com/skyflow/vault/tokens/DetokenizeTests.java b/v2/test/java/com/skyflow/vault/tokens/DetokenizeTests.java similarity index 100% rename from src/test/java/com/skyflow/vault/tokens/DetokenizeTests.java rename to v2/test/java/com/skyflow/vault/tokens/DetokenizeTests.java diff --git a/src/test/java/com/skyflow/vault/tokens/TokenizeTests.java b/v2/test/java/com/skyflow/vault/tokens/TokenizeTests.java similarity index 100% rename from src/test/java/com/skyflow/vault/tokens/TokenizeTests.java rename to v2/test/java/com/skyflow/vault/tokens/TokenizeTests.java diff --git a/v2/v2.iml b/v2/v2.iml new file mode 100644 index 00000000..b06a6787 --- /dev/null +++ b/v2/v2.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/v3/pom.xml b/v3/pom.xml new file mode 100644 index 00000000..996a751c --- /dev/null +++ b/v3/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + com.skyflow + skyflow + 1.0.0 + ../pom.xml + + + skyflow-java + 2.0.0-beta.3-dev.cd2386d + jar + + + 8 + 8 + UTF-8 + false + + + + + + + com.skyflow + common + 1.0.0 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + + + com.skyflow:common + + + + + + + + + + diff --git a/v3/src/main/java/com/skyflow/Skyflow.java b/v3/src/main/java/com/skyflow/Skyflow.java new file mode 100644 index 00000000..7973c747 --- /dev/null +++ b/v3/src/main/java/com/skyflow/Skyflow.java @@ -0,0 +1,106 @@ +package com.skyflow; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.LogLevel; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.logs.ErrorLogs; +import com.skyflow.logs.InfoLogs; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; +import com.skyflow.utils.Utils; +import com.skyflow.utils.logger.LogUtil; +import com.skyflow.utils.validations.Validations; +import com.skyflow.vault.controller.VaultController; + +import java.util.LinkedHashMap; + +public final class Skyflow extends BaseSkyflow { + private final SkyflowClientBuilder builder; + + private Skyflow(SkyflowClientBuilder builder) { + super(builder); + this.builder = builder; + com.skyflow.utils.logger.LogUtil.printInfoLog(InfoLogs.CLIENT_INITIALIZED.getLog()); + } + + public static SkyflowClientBuilder builder() { + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); + return new SkyflowClientBuilder(); + } + + public VaultController vault() throws SkyflowException { + Object[] array = this.builder.vaultClientsMap.keySet().toArray(); + if (array.length < 1) { + LogUtil.printErrorLog(ErrorLogs.VAULT_CONFIG_DOES_NOT_EXIST.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.VaultIdNotInConfigList.getMessage()); + } + String vaultId = (String) array[0]; + VaultController controller = this.builder.vaultClientsMap.get(vaultId); + if (controller == null) { + LogUtil.printErrorLog(ErrorLogs.VAULT_CONFIG_DOES_NOT_EXIST.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.VaultIdNotInConfigList.getMessage()); + } + + return controller; + } + + public static final class SkyflowClientBuilder extends BaseSkyflowClientBuilder { + private final LinkedHashMap vaultClientsMap; + + public SkyflowClientBuilder() { + this.vaultClientsMap = new LinkedHashMap<>(); + } + + public SkyflowClientBuilder addVaultConfig(VaultConfig vaultConfig) throws SkyflowException { + LogUtil.printInfoLog(InfoLogs.VALIDATING_VAULT_CONFIG.getLog()); + Validations.validateVaultConfig(vaultConfig); + VaultConfig vaultConfigCopy; + try { + vaultConfigCopy = (VaultConfig) vaultConfig.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + if (!this.vaultClientsMap.isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.VAULT_CONFIG_EXISTS.getLog(), vaultConfigCopy.getVaultId() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), + ErrorMessage.VaultIdAlreadyInConfigList.getMessage()); + } else { + this.vaultConfigMap.put(vaultConfigCopy.getVaultId(), vaultConfigCopy); // add new config in map + this.vaultClientsMap.put(vaultConfigCopy.getVaultId(), new VaultController(vaultConfigCopy, this.skyflowCredentials)); // add new controller with new config + LogUtil.printInfoLog(Utils.parameterizedString( + InfoLogs.VAULT_CONTROLLER_INITIALIZED.getLog(), vaultConfigCopy.getVaultId())); + } + return this; + } + + public SkyflowClientBuilder addSkyflowCredentials(Credentials credentials) throws SkyflowException { + Validations.validateCredentials(credentials); + Credentials credentialsCopy; + try { + credentialsCopy = (Credentials) credentials.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + this.skyflowCredentials = credentialsCopy; + for (VaultController vault : this.vaultClientsMap.values()) { + vault.setCommonCredentials(this.skyflowCredentials); + } + return this; + } + + @Override + public SkyflowClientBuilder setLogLevel(LogLevel logLevel) { + super.setLogLevel(logLevel); + return this; + } + + public Skyflow build() { + return new Skyflow(this); + } + } +} diff --git a/v3/src/main/java/com/skyflow/VaultClient.java b/v3/src/main/java/com/skyflow/VaultClient.java new file mode 100644 index 00000000..b43ccd60 --- /dev/null +++ b/v3/src/main/java/com/skyflow/VaultClient.java @@ -0,0 +1,180 @@ +package com.skyflow; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.UpdateType; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.generated.rest.ApiClient; +import com.skyflow.generated.rest.ApiClientBuilder; +import com.skyflow.generated.rest.resources.recordservice.RecordserviceClient; +import com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest; +import com.skyflow.generated.rest.types.EnumUpdateType; +import com.skyflow.generated.rest.types.InsertRecordData; +import com.skyflow.generated.rest.types.Upsert; +import com.skyflow.logs.InfoLogs; +import com.skyflow.serviceaccount.util.Token; +import com.skyflow.utils.Constants; +import com.skyflow.utils.Utils; +import com.skyflow.utils.logger.LogUtil; +import com.skyflow.utils.validations.Validations; +import com.skyflow.vault.data.DetokenizeRequest; +import io.github.cdimascio.dotenv.Dotenv; +import io.github.cdimascio.dotenv.DotenvException; +import okhttp3.OkHttpClient; +import okhttp3.Request; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + + +public class VaultClient { + private final VaultConfig vaultConfig; + private final ApiClientBuilder apiClientBuilder; + private ApiClient apiClient; + private Credentials commonCredentials; + private Credentials finalCredentials; + private String token; + private String apiKey; + + protected VaultClient(VaultConfig vaultConfig, Credentials credentials) { + super(); + this.vaultConfig = vaultConfig; + this.commonCredentials = credentials; + this.apiClientBuilder = new ApiClientBuilder(); + this.apiClient = null; + updateVaultURL(); + } + + protected RecordserviceClient getRecordsApi() { + return this.apiClient.recordservice(); + } + + protected VaultConfig getVaultConfig() { + return vaultConfig; + } + + protected void setCommonCredentials(Credentials commonCredentials) throws SkyflowException { + this.commonCredentials = commonCredentials; + prioritiseCredentials(); + } + + protected void setBearerToken() throws SkyflowException { + prioritiseCredentials(); + Validations.validateCredentials(this.finalCredentials); + if (this.finalCredentials.getApiKey() != null) { + LogUtil.printInfoLog(InfoLogs.USE_API_KEY.getLog()); + token = this.finalCredentials.getApiKey(); + } else if (token == null || token.trim().isEmpty()) { + token = Utils.generateBearerToken(this.finalCredentials); + } else if (Token.isExpired(token)) { + LogUtil.printInfoLog(InfoLogs.BEARER_TOKEN_EXPIRED.getLog()); + token = Utils.generateBearerToken(this.finalCredentials); + } else { + LogUtil.printInfoLog(InfoLogs.REUSE_BEARER_TOKEN.getLog()); + } + updateExecutorInHTTP(); // update executor + this.apiClient = this.apiClientBuilder.build(); + } + + private void updateVaultURL() { + String vaultURL = Utils.getVaultURL(this.vaultConfig.getClusterId(), this.vaultConfig.getEnv()); + this.apiClientBuilder.url(vaultURL); + } + + private void prioritiseCredentials() throws SkyflowException { + try { + Credentials original = this.finalCredentials; + if (this.vaultConfig.getCredentials() != null) { + this.finalCredentials = this.vaultConfig.getCredentials(); + } else if (this.commonCredentials != null) { + this.finalCredentials = this.commonCredentials; + } else { + Dotenv dotenv = Dotenv.load(); + String sysCredentials = dotenv.get(Constants.ENV_CREDENTIALS_KEY_NAME); + if (sysCredentials == null) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), + ErrorMessage.EmptyCredentials.getMessage()); + } else { + this.finalCredentials = new Credentials(); + this.finalCredentials.setCredentialsString(sysCredentials); + } + } + if (original != null && !original.equals(this.finalCredentials)) { + token = null; + apiKey = null; + } + } catch (DotenvException e) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), + ErrorMessage.EmptyCredentials.getMessage()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + protected void updateExecutorInHTTP() { + OkHttpClient httpClient = new OkHttpClient.Builder() + .addInterceptor(chain -> { + Request original = chain.request(); + Request requestWithAuth = original.newBuilder() + .header("Authorization", "Bearer " + this.token) + .build(); + return chain.proceed(requestWithAuth); + }) + .build(); + apiClientBuilder.httpClient(httpClient); + } + protected InsertRequest getBulkInsertRequestBody(com.skyflow.vault.data.InsertRequest request, VaultConfig config) throws SkyflowException { + List> values = request.getValues(); + List insertRecordDataList = new ArrayList<>(); + for (HashMap value : values) { + InsertRecordData data = InsertRecordData.builder().data(value).build(); + insertRecordDataList.add(data); + } + InsertRequest.Builder builder = InsertRequest.builder() + .vaultId(config.getVaultId()) + .records(insertRecordDataList) + .tableName(request.getTable()); + if(request.getUpsert() != null && !request.getUpsert().isEmpty()){ + if (request.getUpsertType() != null) { + EnumUpdateType updateType = null; + if(request.getUpsertType() == UpdateType.REPLACE){ + updateType = EnumUpdateType.REPLACE; + } else if (request.getUpsertType() == UpdateType.REPLACE) { + updateType = EnumUpdateType.UPDATE; + } + Upsert upsert = Upsert.builder().uniqueColumns(request.getUpsert()).updateType(updateType).build(); + builder.upsert(upsert); + } else { + Upsert upsert = Upsert.builder().uniqueColumns(request.getUpsert()).build(); + builder.upsert(upsert); + } + } + return builder.build(); + + } + + protected com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest getDetokenizeRequestBody(DetokenizeRequest request) { + List tokens = request.getTokens(); + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest.Builder builder = + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest.builder() + .vaultId(this.vaultConfig.getVaultId()) + .tokens(tokens); + if (request.getTokenGroupRedactions() != null){ + List tokenGroupRedactionsList = new ArrayList<>(); + for (com.skyflow.vault.data.TokenGroupRedactions tokenGroupRedactions : request.getTokenGroupRedactions()) { + com.skyflow.generated.rest.types.TokenGroupRedactions redactions = + com.skyflow.generated.rest.types.TokenGroupRedactions.builder() + .tokenGroupName(tokenGroupRedactions.getTokenGroupName()) + .redaction(tokenGroupRedactions.getRedaction()) + .build(); + tokenGroupRedactionsList.add(redactions); + } + + builder.tokenGroupRedactions(tokenGroupRedactionsList); + } + return builder.build(); + } +} diff --git a/v3/src/main/java/com/skyflow/enums/UpdateType.java b/v3/src/main/java/com/skyflow/enums/UpdateType.java new file mode 100644 index 00000000..7fcb6f65 --- /dev/null +++ b/v3/src/main/java/com/skyflow/enums/UpdateType.java @@ -0,0 +1,20 @@ +package com.skyflow.enums; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateType { + UPDATE("UPDATE"), + + REPLACE("REPLACE"); + + private final String value; + + UpdateType(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/ApiClient.java b/v3/src/main/java/com/skyflow/generated/rest/ApiClient.java new file mode 100644 index 00000000..3bf1a6e7 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/ApiClient.java @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.Suppliers; +import com.skyflow.generated.rest.resources.recordservice.RecordserviceClient; + +import java.util.function.Supplier; + +public class ApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier recordserviceClient; + + public ApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.recordserviceClient = Suppliers.memoize(() -> new RecordserviceClient(clientOptions)); + } + + public RecordserviceClient recordservice() { + return this.recordserviceClient.get(); + } + + public static ApiClientBuilder builder() { + return new ApiClientBuilder(); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java b/v3/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java new file mode 100644 index 00000000..fa3d6e9d --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.Environment; +import okhttp3.OkHttpClient; + +public final class ApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private Environment environment; + + public ApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public ApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public ApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public ApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public ApiClient build() { + clientOptionsBuilder.environment(this.environment); + return new ApiClient(clientOptionsBuilder.build()); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java b/v3/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java new file mode 100644 index 00000000..6edb11d9 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.Suppliers; +import com.skyflow.generated.rest.resources.recordservice.AsyncRecordserviceClient; + +import java.util.function.Supplier; + +public class AsyncApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier recordserviceClient; + + public AsyncApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.recordserviceClient = Suppliers.memoize(() -> new AsyncRecordserviceClient(clientOptions)); + } + + public AsyncRecordserviceClient recordservice() { + return this.recordserviceClient.get(); + } + + public static AsyncApiClientBuilder builder() { + return new AsyncApiClientBuilder(); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java b/v3/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java new file mode 100644 index 00000000..10c08d51 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.Environment; +import okhttp3.OkHttpClient; + +public final class AsyncApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private Environment environment; + + public AsyncApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public AsyncApiClient build() { + clientOptionsBuilder.environment(this.environment); + return new AsyncApiClient(clientOptionsBuilder.build()); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java b/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java new file mode 100644 index 00000000..be5247eb --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.Response; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class ApiClientApiException extends ApiClientException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public ApiClientApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public ApiClientApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @Override + public String toString() { + return "ApiClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body + + "}"; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java b/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java new file mode 100644 index 00000000..7987eba6 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class ApiClientException extends RuntimeException { + public ApiClientException(String message) { + super(message); + } + + public ApiClientException(String message, Exception e) { + super(message, e); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java b/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java new file mode 100644 index 00000000..c743352c --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.Response; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public final class ApiClientHttpResponse { + + private final T body; + + private final Map> headers; + + public ApiClientHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java b/v3/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java new file mode 100644 index 00000000..39235d01 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.OkHttpClient; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.skyflow.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.275"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions(environment, headers, headerSuppliers, httpClient, this.timeout.get()); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java b/v3/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java new file mode 100644 index 00000000..a0a6d7c4 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; + +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/Environment.java b/v3/src/main/java/com/skyflow/generated/rest/core/Environment.java new file mode 100644 index 00000000..2fc27c36 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/Environment.java @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +public final class Environment { + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/FileStream.java b/v3/src/main/java/com/skyflow/generated/rest/core/FileStream.java new file mode 100644 index 00000000..2131b0a4 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/FileStream.java @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +import java.io.InputStream; +import java.util.Objects; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java b/v3/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java new file mode 100644 index 00000000..55c3c971 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java @@ -0,0 +1,80 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java b/v3/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java new file mode 100644 index 00000000..11714cb8 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/Nullable.java b/v3/src/main/java/com/skyflow/generated/rest/core/Nullable.java new file mode 100644 index 00000000..5929c12d --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java b/v3/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java new file mode 100644 index 00000000..98c33be4 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + return o instanceof Optional && !((Optional) o).isPresent(); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java b/v3/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java new file mode 100644 index 00000000..acec32b4 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java b/v3/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java new file mode 100644 index 00000000..c0687736 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +import java.util.*; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java b/v3/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java new file mode 100644 index 00000000..b8a8d14b --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private RequestOptions( + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers) { + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions(timeout, timeoutTimeUnit, headers, headerSuppliers); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java b/v3/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java new file mode 100644 index 00000000..1bb0b5dc --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.Response; + +import java.io.FilterInputStream; +import java.io.IOException; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java b/v3/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java new file mode 100644 index 00000000..e6c1a525 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.Response; + +import java.io.FilterReader; +import java.io.IOException; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java b/v3/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java new file mode 100644 index 00000000..7a28c3c9 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import okhttp3.Interceptor; +import okhttp3.Response; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/Stream.java b/v3/src/main/java/com/skyflow/generated/rest/core/Stream.java new file mode 100644 index 00000000..f037712a --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/Stream.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable { + /** + * The {@link Class} of the objects in the stream. + */ + private final Class valueType; + /** + * The {@link Scanner} used for reading from the input stream and blocking when needed during iteration. + */ + private final Scanner scanner; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.valueType = valueType; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + return new Iterator() { + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + /** + * Removing elements from {@code Stream} is not supported. + * + * @throws UnsupportedOperationException Always, as removal is not supported. + */ + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/core/Suppliers.java b/v3/src/main/java/com/skyflow/generated/rest/core/Suppliers.java new file mode 100644 index 00000000..307d5852 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/AsyncRawRecordserviceClient.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/AsyncRawRecordserviceClient.java new file mode 100644 index 00000000..dcc988a3 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/AsyncRawRecordserviceClient.java @@ -0,0 +1,535 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.skyflow.generated.rest.core.*; +import com.skyflow.generated.rest.resources.recordservice.requests.*; +import com.skyflow.generated.rest.types.*; +import okhttp3.*; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.util.concurrent.CompletableFuture; + +public class AsyncRawRecordserviceClient { + protected final ClientOptions clientOptions; + + public AsyncRawRecordserviceClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Executes a query on the specified vault. + */ + public CompletableFuture> executequery() { + return executequery(ExecuteQueryRequest.builder().build()); + } + + /** + * Executes a query on the specified vault. + */ + public CompletableFuture> executequery(ExecuteQueryRequest request) { + return executequery(request, null); + } + + /** + * Executes a query on the specified vault. + */ + public CompletableFuture> executequery( + ExecuteQueryRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/query") + .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(), ExecuteQueryResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> delete() { + return delete(DeleteRequest.builder().build()); + } + + public CompletableFuture> delete(DeleteRequest request) { + return delete(request, null); + } + + public CompletableFuture> delete( + DeleteRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/delete") + .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(), DeleteResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> get() { + return get(GetRequest.builder().build()); + } + + public CompletableFuture> get(GetRequest request) { + return get(request, null); + } + + public CompletableFuture> get( + GetRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/get") + .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(), GetResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> insert() { + return insert(InsertRequest.builder().build()); + } + + public CompletableFuture> insert(InsertRequest request) { + return insert(request, null); + } + + public CompletableFuture> insert( + InsertRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/insert") + .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(), InsertResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> update() { + return update(UpdateRequest.builder().build()); + } + + public CompletableFuture> update(UpdateRequest request) { + return update(request, null); + } + + public CompletableFuture> update( + UpdateRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/update") + .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(), UpdateResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> deletetoken() { + return deletetoken(DeleteTokenRequest.builder().build()); + } + + public CompletableFuture> deletetoken(DeleteTokenRequest request) { + return deletetoken(request, null); + } + + public CompletableFuture> deletetoken( + DeleteTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/tokens/delete") + .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(), DeleteTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> detokenize() { + return detokenize(DetokenizeRequest.builder().build()); + } + + public CompletableFuture> detokenize(DetokenizeRequest request) { + return detokenize(request, null); + } + + public CompletableFuture> detokenize( + DetokenizeRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/tokens/detokenize") + .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(), DetokenizeResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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; + } + + public CompletableFuture> tokenize() { + return tokenize(TokenizeRequest.builder().build()); + } + + public CompletableFuture> tokenize(TokenizeRequest request) { + return tokenize(request, null); + } + + public CompletableFuture> tokenize( + TokenizeRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/tokens/get") + .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(), TokenizeResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/AsyncRecordserviceClient.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/AsyncRecordserviceClient.java new file mode 100644 index 00000000..78746a94 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/AsyncRecordserviceClient.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.recordservice.requests.*; +import com.skyflow.generated.rest.types.*; + +import java.util.concurrent.CompletableFuture; + +public class AsyncRecordserviceClient { + protected final ClientOptions clientOptions; + + private final AsyncRawRecordserviceClient rawClient; + + public AsyncRecordserviceClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawRecordserviceClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawRecordserviceClient withRawResponse() { + return this.rawClient; + } + + /** + * Executes a query on the specified vault. + */ + public CompletableFuture executequery() { + return this.rawClient.executequery().thenApply(response -> response.body()); + } + + /** + * Executes a query on the specified vault. + */ + public CompletableFuture executequery(ExecuteQueryRequest request) { + return this.rawClient.executequery(request).thenApply(response -> response.body()); + } + + /** + * Executes a query on the specified vault. + */ + public CompletableFuture executequery( + ExecuteQueryRequest request, RequestOptions requestOptions) { + return this.rawClient.executequery(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete() { + return this.rawClient.delete().thenApply(response -> response.body()); + } + + public CompletableFuture delete(DeleteRequest request) { + return this.rawClient.delete(request).thenApply(response -> response.body()); + } + + public CompletableFuture delete(DeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture get() { + return this.rawClient.get().thenApply(response -> response.body()); + } + + public CompletableFuture get(GetRequest request) { + return this.rawClient.get(request).thenApply(response -> response.body()); + } + + public CompletableFuture get(GetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture insert() { + return this.rawClient.insert().thenApply(response -> response.body()); + } + + public CompletableFuture insert(InsertRequest request) { + return this.rawClient.insert(request).thenApply(response -> response.body()); + } + + public CompletableFuture insert(InsertRequest request, RequestOptions requestOptions) { + return this.rawClient.insert(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture update() { + return this.rawClient.update().thenApply(response -> response.body()); + } + + public CompletableFuture update(UpdateRequest request) { + return this.rawClient.update(request).thenApply(response -> response.body()); + } + + public CompletableFuture update(UpdateRequest request, RequestOptions requestOptions) { + return this.rawClient.update(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deletetoken() { + return this.rawClient.deletetoken().thenApply(response -> response.body()); + } + + public CompletableFuture deletetoken(DeleteTokenRequest request) { + return this.rawClient.deletetoken(request).thenApply(response -> response.body()); + } + + public CompletableFuture deletetoken( + DeleteTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.deletetoken(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture detokenize() { + return this.rawClient.detokenize().thenApply(response -> response.body()); + } + + public CompletableFuture detokenize(DetokenizeRequest request) { + return this.rawClient.detokenize(request).thenApply(response -> response.body()); + } + + public CompletableFuture detokenize(DetokenizeRequest request, RequestOptions requestOptions) { + return this.rawClient.detokenize(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture tokenize() { + return this.rawClient.tokenize().thenApply(response -> response.body()); + } + + public CompletableFuture tokenize(TokenizeRequest request) { + return this.rawClient.tokenize(request).thenApply(response -> response.body()); + } + + public CompletableFuture tokenize(TokenizeRequest request, RequestOptions requestOptions) { + return this.rawClient.tokenize(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/RawRecordserviceClient.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/RawRecordserviceClient.java new file mode 100644 index 00000000..f4ddaa10 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/RawRecordserviceClient.java @@ -0,0 +1,418 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.skyflow.generated.rest.core.*; +import com.skyflow.generated.rest.resources.recordservice.requests.*; +import com.skyflow.generated.rest.types.*; +import okhttp3.*; + +import java.io.IOException; + +public class RawRecordserviceClient { + protected final ClientOptions clientOptions; + + public RawRecordserviceClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Executes a query on the specified vault. + */ + public ApiClientHttpResponse executequery() { + return executequery(ExecuteQueryRequest.builder().build()); + } + + /** + * Executes a query on the specified vault. + */ + public ApiClientHttpResponse executequery(ExecuteQueryRequest request) { + return executequery(request, null); + } + + /** + * Executes a query on the specified vault. + */ + public ApiClientHttpResponse executequery( + ExecuteQueryRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/query") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ExecuteQueryResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse delete() { + return delete(DeleteRequest.builder().build()); + } + + public ApiClientHttpResponse delete(DeleteRequest request) { + return delete(request, null); + } + + public ApiClientHttpResponse delete(DeleteRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/delete") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse get() { + return get(GetRequest.builder().build()); + } + + public ApiClientHttpResponse get(GetRequest request) { + return get(request, null); + } + + public ApiClientHttpResponse get(GetRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/get") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse insert() { + return insert(InsertRequest.builder().build()); + } + + public ApiClientHttpResponse insert(InsertRequest request) { + return insert(request, null); + } + + public ApiClientHttpResponse insert(InsertRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/insert") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), InsertResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse update() { + return update(UpdateRequest.builder().build()); + } + + public ApiClientHttpResponse update(UpdateRequest request) { + return update(request, null); + } + + public ApiClientHttpResponse update(UpdateRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/records/update") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse deletetoken() { + return deletetoken(DeleteTokenRequest.builder().build()); + } + + public ApiClientHttpResponse deletetoken(DeleteTokenRequest request) { + return deletetoken(request, null); + } + + public ApiClientHttpResponse deletetoken( + DeleteTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/tokens/delete") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse detokenize() { + return detokenize(DetokenizeRequest.builder().build()); + } + + public ApiClientHttpResponse detokenize(DetokenizeRequest request) { + return detokenize(request, null); + } + + public ApiClientHttpResponse detokenize( + DetokenizeRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/tokens/detokenize") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DetokenizeResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } + + public ApiClientHttpResponse tokenize() { + return tokenize(TokenizeRequest.builder().build()); + } + + public ApiClientHttpResponse tokenize(TokenizeRequest request) { + return tokenize(request, null); + } + + public ApiClientHttpResponse tokenize(TokenizeRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/tokens/get") + .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); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), TokenizeResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new ApiClientException("Network error executing HTTP request", e); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/RecordserviceClient.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/RecordserviceClient.java new file mode 100644 index 00000000..53e22f6e --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/RecordserviceClient.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.recordservice.requests.*; +import com.skyflow.generated.rest.types.*; + +public class RecordserviceClient { + protected final ClientOptions clientOptions; + + private final RawRecordserviceClient rawClient; + + public RecordserviceClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawRecordserviceClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawRecordserviceClient withRawResponse() { + return this.rawClient; + } + + /** + * Executes a query on the specified vault. + */ + public ExecuteQueryResponse executequery() { + return this.rawClient.executequery().body(); + } + + /** + * Executes a query on the specified vault. + */ + public ExecuteQueryResponse executequery(ExecuteQueryRequest request) { + return this.rawClient.executequery(request).body(); + } + + /** + * Executes a query on the specified vault. + */ + public ExecuteQueryResponse executequery(ExecuteQueryRequest request, RequestOptions requestOptions) { + return this.rawClient.executequery(request, requestOptions).body(); + } + + public DeleteResponse delete() { + return this.rawClient.delete().body(); + } + + public DeleteResponse delete(DeleteRequest request) { + return this.rawClient.delete(request).body(); + } + + public DeleteResponse delete(DeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(request, requestOptions).body(); + } + + public GetResponse get() { + return this.rawClient.get().body(); + } + + public GetResponse get(GetRequest request) { + return this.rawClient.get(request).body(); + } + + public GetResponse get(GetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(request, requestOptions).body(); + } + + public InsertResponse insert() { + return this.rawClient.insert().body(); + } + + public InsertResponse insert(InsertRequest request) { + return this.rawClient.insert(request).body(); + } + + public InsertResponse insert(InsertRequest request, RequestOptions requestOptions) { + return this.rawClient.insert(request, requestOptions).body(); + } + + public UpdateResponse update() { + return this.rawClient.update().body(); + } + + public UpdateResponse update(UpdateRequest request) { + return this.rawClient.update(request).body(); + } + + public UpdateResponse update(UpdateRequest request, RequestOptions requestOptions) { + return this.rawClient.update(request, requestOptions).body(); + } + + public DeleteTokenResponse deletetoken() { + return this.rawClient.deletetoken().body(); + } + + public DeleteTokenResponse deletetoken(DeleteTokenRequest request) { + return this.rawClient.deletetoken(request).body(); + } + + public DeleteTokenResponse deletetoken(DeleteTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.deletetoken(request, requestOptions).body(); + } + + public DetokenizeResponse detokenize() { + return this.rawClient.detokenize().body(); + } + + public DetokenizeResponse detokenize(DetokenizeRequest request) { + return this.rawClient.detokenize(request).body(); + } + + public DetokenizeResponse detokenize(DetokenizeRequest request, RequestOptions requestOptions) { + return this.rawClient.detokenize(request, requestOptions).body(); + } + + public TokenizeResponse tokenize() { + return this.rawClient.tokenize().body(); + } + + public TokenizeResponse tokenize(TokenizeRequest request) { + return this.rawClient.tokenize(request).body(); + } + + public TokenizeResponse tokenize(TokenizeRequest request, RequestOptions requestOptions) { + return this.rawClient.tokenize(request, requestOptions).body(); + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DeleteRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DeleteRequest.java new file mode 100644 index 00000000..073da6cb --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DeleteRequest.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteRequest.Builder.class) +public final class DeleteRequest { + private final Optional vaultId; + + private final Optional tableName; + + private final Optional> skyflowIDs; + + private final Map additionalProperties; + + private DeleteRequest( + Optional vaultId, + Optional tableName, + Optional> skyflowIDs, + Map additionalProperties) { + this.vaultId = vaultId; + this.tableName = tableName; + this.skyflowIDs = skyflowIDs; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault where data is being deleted + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Name of the table where data is being deleted + */ + @JsonProperty("tableName") + public Optional getTableName() { + return tableName; + } + + /** + * @return Skyflow ID for the record to be deleted + */ + @JsonProperty("skyflowIDs") + public Optional> getSkyflowIDs() { + return skyflowIDs; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteRequest && equalTo((DeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteRequest other) { + return vaultId.equals(other.vaultId) + && tableName.equals(other.tableName) + && skyflowIDs.equals(other.skyflowIDs); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.tableName, this.skyflowIDs); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional tableName = Optional.empty(); + + private Optional> skyflowIDs = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteRequest other) { + vaultId(other.getVaultId()); + tableName(other.getTableName()); + skyflowIDs(other.getSkyflowIDs()); + return this; + } + + /** + *

ID of the vault where data is being deleted

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Name of the table where data is being deleted

+ */ + @JsonSetter(value = "tableName", nulls = Nulls.SKIP) + public Builder tableName(Optional tableName) { + this.tableName = tableName; + return this; + } + + public Builder tableName(String tableName) { + this.tableName = Optional.ofNullable(tableName); + return this; + } + + /** + *

Skyflow ID for the record to be deleted

+ */ + @JsonSetter(value = "skyflowIDs", nulls = Nulls.SKIP) + public Builder skyflowIDs(Optional> skyflowIDs) { + this.skyflowIDs = skyflowIDs; + return this; + } + + public Builder skyflowIDs(List skyflowIDs) { + this.skyflowIDs = Optional.ofNullable(skyflowIDs); + return this; + } + + public DeleteRequest build() { + return new DeleteRequest(vaultId, tableName, skyflowIDs, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DeleteTokenRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DeleteTokenRequest.java new file mode 100644 index 00000000..4d7039a8 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DeleteTokenRequest.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTokenRequest.Builder.class) +public final class DeleteTokenRequest { + private final Optional vaultId; + + private final Optional> tokens; + + private final Map additionalProperties; + + private DeleteTokenRequest( + Optional vaultId, Optional> tokens, Map additionalProperties) { + this.vaultId = vaultId; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return Vault ID + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Token value + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTokenRequest && equalTo((DeleteTokenRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTokenRequest other) { + return vaultId.equals(other.vaultId) && tokens.equals(other.tokens); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.tokens); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTokenRequest other) { + vaultId(other.getVaultId()); + tokens(other.getTokens()); + return this; + } + + /** + *

Vault ID

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Token value

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(List tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + public DeleteTokenRequest build() { + return new DeleteTokenRequest(vaultId, tokens, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DetokenizeRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DetokenizeRequest.java new file mode 100644 index 00000000..ae1c837c --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/DetokenizeRequest.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.TokenGroupRedactions; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetokenizeRequest.Builder.class) +public final class DetokenizeRequest { + private final Optional vaultId; + + private final Optional> tokens; + + private final Optional> tokenGroupRedactions; + + private final Map additionalProperties; + + private DetokenizeRequest( + Optional vaultId, + Optional> tokens, + Optional> tokenGroupRedactions, + Map additionalProperties) { + this.vaultId = vaultId; + this.tokens = tokens; + this.tokenGroupRedactions = tokenGroupRedactions; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault where detokenizing + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Token to be detokenized + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + /** + * @return List of token groups to be redacted. + */ + @JsonProperty("tokenGroupRedactions") + public Optional> getTokenGroupRedactions() { + return tokenGroupRedactions; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetokenizeRequest && equalTo((DetokenizeRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetokenizeRequest other) { + return vaultId.equals(other.vaultId) + && tokens.equals(other.tokens) + && tokenGroupRedactions.equals(other.tokenGroupRedactions); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.tokens, this.tokenGroupRedactions); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + private Optional> tokenGroupRedactions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DetokenizeRequest other) { + vaultId(other.getVaultId()); + tokens(other.getTokens()); + tokenGroupRedactions(other.getTokenGroupRedactions()); + return this; + } + + /** + *

ID of the vault where detokenizing

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Token to be detokenized

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(List tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + /** + *

List of token groups to be redacted.

+ */ + @JsonSetter(value = "tokenGroupRedactions", nulls = Nulls.SKIP) + public Builder tokenGroupRedactions(Optional> tokenGroupRedactions) { + this.tokenGroupRedactions = tokenGroupRedactions; + return this; + } + + public Builder tokenGroupRedactions(List tokenGroupRedactions) { + this.tokenGroupRedactions = Optional.ofNullable(tokenGroupRedactions); + return this; + } + + public DetokenizeRequest build() { + return new DetokenizeRequest(vaultId, tokens, tokenGroupRedactions, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/ExecuteQueryRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/ExecuteQueryRequest.java new file mode 100644 index 00000000..9f4a4914 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/ExecuteQueryRequest.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExecuteQueryRequest.Builder.class) +public final class ExecuteQueryRequest { + private final Optional vaultId; + + private final Optional query; + + private final Map additionalProperties; + + private ExecuteQueryRequest( + Optional vaultId, Optional query, Map additionalProperties) { + this.vaultId = vaultId; + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault where data is being inserted + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Query to execute. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExecuteQueryRequest && equalTo((ExecuteQueryRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExecuteQueryRequest other) { + return vaultId.equals(other.vaultId) && query.equals(other.query); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.query); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional query = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExecuteQueryRequest other) { + vaultId(other.getVaultId()); + query(other.getQuery()); + return this; + } + + /** + *

ID of the vault where data is being inserted

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Query to execute.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + public ExecuteQueryRequest build() { + return new ExecuteQueryRequest(vaultId, query, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/GetRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/GetRequest.java new file mode 100644 index 00000000..d9367799 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/GetRequest.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.ColumnRedactions; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetRequest.Builder.class) +public final class GetRequest { + private final Optional vaultId; + + private final Optional tableName; + + private final Optional> skyflowIDs; + + private final Optional> columnRedactions; + + private final Optional> columns; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private GetRequest( + Optional vaultId, + Optional tableName, + Optional> skyflowIDs, + Optional> columnRedactions, + Optional> columns, + Optional limit, + Optional offset, + Map additionalProperties) { + this.vaultId = vaultId; + this.tableName = tableName; + this.skyflowIDs = skyflowIDs; + this.columnRedactions = columnRedactions; + this.columns = columns; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault where data is being fetched + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Name of the table where data is being fetched + */ + @JsonProperty("tableName") + public Optional getTableName() { + return tableName; + } + + /** + * @return Skyflow ID for the record to be fetched + */ + @JsonProperty("skyflowIDs") + public Optional> getSkyflowIDs() { + return skyflowIDs; + } + + /** + * @return List of columns to be redacted. + */ + @JsonProperty("columnRedactions") + public Optional> getColumnRedactions() { + return columnRedactions; + } + + /** + * @return List of columns to be fetched. + */ + @JsonProperty("columns") + public Optional> getColumns() { + return columns; + } + + /** + * @return Limit for the number of records to be fetched + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Offset for the number of records to be fetched + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetRequest && equalTo((GetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetRequest other) { + return vaultId.equals(other.vaultId) + && tableName.equals(other.tableName) + && skyflowIDs.equals(other.skyflowIDs) + && columnRedactions.equals(other.columnRedactions) + && columns.equals(other.columns) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.tableName, + this.skyflowIDs, + this.columnRedactions, + this.columns, + this.limit, + this.offset); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional tableName = Optional.empty(); + + private Optional> skyflowIDs = Optional.empty(); + + private Optional> columnRedactions = Optional.empty(); + + private Optional> columns = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetRequest other) { + vaultId(other.getVaultId()); + tableName(other.getTableName()); + skyflowIDs(other.getSkyflowIDs()); + columnRedactions(other.getColumnRedactions()); + columns(other.getColumns()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + /** + *

ID of the vault where data is being fetched

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Name of the table where data is being fetched

+ */ + @JsonSetter(value = "tableName", nulls = Nulls.SKIP) + public Builder tableName(Optional tableName) { + this.tableName = tableName; + return this; + } + + public Builder tableName(String tableName) { + this.tableName = Optional.ofNullable(tableName); + return this; + } + + /** + *

Skyflow ID for the record to be fetched

+ */ + @JsonSetter(value = "skyflowIDs", nulls = Nulls.SKIP) + public Builder skyflowIDs(Optional> skyflowIDs) { + this.skyflowIDs = skyflowIDs; + return this; + } + + public Builder skyflowIDs(List skyflowIDs) { + this.skyflowIDs = Optional.ofNullable(skyflowIDs); + return this; + } + + /** + *

List of columns to be redacted.

+ */ + @JsonSetter(value = "columnRedactions", nulls = Nulls.SKIP) + public Builder columnRedactions(Optional> columnRedactions) { + this.columnRedactions = columnRedactions; + return this; + } + + public Builder columnRedactions(List columnRedactions) { + this.columnRedactions = Optional.ofNullable(columnRedactions); + return this; + } + + /** + *

List of columns to be fetched.

+ */ + @JsonSetter(value = "columns", nulls = Nulls.SKIP) + public Builder columns(Optional> columns) { + this.columns = columns; + return this; + } + + public Builder columns(List columns) { + this.columns = Optional.ofNullable(columns); + return this; + } + + /** + *

Limit for the number of records to be fetched

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Offset for the number of records to be fetched

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Integer offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public GetRequest build() { + return new GetRequest( + vaultId, tableName, skyflowIDs, columnRedactions, columns, limit, offset, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/InsertRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/InsertRequest.java new file mode 100644 index 00000000..1ebb5dfb --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/InsertRequest.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.InsertRecordData; +import com.skyflow.generated.rest.types.Upsert; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InsertRequest.Builder.class) +public final class InsertRequest { + private final Optional vaultId; + + private final Optional tableName; + + private final Optional> records; + + private final Optional upsert; + + private final Map additionalProperties; + + private InsertRequest( + Optional vaultId, + Optional tableName, + Optional> records, + Optional upsert, + Map additionalProperties) { + this.vaultId = vaultId; + this.tableName = tableName; + this.records = records; + this.upsert = upsert; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault where data is being inserted + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Name of the table where data is being inserted + */ + @JsonProperty("tableName") + public Optional getTableName() { + return tableName; + } + + /** + * @return List of data row wise that is to be inserted in the vault + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @JsonProperty("upsert") + public Optional getUpsert() { + return upsert; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InsertRequest && equalTo((InsertRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InsertRequest other) { + return vaultId.equals(other.vaultId) + && tableName.equals(other.tableName) + && records.equals(other.records) + && upsert.equals(other.upsert); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.tableName, this.records, this.upsert); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional tableName = Optional.empty(); + + private Optional> records = Optional.empty(); + + private Optional upsert = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(InsertRequest other) { + vaultId(other.getVaultId()); + tableName(other.getTableName()); + records(other.getRecords()); + upsert(other.getUpsert()); + return this; + } + + /** + *

ID of the vault where data is being inserted

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Name of the table where data is being inserted

+ */ + @JsonSetter(value = "tableName", nulls = Nulls.SKIP) + public Builder tableName(Optional tableName) { + this.tableName = tableName; + return this; + } + + public Builder tableName(String tableName) { + this.tableName = Optional.ofNullable(tableName); + return this; + } + + /** + *

List of data row wise that is to be inserted in the vault

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + @JsonSetter(value = "upsert", nulls = Nulls.SKIP) + public Builder upsert(Optional upsert) { + this.upsert = upsert; + return this; + } + + public Builder upsert(Upsert upsert) { + this.upsert = Optional.ofNullable(upsert); + return this; + } + + public InsertRequest build() { + return new InsertRequest(vaultId, tableName, records, upsert, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/TokenizeRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/TokenizeRequest.java new file mode 100644 index 00000000..e1056b7e --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/TokenizeRequest.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.TokenizeRequestObject; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenizeRequest.Builder.class) +public final class TokenizeRequest { + private final Optional vaultId; + + private final Optional> data; + + private final Map additionalProperties; + + private TokenizeRequest( + Optional vaultId, + Optional> data, + Map additionalProperties) { + this.vaultId = vaultId; + this.data = data; + this.additionalProperties = additionalProperties; + } + + /** + * @return Vault ID. + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Data to be tokenized + */ + @JsonProperty("data") + public Optional> getData() { + return data; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenizeRequest && equalTo((TokenizeRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenizeRequest other) { + return vaultId.equals(other.vaultId) && data.equals(other.data); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.data); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional> data = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenizeRequest other) { + vaultId(other.getVaultId()); + data(other.getData()); + return this; + } + + /** + *

Vault ID.

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Data to be tokenized

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional> data) { + this.data = data; + return this; + } + + public Builder data(List data) { + this.data = Optional.ofNullable(data); + return this; + } + + public TokenizeRequest build() { + return new TokenizeRequest(vaultId, data, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/UpdateRequest.java b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/UpdateRequest.java new file mode 100644 index 00000000..aa859087 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/resources/recordservice/requests/UpdateRequest.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.recordservice.requests; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.EnumUpdateType; +import com.skyflow.generated.rest.types.UpdateRecordData; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateRequest.Builder.class) +public final class UpdateRequest { + private final Optional vaultId; + + private final Optional tableName; + + private final Optional> records; + + private final Optional updateType; + + private final Map additionalProperties; + + private UpdateRequest( + Optional vaultId, + Optional tableName, + Optional> records, + Optional updateType, + Map additionalProperties) { + this.vaultId = vaultId; + this.tableName = tableName; + this.records = records; + this.updateType = updateType; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault where data is being updated + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Name of the table where data is being updated + */ + @JsonProperty("tableName") + public Optional getTableName() { + return tableName; + } + + /** + * @return List of data row wise that is to be updated in the vault + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @JsonProperty("updateType") + public Optional getUpdateType() { + return updateType; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateRequest && equalTo((UpdateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateRequest other) { + return vaultId.equals(other.vaultId) + && tableName.equals(other.tableName) + && records.equals(other.records) + && updateType.equals(other.updateType); + } + + @Override + public int hashCode() { + return Objects.hash(this.vaultId, this.tableName, this.records, this.updateType); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional vaultId = Optional.empty(); + + private Optional tableName = Optional.empty(); + + private Optional> records = Optional.empty(); + + private Optional updateType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateRequest other) { + vaultId(other.getVaultId()); + tableName(other.getTableName()); + records(other.getRecords()); + updateType(other.getUpdateType()); + return this; + } + + /** + *

ID of the vault where data is being updated

+ */ + @JsonSetter(value = "vaultID", nulls = Nulls.SKIP) + public Builder vaultId(Optional vaultId) { + this.vaultId = vaultId; + return this; + } + + public Builder vaultId(String vaultId) { + this.vaultId = Optional.ofNullable(vaultId); + return this; + } + + /** + *

Name of the table where data is being updated

+ */ + @JsonSetter(value = "tableName", nulls = Nulls.SKIP) + public Builder tableName(Optional tableName) { + this.tableName = tableName; + return this; + } + + public Builder tableName(String tableName) { + this.tableName = Optional.ofNullable(tableName); + return this; + } + + /** + *

List of data row wise that is to be updated in the vault

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + @JsonSetter(value = "updateType", nulls = Nulls.SKIP) + public Builder updateType(Optional updateType) { + this.updateType = updateType; + return this; + } + + public Builder updateType(EnumUpdateType updateType) { + this.updateType = Optional.ofNullable(updateType); + return this; + } + + public UpdateRequest build() { + return new UpdateRequest(vaultId, tableName, records, updateType, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/ColumnRedactions.java b/v3/src/main/java/com/skyflow/generated/rest/types/ColumnRedactions.java new file mode 100644 index 00000000..bd0c6915 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/ColumnRedactions.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ColumnRedactions.Builder.class) +public final class ColumnRedactions { + private final Optional columnName; + + private final Optional redaction; + + private final Map additionalProperties; + + private ColumnRedactions( + Optional columnName, Optional redaction, Map additionalProperties) { + this.columnName = columnName; + this.redaction = redaction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Name of the column to be redacted + */ + @JsonProperty("columnName") + public Optional getColumnName() { + return columnName; + } + + /** + * @return Name of the redaction. Eg: plain_text, redacted, mask1 + */ + @JsonProperty("redaction") + public Optional getRedaction() { + return redaction; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ColumnRedactions && equalTo((ColumnRedactions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ColumnRedactions other) { + return columnName.equals(other.columnName) && redaction.equals(other.redaction); + } + + @Override + public int hashCode() { + return Objects.hash(this.columnName, this.redaction); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional columnName = Optional.empty(); + + private Optional redaction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ColumnRedactions other) { + columnName(other.getColumnName()); + redaction(other.getRedaction()); + return this; + } + + /** + *

Name of the column to be redacted

+ */ + @JsonSetter(value = "columnName", nulls = Nulls.SKIP) + public Builder columnName(Optional columnName) { + this.columnName = columnName; + return this; + } + + public Builder columnName(String columnName) { + this.columnName = Optional.ofNullable(columnName); + return this; + } + + /** + *

Name of the redaction. Eg: plain_text, redacted, mask1

+ */ + @JsonSetter(value = "redaction", nulls = Nulls.SKIP) + public Builder redaction(Optional redaction) { + this.redaction = redaction; + return this; + } + + public Builder redaction(String redaction) { + this.redaction = Optional.ofNullable(redaction); + return this; + } + + public ColumnRedactions build() { + return new ColumnRedactions(columnName, redaction, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/DeleteResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteResponse.java new file mode 100644 index 00000000..d3d825f0 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteResponse.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteResponse.Builder.class) +public final class DeleteResponse { + private final Optional> records; + + private final Map additionalProperties; + + private DeleteResponse(Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of deleted records with skyflow ID and any partial errors. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteResponse && equalTo((DeleteResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteResponse other) { + return records.equals(other.records); + } + + @Override + public int hashCode() { + return Objects.hash(this.records); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

List of deleted records with skyflow ID and any partial errors.

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + public DeleteResponse build() { + return new DeleteResponse(records, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/DeleteResponseObject.java b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteResponseObject.java new file mode 100644 index 00000000..31d34920 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteResponseObject.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteResponseObject.Builder.class) +public final class DeleteResponseObject { + private final Optional skyflowId; + + private final Optional error; + + private final Optional httpCode; + + private final Map additionalProperties; + + private DeleteResponseObject( + Optional skyflowId, + Optional error, + Optional httpCode, + Map additionalProperties) { + this.skyflowId = skyflowId; + this.error = error; + this.httpCode = httpCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return Skyflow ID for the deleted record + */ + @JsonProperty("skyflowID") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return Partial Error message if any + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return HTTP status code of the response + */ + @JsonProperty("httpCode") + public Optional getHttpCode() { + return httpCode; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteResponseObject && equalTo((DeleteResponseObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteResponseObject other) { + return skyflowId.equals(other.skyflowId) && error.equals(other.error) && httpCode.equals(other.httpCode); + } + + @Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.error, this.httpCode); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional skyflowId = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional httpCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteResponseObject other) { + skyflowId(other.getSkyflowId()); + error(other.getError()); + httpCode(other.getHttpCode()); + return this; + } + + /** + *

Skyflow ID for the deleted record

+ */ + @JsonSetter(value = "skyflowID", nulls = Nulls.SKIP) + public Builder skyflowId(Optional skyflowId) { + this.skyflowId = skyflowId; + return this; + } + + public Builder skyflowId(String skyflowId) { + this.skyflowId = Optional.ofNullable(skyflowId); + return this; + } + + /** + *

Partial Error message if any

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

HTTP status code of the response

+ */ + @JsonSetter(value = "httpCode", nulls = Nulls.SKIP) + public Builder httpCode(Optional httpCode) { + this.httpCode = httpCode; + return this; + } + + public Builder httpCode(Integer httpCode) { + this.httpCode = Optional.ofNullable(httpCode); + return this; + } + + public DeleteResponseObject build() { + return new DeleteResponseObject(skyflowId, error, httpCode, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/DeleteTokenResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteTokenResponse.java new file mode 100644 index 00000000..728c1877 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteTokenResponse.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTokenResponse.Builder.class) +public final class DeleteTokenResponse { + private final Optional> tokens; + + private final Map additionalProperties; + + private DeleteTokenResponse( + Optional> tokens, Map additionalProperties) { + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tokens data for Delete + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTokenResponse && equalTo((DeleteTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTokenResponse other) { + return tokens.equals(other.tokens); + } + + @Override + public int hashCode() { + return Objects.hash(this.tokens); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTokenResponse other) { + tokens(other.getTokens()); + return this; + } + + /** + *

Tokens data for Delete

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(List tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + public DeleteTokenResponse build() { + return new DeleteTokenResponse(tokens, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/DeleteTokenResponseObject.java b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteTokenResponseObject.java new file mode 100644 index 00000000..98e3620f --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/DeleteTokenResponseObject.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTokenResponseObject.Builder.class) +public final class DeleteTokenResponseObject { + private final Optional value; + + private final Optional error; + + private final Optional httpCode; + + private final Map additionalProperties; + + private DeleteTokenResponseObject( + Optional value, + Optional error, + Optional httpCode, + Map additionalProperties) { + this.value = value; + this.error = error; + this.httpCode = httpCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token value + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Error if deletion failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return HTTP status code of the response + */ + @JsonProperty("httpCode") + public Optional getHttpCode() { + return httpCode; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTokenResponseObject && equalTo((DeleteTokenResponseObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTokenResponseObject other) { + return value.equals(other.value) && error.equals(other.error) && httpCode.equals(other.httpCode); + } + + @Override + public int hashCode() { + return Objects.hash(this.value, this.error, this.httpCode); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional value = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional httpCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTokenResponseObject other) { + value(other.getValue()); + error(other.getError()); + httpCode(other.getHttpCode()); + return this; + } + + /** + *

Token value

+ */ + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

Error if deletion failed

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

HTTP status code of the response

+ */ + @JsonSetter(value = "httpCode", nulls = Nulls.SKIP) + public Builder httpCode(Optional httpCode) { + this.httpCode = httpCode; + return this; + } + + public Builder httpCode(Integer httpCode) { + this.httpCode = Optional.ofNullable(httpCode); + return this; + } + + public DeleteTokenResponseObject build() { + return new DeleteTokenResponseObject(value, error, httpCode, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/DetokenizeResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/DetokenizeResponse.java new file mode 100644 index 00000000..7e3fa23a --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/DetokenizeResponse.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetokenizeResponse.Builder.class) +public final class DetokenizeResponse { + private final Optional> response; + + private final Map additionalProperties; + + private DetokenizeResponse( + Optional> response, Map additionalProperties) { + this.response = response; + this.additionalProperties = additionalProperties; + } + + /** + * @return Detokenized data + */ + @JsonProperty("response") + public Optional> getResponse() { + return response; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetokenizeResponse && equalTo((DetokenizeResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetokenizeResponse other) { + return response.equals(other.response); + } + + @Override + public int hashCode() { + return Objects.hash(this.response); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> response = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DetokenizeResponse other) { + response(other.getResponse()); + return this; + } + + /** + *

Detokenized data

+ */ + @JsonSetter(value = "response", nulls = Nulls.SKIP) + public Builder response(Optional> response) { + this.response = response; + return this; + } + + public Builder response(List response) { + this.response = Optional.ofNullable(response); + return this; + } + + public DetokenizeResponse build() { + return new DetokenizeResponse(response, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/DetokenizeResponseObject.java b/v3/src/main/java/com/skyflow/generated/rest/types/DetokenizeResponseObject.java new file mode 100644 index 00000000..ed7ed16d --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/DetokenizeResponseObject.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetokenizeResponseObject.Builder.class) +public final class DetokenizeResponseObject { + private final Optional token; + + private final Optional value; + + private final Optional tokenGroupName; + + private final Optional error; + + private final Optional httpCode; + + private final Optional> metadata; + + private final Map additionalProperties; + + private DetokenizeResponseObject( + Optional token, + Optional value, + Optional tokenGroupName, + Optional error, + Optional httpCode, + Optional> metadata, + Map additionalProperties) { + this.token = token; + this.value = value; + this.tokenGroupName = tokenGroupName; + this.error = error; + this.httpCode = httpCode; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token to be detokenized + */ + @JsonProperty("token") + public Optional getToken() { + return token; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Token group name + */ + @JsonProperty("tokenGroupName") + public Optional getTokenGroupName() { + return tokenGroupName; + } + + /** + * @return Error if detokenization failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return HTTP status code of the response + */ + @JsonProperty("httpCode") + public Optional getHttpCode() { + return httpCode; + } + + /** + * @return Additional metadata associated with the token, such as tableName or skyflowID + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetokenizeResponseObject && equalTo((DetokenizeResponseObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetokenizeResponseObject other) { + return token.equals(other.token) + && value.equals(other.value) + && tokenGroupName.equals(other.tokenGroupName) + && error.equals(other.error) + && httpCode.equals(other.httpCode) + && metadata.equals(other.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(this.token, this.value, this.tokenGroupName, this.error, this.httpCode, this.metadata); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional token = Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional tokenGroupName = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional httpCode = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DetokenizeResponseObject other) { + token(other.getToken()); + value(other.getValue()); + tokenGroupName(other.getTokenGroupName()); + error(other.getError()); + httpCode(other.getHttpCode()); + metadata(other.getMetadata()); + return this; + } + + /** + *

Token to be detokenized

+ */ + @JsonSetter(value = "token", nulls = Nulls.SKIP) + public Builder token(Optional token) { + this.token = token; + return this; + } + + public Builder token(String token) { + this.token = Optional.ofNullable(token); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(Object value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

Token group name

+ */ + @JsonSetter(value = "tokenGroupName", nulls = Nulls.SKIP) + public Builder tokenGroupName(Optional tokenGroupName) { + this.tokenGroupName = tokenGroupName; + return this; + } + + public Builder tokenGroupName(String tokenGroupName) { + this.tokenGroupName = Optional.ofNullable(tokenGroupName); + return this; + } + + /** + *

Error if detokenization failed

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

HTTP status code of the response

+ */ + @JsonSetter(value = "httpCode", nulls = Nulls.SKIP) + public Builder httpCode(Optional httpCode) { + this.httpCode = httpCode; + return this; + } + + public Builder httpCode(Integer httpCode) { + this.httpCode = Optional.ofNullable(httpCode); + return this; + } + + /** + *

Additional metadata associated with the token, such as tableName or skyflowID

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public DetokenizeResponseObject build() { + return new DetokenizeResponseObject( + token, value, tokenGroupName, error, httpCode, metadata, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/EnumDataType.java b/v3/src/main/java/com/skyflow/generated/rest/types/EnumDataType.java new file mode 100644 index 00000000..eda51d21 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/EnumDataType.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum EnumDataType { + UNDEFINED_DATATYPE("UNDEFINED_DATATYPE"), + + STRING("STRING"), + + NUMBER("NUMBER"), + + BOOL("BOOL"), + + JSON("JSON"); + + private final String value; + + EnumDataType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/EnumUpdateType.java b/v3/src/main/java/com/skyflow/generated/rest/types/EnumUpdateType.java new file mode 100644 index 00000000..a435ac27 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/EnumUpdateType.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum EnumUpdateType { + UPDATE("UPDATE"), + + REPLACE("REPLACE"); + + private final String value; + + EnumUpdateType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/ExecuteQueryRecordResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/ExecuteQueryRecordResponse.java new file mode 100644 index 00000000..5a670a73 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/ExecuteQueryRecordResponse.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExecuteQueryRecordResponse.Builder.class) +public final class ExecuteQueryRecordResponse { + private final Optional> data; + + private final Map additionalProperties; + + private ExecuteQueryRecordResponse(Optional> data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + /** + * @return Fields and values for the record. For example, {'field_1':'value_1', 'field_2':'value_2'}. + */ + @JsonProperty("data") + public Optional> getData() { + return data; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExecuteQueryRecordResponse && equalTo((ExecuteQueryRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExecuteQueryRecordResponse other) { + return data.equals(other.data); + } + + @Override + public int hashCode() { + return Objects.hash(this.data); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> data = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExecuteQueryRecordResponse other) { + data(other.getData()); + return this; + } + + /** + *

Fields and values for the record. For example, {'field_1':'value_1', 'field_2':'value_2'}.

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional> data) { + this.data = data; + return this; + } + + public Builder data(Map data) { + this.data = Optional.ofNullable(data); + return this; + } + + public ExecuteQueryRecordResponse build() { + return new ExecuteQueryRecordResponse(data, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/ExecuteQueryResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/ExecuteQueryResponse.java new file mode 100644 index 00000000..e9eb635a --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/ExecuteQueryResponse.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExecuteQueryResponse.Builder.class) +public final class ExecuteQueryResponse { + private final Optional> records; + + private final Map additionalProperties; + + private ExecuteQueryResponse( + Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return Records corresponding to the specified query. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExecuteQueryResponse && equalTo((ExecuteQueryResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExecuteQueryResponse other) { + return records.equals(other.records); + } + + @Override + public int hashCode() { + return Objects.hash(this.records); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExecuteQueryResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

Records corresponding to the specified query.

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + public ExecuteQueryResponse build() { + return new ExecuteQueryResponse(records, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/GetResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/GetResponse.java new file mode 100644 index 00000000..190ce169 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/GetResponse.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetResponse.Builder.class) +public final class GetResponse { + private final Optional> records; + + private final Map additionalProperties; + + private GetResponse(Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of fetched records with skyflow ID, tokens, data, and any partial errors + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetResponse && equalTo((GetResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetResponse other) { + return records.equals(other.records); + } + + @Override + public int hashCode() { + return Objects.hash(this.records); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

List of fetched records with skyflow ID, tokens, data, and any partial errors

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + public GetResponse build() { + return new GetResponse(records, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/InsertRecordData.java b/v3/src/main/java/com/skyflow/generated/rest/types/InsertRecordData.java new file mode 100644 index 00000000..2738332b --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/InsertRecordData.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InsertRecordData.Builder.class) +public final class InsertRecordData { + private final Optional> data; + + private final Optional> tokens; + + private final Map additionalProperties; + + private InsertRecordData( + Optional> data, + Optional> tokens, + Map additionalProperties) { + this.data = data; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return Columns names and values + */ + @JsonProperty("data") + public Optional> getData() { + return data; + } + + /** + * @return Tokens data for the columns if any + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InsertRecordData && equalTo((InsertRecordData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InsertRecordData other) { + return data.equals(other.data) && tokens.equals(other.tokens); + } + + @Override + public int hashCode() { + return Objects.hash(this.data, this.tokens); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> data = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(InsertRecordData other) { + data(other.getData()); + tokens(other.getTokens()); + return this; + } + + /** + *

Columns names and values

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional> data) { + this.data = data; + return this; + } + + public Builder data(Map data) { + this.data = Optional.ofNullable(data); + return this; + } + + /** + *

Tokens data for the columns if any

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(Map tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + public InsertRecordData build() { + return new InsertRecordData(data, tokens, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/InsertResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/InsertResponse.java new file mode 100644 index 00000000..9b577820 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/InsertResponse.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InsertResponse.Builder.class) +public final class InsertResponse { + private final Optional> records; + + private final Map additionalProperties; + + private InsertResponse(Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of inserted records with skyflow ID, tokens, data, and any partial errors. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InsertResponse && equalTo((InsertResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InsertResponse other) { + return records.equals(other.records); + } + + @Override + public int hashCode() { + return Objects.hash(this.records); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(InsertResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

List of inserted records with skyflow ID, tokens, data, and any partial errors.

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + public InsertResponse build() { + return new InsertResponse(records, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java b/v3/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java new file mode 100644 index 00000000..40e73b99 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java @@ -0,0 +1,90 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProtobufAny.Builder.class) +public final class ProtobufAny { + private final Optional type; + + private final Map additionalProperties; + + private ProtobufAny(Optional type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("@type") + public Optional getType() { + return type; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProtobufAny && equalTo((ProtobufAny) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProtobufAny other) { + return type.equals(other.type); + } + + @Override + public int hashCode() { + return Objects.hash(this.type); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProtobufAny other) { + type(other.getType()); + return this; + } + + @JsonSetter(value = "@type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + public ProtobufAny build() { + return new ProtobufAny(type, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/RecordResponseObject.java b/v3/src/main/java/com/skyflow/generated/rest/types/RecordResponseObject.java new file mode 100644 index 00000000..8e47bba0 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/RecordResponseObject.java @@ -0,0 +1,248 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RecordResponseObject.Builder.class) +public final class RecordResponseObject { + private final Optional skyflowId; + + private final Optional> tokens; + + private final Optional> data; + + private final Optional> hashedData; + + private final Optional error; + + private final Optional httpCode; + + private final Map additionalProperties; + + private RecordResponseObject( + Optional skyflowId, + Optional> tokens, + Optional> data, + Optional> hashedData, + Optional error, + Optional httpCode, + Map additionalProperties) { + this.skyflowId = skyflowId; + this.tokens = tokens; + this.data = data; + this.hashedData = hashedData; + this.error = error; + this.httpCode = httpCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return Skyflow ID for the inserted record + */ + @JsonProperty("skyflowID") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return Tokens data for the columns if any + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + /** + * @return Columns names and values + */ + @JsonProperty("data") + public Optional> getData() { + return data; + } + + /** + * @return Hashed Data for the columns if any + */ + @JsonProperty("hashedData") + public Optional> getHashedData() { + return hashedData; + } + + /** + * @return Partial Error message if any + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return HTTP status code of the response + */ + @JsonProperty("httpCode") + public Optional getHttpCode() { + return httpCode; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordResponseObject && equalTo((RecordResponseObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordResponseObject other) { + return skyflowId.equals(other.skyflowId) + && tokens.equals(other.tokens) + && data.equals(other.data) + && hashedData.equals(other.hashedData) + && error.equals(other.error) + && httpCode.equals(other.httpCode); + } + + @Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.tokens, this.data, this.hashedData, this.error, this.httpCode); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional skyflowId = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + private Optional> data = Optional.empty(); + + private Optional> hashedData = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional httpCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordResponseObject other) { + skyflowId(other.getSkyflowId()); + tokens(other.getTokens()); + data(other.getData()); + hashedData(other.getHashedData()); + error(other.getError()); + httpCode(other.getHttpCode()); + return this; + } + + /** + *

Skyflow ID for the inserted record

+ */ + @JsonSetter(value = "skyflowID", nulls = Nulls.SKIP) + public Builder skyflowId(Optional skyflowId) { + this.skyflowId = skyflowId; + return this; + } + + public Builder skyflowId(String skyflowId) { + this.skyflowId = Optional.ofNullable(skyflowId); + return this; + } + + /** + *

Tokens data for the columns if any

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(Map tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + /** + *

Columns names and values

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional> data) { + this.data = data; + return this; + } + + public Builder data(Map data) { + this.data = Optional.ofNullable(data); + return this; + } + + /** + *

Hashed Data for the columns if any

+ */ + @JsonSetter(value = "hashedData", nulls = Nulls.SKIP) + public Builder hashedData(Optional> hashedData) { + this.hashedData = hashedData; + return this; + } + + public Builder hashedData(Map hashedData) { + this.hashedData = Optional.ofNullable(hashedData); + return this; + } + + /** + *

Partial Error message if any

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

HTTP status code of the response

+ */ + @JsonSetter(value = "httpCode", nulls = Nulls.SKIP) + public Builder httpCode(Optional httpCode) { + this.httpCode = httpCode; + return this; + } + + public Builder httpCode(Integer httpCode) { + this.httpCode = Optional.ofNullable(httpCode); + return this; + } + + public RecordResponseObject build() { + return new RecordResponseObject(skyflowId, tokens, data, hashedData, error, httpCode, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/RpcStatus.java b/v3/src/main/java/com/skyflow/generated/rest/types/RpcStatus.java new file mode 100644 index 00000000..bce5f3e9 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/RpcStatus.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RpcStatus.Builder.class) +public final class RpcStatus { + private final Optional code; + + private final Optional message; + + private final Optional> details; + + private final Map additionalProperties; + + private RpcStatus( + Optional code, + Optional message, + Optional> details, + Map additionalProperties) { + this.code = code; + this.message = message; + this.details = details; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("code") + public Optional getCode() { + return code; + } + + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @JsonProperty("details") + public Optional> getDetails() { + return details; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RpcStatus && equalTo((RpcStatus) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RpcStatus other) { + return code.equals(other.code) && message.equals(other.message) && details.equals(other.details); + } + + @Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.details); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional> details = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RpcStatus other) { + code(other.getCode()); + message(other.getMessage()); + details(other.getDetails()); + return this; + } + + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(Integer code) { + this.code = Optional.ofNullable(code); + return this; + } + + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional> details) { + this.details = details; + return this; + } + + public Builder details(List details) { + this.details = Optional.ofNullable(details); + return this; + } + + public RpcStatus build() { + return new RpcStatus(code, message, details, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/TokenGroupRedactions.java b/v3/src/main/java/com/skyflow/generated/rest/types/TokenGroupRedactions.java new file mode 100644 index 00000000..cdf3e5e6 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/TokenGroupRedactions.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenGroupRedactions.Builder.class) +public final class TokenGroupRedactions { + private final Optional tokenGroupName; + + private final Optional redaction; + + private final Map additionalProperties; + + private TokenGroupRedactions( + Optional tokenGroupName, Optional redaction, Map additionalProperties) { + this.tokenGroupName = tokenGroupName; + this.redaction = redaction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Name of the token group to be redacted + */ + @JsonProperty("tokenGroupName") + public Optional getTokenGroupName() { + return tokenGroupName; + } + + /** + * @return Name of the redaction. Eg: plain_text, redacted, mask1 + */ + @JsonProperty("redaction") + public Optional getRedaction() { + return redaction; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenGroupRedactions && equalTo((TokenGroupRedactions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenGroupRedactions other) { + return tokenGroupName.equals(other.tokenGroupName) && redaction.equals(other.redaction); + } + + @Override + public int hashCode() { + return Objects.hash(this.tokenGroupName, this.redaction); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional tokenGroupName = Optional.empty(); + + private Optional redaction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenGroupRedactions other) { + tokenGroupName(other.getTokenGroupName()); + redaction(other.getRedaction()); + return this; + } + + /** + *

Name of the token group to be redacted

+ */ + @JsonSetter(value = "tokenGroupName", nulls = Nulls.SKIP) + public Builder tokenGroupName(Optional tokenGroupName) { + this.tokenGroupName = tokenGroupName; + return this; + } + + public Builder tokenGroupName(String tokenGroupName) { + this.tokenGroupName = Optional.ofNullable(tokenGroupName); + return this; + } + + /** + *

Name of the redaction. Eg: plain_text, redacted, mask1

+ */ + @JsonSetter(value = "redaction", nulls = Nulls.SKIP) + public Builder redaction(Optional redaction) { + this.redaction = redaction; + return this; + } + + public Builder redaction(String redaction) { + this.redaction = Optional.ofNullable(redaction); + return this; + } + + public TokenGroupRedactions build() { + return new TokenGroupRedactions(tokenGroupName, redaction, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeRequestObject.java b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeRequestObject.java new file mode 100644 index 00000000..e467650e --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeRequestObject.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenizeRequestObject.Builder.class) +public final class TokenizeRequestObject { + private final Optional value; + + private final Optional dataType; + + private final Optional> tokenGroupNames; + + private final Map additionalProperties; + + private TokenizeRequestObject( + Optional value, + Optional dataType, + Optional> tokenGroupNames, + Map additionalProperties) { + this.value = value; + this.dataType = dataType; + this.tokenGroupNames = tokenGroupNames; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @JsonProperty("dataType") + public Optional getDataType() { + return dataType; + } + + /** + * @return List of token group names + */ + @JsonProperty("tokenGroupNames") + public Optional> getTokenGroupNames() { + return tokenGroupNames; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenizeRequestObject && equalTo((TokenizeRequestObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenizeRequestObject other) { + return value.equals(other.value) + && dataType.equals(other.dataType) + && tokenGroupNames.equals(other.tokenGroupNames); + } + + @Override + public int hashCode() { + return Objects.hash(this.value, this.dataType, this.tokenGroupNames); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional value = Optional.empty(); + + private Optional dataType = Optional.empty(); + + private Optional> tokenGroupNames = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenizeRequestObject other) { + value(other.getValue()); + dataType(other.getDataType()); + tokenGroupNames(other.getTokenGroupNames()); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(Object value) { + this.value = Optional.ofNullable(value); + return this; + } + + @JsonSetter(value = "dataType", nulls = Nulls.SKIP) + public Builder dataType(Optional dataType) { + this.dataType = dataType; + return this; + } + + public Builder dataType(EnumDataType dataType) { + this.dataType = Optional.ofNullable(dataType); + return this; + } + + /** + *

List of token group names

+ */ + @JsonSetter(value = "tokenGroupNames", nulls = Nulls.SKIP) + public Builder tokenGroupNames(Optional> tokenGroupNames) { + this.tokenGroupNames = tokenGroupNames; + return this; + } + + public Builder tokenGroupNames(List tokenGroupNames) { + this.tokenGroupNames = Optional.ofNullable(tokenGroupNames); + return this; + } + + public TokenizeRequestObject build() { + return new TokenizeRequestObject(value, dataType, tokenGroupNames, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponse.java new file mode 100644 index 00000000..9bd93527 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponse.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenizeResponse.Builder.class) +public final class TokenizeResponse { + private final Optional> response; + + private final Map additionalProperties; + + private TokenizeResponse( + Optional> response, Map additionalProperties) { + this.response = response; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tokenized data + */ + @JsonProperty("response") + public Optional> getResponse() { + return response; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenizeResponse && equalTo((TokenizeResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenizeResponse other) { + return response.equals(other.response); + } + + @Override + public int hashCode() { + return Objects.hash(this.response); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> response = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenizeResponse other) { + response(other.getResponse()); + return this; + } + + /** + *

Tokenized data

+ */ + @JsonSetter(value = "response", nulls = Nulls.SKIP) + public Builder response(Optional> response) { + this.response = response; + return this; + } + + public Builder response(List response) { + this.response = Optional.ofNullable(response); + return this; + } + + public TokenizeResponse build() { + return new TokenizeResponse(response, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponseObject.java b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponseObject.java new file mode 100644 index 00000000..77b47099 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponseObject.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenizeResponseObject.Builder.class) +public final class TokenizeResponseObject { + private final Optional value; + + private final Optional> tokens; + + private final Map additionalProperties; + + private TokenizeResponseObject( + Optional value, + Optional> tokens, + Map additionalProperties) { + this.value = value; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Token value + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenizeResponseObject && equalTo((TokenizeResponseObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenizeResponseObject other) { + return value.equals(other.value) && tokens.equals(other.tokens); + } + + @Override + public int hashCode() { + return Objects.hash(this.value, this.tokens); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional value = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenizeResponseObject other) { + value(other.getValue()); + tokens(other.getTokens()); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(Object value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

Token value

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(List tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + public TokenizeResponseObject build() { + return new TokenizeResponseObject(value, tokens, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponseObjectToken.java b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponseObjectToken.java new file mode 100644 index 00000000..62c8f32b --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/TokenizeResponseObjectToken.java @@ -0,0 +1,188 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenizeResponseObjectToken.Builder.class) +public final class TokenizeResponseObjectToken { + private final Optional tokenGroupName; + + private final Optional token; + + private final Optional error; + + private final Optional httpCode; + + private final Map additionalProperties; + + private TokenizeResponseObjectToken( + Optional tokenGroupName, + Optional token, + Optional error, + Optional httpCode, + Map additionalProperties) { + this.tokenGroupName = tokenGroupName; + this.token = token; + this.error = error; + this.httpCode = httpCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token group Name + */ + @JsonProperty("tokenGroupName") + public Optional getTokenGroupName() { + return tokenGroupName; + } + + /** + * @return Token value + */ + @JsonProperty("token") + public Optional getToken() { + return token; + } + + /** + * @return Error if tokenization failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return HTTP status code of the response + */ + @JsonProperty("httpCode") + public Optional getHttpCode() { + return httpCode; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenizeResponseObjectToken && equalTo((TokenizeResponseObjectToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenizeResponseObjectToken other) { + return tokenGroupName.equals(other.tokenGroupName) + && token.equals(other.token) + && error.equals(other.error) + && httpCode.equals(other.httpCode); + } + + @Override + public int hashCode() { + return Objects.hash(this.tokenGroupName, this.token, this.error, this.httpCode); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional tokenGroupName = Optional.empty(); + + private Optional token = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional httpCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenizeResponseObjectToken other) { + tokenGroupName(other.getTokenGroupName()); + token(other.getToken()); + error(other.getError()); + httpCode(other.getHttpCode()); + return this; + } + + /** + *

Token group Name

+ */ + @JsonSetter(value = "tokenGroupName", nulls = Nulls.SKIP) + public Builder tokenGroupName(Optional tokenGroupName) { + this.tokenGroupName = tokenGroupName; + return this; + } + + public Builder tokenGroupName(String tokenGroupName) { + this.tokenGroupName = Optional.ofNullable(tokenGroupName); + return this; + } + + /** + *

Token value

+ */ + @JsonSetter(value = "token", nulls = Nulls.SKIP) + public Builder token(Optional token) { + this.token = token; + return this; + } + + public Builder token(String token) { + this.token = Optional.ofNullable(token); + return this; + } + + /** + *

Error if tokenization failed

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

HTTP status code of the response

+ */ + @JsonSetter(value = "httpCode", nulls = Nulls.SKIP) + public Builder httpCode(Optional httpCode) { + this.httpCode = httpCode; + return this; + } + + public Builder httpCode(Integer httpCode) { + this.httpCode = Optional.ofNullable(httpCode); + return this; + } + + public TokenizeResponseObjectToken build() { + return new TokenizeResponseObjectToken(tokenGroupName, token, error, httpCode, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/UpdateRecordData.java b/v3/src/main/java/com/skyflow/generated/rest/types/UpdateRecordData.java new file mode 100644 index 00000000..f9c39572 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/UpdateRecordData.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateRecordData.Builder.class) +public final class UpdateRecordData { + private final Optional skyflowId; + + private final Optional> data; + + private final Optional> tokens; + + private final Map additionalProperties; + + private UpdateRecordData( + Optional skyflowId, + Optional> data, + Optional> tokens, + Map additionalProperties) { + this.skyflowId = skyflowId; + this.data = data; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return Skyflow ID for the record to be updated + */ + @JsonProperty("skyflowID") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return List of data row wise that is to be updated in the vault + */ + @JsonProperty("data") + public Optional> getData() { + return data; + } + + /** + * @return Tokens data for the columns if any + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateRecordData && equalTo((UpdateRecordData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateRecordData other) { + return skyflowId.equals(other.skyflowId) && data.equals(other.data) && tokens.equals(other.tokens); + } + + @Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.data, this.tokens); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional skyflowId = Optional.empty(); + + private Optional> data = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateRecordData other) { + skyflowId(other.getSkyflowId()); + data(other.getData()); + tokens(other.getTokens()); + return this; + } + + /** + *

Skyflow ID for the record to be updated

+ */ + @JsonSetter(value = "skyflowID", nulls = Nulls.SKIP) + public Builder skyflowId(Optional skyflowId) { + this.skyflowId = skyflowId; + return this; + } + + public Builder skyflowId(String skyflowId) { + this.skyflowId = Optional.ofNullable(skyflowId); + return this; + } + + /** + *

List of data row wise that is to be updated in the vault

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional> data) { + this.data = data; + return this; + } + + public Builder data(Map data) { + this.data = Optional.ofNullable(data); + return this; + } + + /** + *

Tokens data for the columns if any

+ */ + @JsonSetter(value = "tokens", nulls = Nulls.SKIP) + public Builder tokens(Optional> tokens) { + this.tokens = tokens; + return this; + } + + public Builder tokens(Map tokens) { + this.tokens = Optional.ofNullable(tokens); + return this; + } + + public UpdateRecordData build() { + return new UpdateRecordData(skyflowId, data, tokens, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/UpdateResponse.java b/v3/src/main/java/com/skyflow/generated/rest/types/UpdateResponse.java new file mode 100644 index 00000000..71d49aa8 --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/UpdateResponse.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateResponse.Builder.class) +public final class UpdateResponse { + private final Optional> records; + + private final Map additionalProperties; + + private UpdateResponse(Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of updated records with skyflow ID, tokens, data, and any partial errors + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateResponse && equalTo((UpdateResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateResponse other) { + return records.equals(other.records); + } + + @Override + public int hashCode() { + return Objects.hash(this.records); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

List of updated records with skyflow ID, tokens, data, and any partial errors

+ */ + @JsonSetter(value = "records", nulls = Nulls.SKIP) + public Builder records(Optional> records) { + this.records = records; + return this; + } + + public Builder records(List records) { + this.records = Optional.ofNullable(records); + return this; + } + + public UpdateResponse build() { + return new UpdateResponse(records, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/generated/rest/types/Upsert.java b/v3/src/main/java/com/skyflow/generated/rest/types/Upsert.java new file mode 100644 index 00000000..5bfe7b1b --- /dev/null +++ b/v3/src/main/java/com/skyflow/generated/rest/types/Upsert.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.types; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; + +import java.util.*; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Upsert.Builder.class) +public final class Upsert { + private final Optional updateType; + + private final Optional> uniqueColumns; + + private final Map additionalProperties; + + private Upsert( + Optional updateType, + Optional> uniqueColumns, + Map additionalProperties) { + this.updateType = updateType; + this.uniqueColumns = uniqueColumns; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("updateType") + public Optional getUpdateType() { + return updateType; + } + + /** + * @return Name of a unique columns in the table. Uses upsert operations to check if a record exists based on the unique column's value. If a matching record exists, the record updates with the values you provide. If a matching record doesn't exist, the upsert operation inserts a new record. + */ + @JsonProperty("uniqueColumns") + public Optional> getUniqueColumns() { + return uniqueColumns; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Upsert && equalTo((Upsert) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Upsert other) { + return updateType.equals(other.updateType) && uniqueColumns.equals(other.uniqueColumns); + } + + @Override + public int hashCode() { + return Objects.hash(this.updateType, this.uniqueColumns); + } + + @Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional updateType = Optional.empty(); + + private Optional> uniqueColumns = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Upsert other) { + updateType(other.getUpdateType()); + uniqueColumns(other.getUniqueColumns()); + return this; + } + + @JsonSetter(value = "updateType", nulls = Nulls.SKIP) + public Builder updateType(Optional updateType) { + this.updateType = updateType; + return this; + } + + public Builder updateType(EnumUpdateType updateType) { + this.updateType = Optional.ofNullable(updateType); + return this; + } + + /** + *

Name of a unique columns in the table. Uses upsert operations to check if a record exists based on the unique column's value. If a matching record exists, the record updates with the values you provide. If a matching record doesn't exist, the upsert operation inserts a new record.

+ */ + @JsonSetter(value = "uniqueColumns", nulls = Nulls.SKIP) + public Builder uniqueColumns(Optional> uniqueColumns) { + this.uniqueColumns = uniqueColumns; + return this; + } + + public Builder uniqueColumns(List uniqueColumns) { + this.uniqueColumns = Optional.ofNullable(uniqueColumns); + return this; + } + + public Upsert build() { + return new Upsert(updateType, uniqueColumns, additionalProperties); + } + } +} diff --git a/v3/src/main/java/com/skyflow/utils/Constants.java b/v3/src/main/java/com/skyflow/utils/Constants.java new file mode 100644 index 00000000..379bcfbb --- /dev/null +++ b/v3/src/main/java/com/skyflow/utils/Constants.java @@ -0,0 +1,18 @@ +package com.skyflow.utils; + +public final class Constants extends BaseConstants { + public static final String SDK_NAME = "Skyflow Java SDK "; + public static final String SDK_VERSION = "3.0.0-beta.0"; + public static final String VAULT_DOMAIN = ".skyvault."; + public static final String SDK_PREFIX = SDK_NAME + SDK_VERSION; + public static final Integer INSERT_BATCH_SIZE = 50; + public static final Integer MAX_INSERT_BATCH_SIZE = 1000; + public static final Integer INSERT_CONCURRENCY_LIMIT = 10; + public static final Integer MAX_INSERT_CONCURRENCY_LIMIT = 10; + public static final Integer DETOKENIZE_BATCH_SIZE = 50; + public static final Integer DETOKENIZE_CONCURRENCY_LIMIT = 10; + + public static final Integer MAX_DETOKENIZE_BATCH_SIZE = 1000; + public static final Integer MAX_DETOKENIZE_CONCURRENCY_LIMIT = 10; + +} diff --git a/v3/src/main/java/com/skyflow/utils/Utils.java b/v3/src/main/java/com/skyflow/utils/Utils.java new file mode 100644 index 00000000..7bb8199b --- /dev/null +++ b/v3/src/main/java/com/skyflow/utils/Utils.java @@ -0,0 +1,231 @@ +package com.skyflow.utils; + +import com.google.gson.JsonObject; +import com.skyflow.enums.Env; +import com.skyflow.generated.rest.core.ApiClientApiException; +import com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest; +import com.skyflow.generated.rest.types.InsertRecordData; +import com.skyflow.generated.rest.types.InsertResponse; +import com.skyflow.generated.rest.types.RecordResponseObject; +import com.skyflow.generated.rest.types.TokenGroupRedactions; +import com.skyflow.vault.data.DetokenizeResponse; +import com.skyflow.vault.data.ErrorRecord; +import com.skyflow.vault.data.Success; +import com.skyflow.vault.data.Token; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public final class Utils extends BaseUtils { + + public static String getVaultURL(String clusterId, Env env) { + return getVaultURL(clusterId, env, Constants.VAULT_DOMAIN); + } + + public static JsonObject getMetrics() { + JsonObject details = getCommonMetrics(); + String sdkVersion = Constants.SDK_VERSION; + details.addProperty(Constants.SDK_METRIC_NAME_VERSION, Constants.SDK_METRIC_NAME_VERSION_PREFIX + sdkVersion); + return details; + } + + public static List> createBatches(List records, int batchSize) { + List> batches = new ArrayList<>(); + for (int i = 0; i < records.size(); i += batchSize) { + batches.add(records.subList(i, Math.min(i + batchSize, records.size()))); + } + return batches; + } + + public static List createDetokenizeBatches(DetokenizeRequest request, int batchSize) { + List detokenizeRequests = new ArrayList<>(); + List tokens = request.getTokens().get(); + + for (int i = 0; i < tokens.size(); i += batchSize) { + // Create a sublist for the current batch + List batchTokens = tokens.subList(i, Math.min(i + batchSize, tokens.size())); + List tokenGroupRedactions = null; + if (request.getTokenGroupRedactions().isPresent() && !request.getTokenGroupRedactions().get().isEmpty() && i < request.getTokenGroupRedactions().get().size()) { + tokenGroupRedactions = request.getTokenGroupRedactions().get().subList(i, Math.min(i + batchSize, request.getTokenGroupRedactions().get().size())); } + // Build a new DetokenizeRequest for the current batch + DetokenizeRequest batchRequest = DetokenizeRequest.builder() + .vaultId(request.getVaultId()) + .tokens(new ArrayList<>(batchTokens)) + .tokenGroupRedactions(tokenGroupRedactions) + .build(); + + detokenizeRequests.add(batchRequest); + } + + return detokenizeRequests; + } + + public static ErrorRecord createErrorRecord(Map recordMap, int indexNumber) { + ErrorRecord err = null; + if (recordMap != null) { + int code = recordMap.containsKey("http_code") ? (Integer) recordMap.get("http_code") : 500; + String message = recordMap.containsKey("error") ? (String) recordMap.get("error") : + recordMap.containsKey("message") ? (String) recordMap.get("message") : "Unknown error"; + err = new ErrorRecord(indexNumber, message, code); + } + return err; + } + + public static List handleBatchException( + Throwable ex, List batch, int batchNumber + ) { + List errorRecords = new ArrayList<>(); + Throwable cause = ex.getCause(); + if (cause instanceof ApiClientApiException) { + ApiClientApiException apiException = (ApiClientApiException) cause; + Map responseBody = (Map) apiException.body(); + int indexNumber = batchNumber > 0 ? batchNumber * batch.size() : 0; + if (responseBody != null) { + if (responseBody.containsKey("records")) { + Object recordss = responseBody.get("records"); + if (recordss instanceof List) { + List recordsList = (List) recordss; + for (Object record : recordsList) { + if (record instanceof Map) { + Map recordMap = (Map) record; + ErrorRecord err = Utils.createErrorRecord(recordMap, indexNumber); + errorRecords.add(err); + indexNumber++; + } + } + } + } else if (responseBody.containsKey("error")) { + Map recordMap = (Map) responseBody.get("error"); + for (int j = 0; j < batch.size(); j++) { + ErrorRecord err = Utils.createErrorRecord(recordMap, indexNumber); + errorRecords.add(err); + indexNumber++; + } + } + } + } else { + int indexNumber = batchNumber > 0 ? batchNumber * batch.size() : 0; + for (int j = 0; j < batch.size(); j++) { + ErrorRecord err = new ErrorRecord(indexNumber, ex.getMessage(), 500); + errorRecords.add(err); + indexNumber++; + } + } + return errorRecords; + } + + public static List handleDetokenizeBatchException( + Throwable ex, DetokenizeRequest batch, int batchNumber, int batchSize + ) { + List errorRecords = new ArrayList<>(); + Throwable cause = ex.getCause(); + if (cause instanceof ApiClientApiException) { + ApiClientApiException apiException = (ApiClientApiException) cause; + Map responseBody = (Map) apiException.body(); + int indexNumber = batchNumber * batchSize; + if (responseBody != null) { + if (responseBody.containsKey("records")) { + Object recordss = responseBody.get("records"); + if (recordss instanceof List) { + List recordsList = (List) recordss; + for (Object record : recordsList) { + if (record instanceof Map) { + Map recordMap = (Map) record; + ErrorRecord err = Utils.createErrorRecord(recordMap, indexNumber); + errorRecords.add(err); + indexNumber++; + } + } + } + } else if (responseBody.containsKey("error")) { + Map recordMap = (Map) responseBody.get("error"); + for (int j = 0; j < batch.getTokens().get().size(); j++) { + ErrorRecord err = Utils.createErrorRecord(recordMap, indexNumber); + errorRecords.add(err); + indexNumber++; + } + } + } + } else { + int indexNumber = batchNumber * batchSize; + for (int j = 0; j < batch.getTokens().get().size(); j++) { + ErrorRecord err = new ErrorRecord(indexNumber, ex.getMessage(), 500); + errorRecords.add(err); + indexNumber++; + } + } + return errorRecords; + } + + public static DetokenizeResponse formatDetokenizeResponse(com.skyflow.generated.rest.types.DetokenizeResponse response, int batch, int batchSize) { + if (response != null) { + List record = response.getResponse().get(); + List errorRecords = new ArrayList<>(); + List successRecords = new ArrayList<>(); + int indexNumber = batch * batchSize; + int recordsSize = response.getResponse().get().size(); + for (int index = 0; index < recordsSize; index++) { + if (record.get(index).getError().isPresent()) { + ErrorRecord errorRecord = new ErrorRecord(indexNumber, record.get(index).getError().get(), record.get(index).getHttpCode().get()); + errorRecords.add(errorRecord); + } else { + com.skyflow.vault.data.DetokenizeResponseObject success = new com.skyflow.vault.data.DetokenizeResponseObject(indexNumber, record.get(index).getToken().orElse(null), record.get(index).getValue().orElse(null), record.get(index).getTokenGroupName().orElse(null), record.get(index).getError().orElse(null), record.get(index).getMetadata().orElse(null)); + successRecords.add(success); + } + indexNumber++; + } + DetokenizeResponse formattedResponse = new DetokenizeResponse(successRecords, errorRecords); + return formattedResponse; + } + return null; + } + + public static com.skyflow.vault.data.InsertResponse formatResponse(InsertResponse response, int batch, int batchSize) { + com.skyflow.vault.data.InsertResponse formattedResponse = null; + List successRecords = new ArrayList<>(); + List errorRecords = new ArrayList<>(); + if (response != null) { + List record = response.getRecords().get(); + int indexNumber = batch * batchSize; + int recordsSize = response.getRecords().get().size(); + for (int index = 0; index < recordsSize; index++) { + if (record.get(index).getError().isPresent()) { + ErrorRecord errorRecord = new ErrorRecord(indexNumber, record.get(index).getError().get(), record.get(index).getHttpCode().get()); + errorRecords.add(errorRecord); + } else { + Map> tokensMap = null; + + if (record.get(index).getTokens().isPresent()) { + tokensMap = new HashMap<>(); + Map tok = record.get(index).getTokens().get(); + for (Map.Entry entry : tok.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + List tokenList = new ArrayList<>(); + if (value instanceof List) { + List valueList = (List) value; + for (Object item : valueList) { + if(item instanceof Map) { + Map tokenMap = (Map) item; + Token token = new Token((String) tokenMap.get("token"), (String) tokenMap.get("tokenGroupName")); + tokenList.add(token); + } + } + } + tokensMap.put(key, tokenList); + } + } + Success success = new Success(indexNumber, record.get(index).getSkyflowId().get(), tokensMap, record.get(index).getData().isPresent() ? record.get(index).getData().get() : null); + successRecords.add(success); + } + indexNumber++; + } + + formattedResponse = new com.skyflow.vault.data.InsertResponse(successRecords, errorRecords); + } + return formattedResponse; + } + +} diff --git a/v3/src/main/java/com/skyflow/utils/validations/Validations.java b/v3/src/main/java/com/skyflow/utils/validations/Validations.java new file mode 100644 index 00000000..b7ea4bbd --- /dev/null +++ b/v3/src/main/java/com/skyflow/utils/validations/Validations.java @@ -0,0 +1,121 @@ +package com.skyflow.utils.validations; + +import com.skyflow.enums.InterfaceName; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.logs.ErrorLogs; +import com.skyflow.utils.Utils; +import com.skyflow.utils.logger.LogUtil; +import com.skyflow.vault.data.DetokenizeRequest; +import com.skyflow.vault.data.InsertRequest; +import com.skyflow.vault.data.TokenGroupRedactions; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class Validations extends BaseValidations { + private Validations() { + super(); + } + + // add validations specific to v3 SDK + public static void validateInsertRequest(InsertRequest insertRequest) throws SkyflowException { + String table = insertRequest.getTable(); + ArrayList> values = insertRequest.getValues(); + List upsert = insertRequest.getUpsert(); + + if (table == null) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.TABLE_IS_REQUIRED.getLog(), InterfaceName.INSERT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.TableKeyError.getMessage()); + } else if (table.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_TABLE_NAME.getLog(), InterfaceName.INSERT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyTable.getMessage()); + } else if (values == null) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.VALUES_IS_REQUIRED.getLog(), InterfaceName.INSERT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.ValuesKeyError.getMessage()); + } else if (values.isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_VALUES.getLog(), InterfaceName.INSERT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyValues.getMessage()); + } else if (upsert != null && upsert.isEmpty()){ + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_UPSERT.getLog(), InterfaceName.INSERT.getName() + )); + } + // upsert + + for (HashMap valuesMap : values) { + for (String key : valuesMap.keySet()) { + if (key == null || key.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_OR_NULL_KEY_IN_VALUES.getLog(), InterfaceName.INSERT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyKeyInValues.getMessage()); + } else { + Object value = valuesMap.get(key); + if (value == null || value.toString().trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_OR_NULL_VALUE_IN_VALUES.getLog(), + InterfaceName.INSERT.getName(), key + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyValueInValues.getMessage()); + } + } + } + } + } + + public static void validateDetokenizeRequest(DetokenizeRequest request) throws SkyflowException { + if (request == null) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.DETOKENIZE_REQUEST_NULL.getLog(), InterfaceName.DETOKENIZE.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.DetokenizeRequestNull.getMessage()); + } + List tokens = request.getTokens(); + if (tokens == null || tokens.isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_DETOKENIZE_DATA.getLog(), InterfaceName.DETOKENIZE.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyDetokenizeData.getMessage()); + } + for (String token : tokens) { + if (token == null || token.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_OR_NULL_TOKEN_IN_DETOKENIZE_DATA.getLog(), InterfaceName.DETOKENIZE.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyTokenInDetokenizeData.getMessage()); + } + } + List groupRedactions = request.getTokenGroupRedactions(); + if (groupRedactions != null && !groupRedactions.isEmpty()) { + for (TokenGroupRedactions group : groupRedactions) { + if (group == null) { + LogUtil.printErrorLog(Utils.parameterizedString(ErrorLogs.NULL_TOKEN_REDACTION_GROUP_OBJECT.getLog(), InterfaceName.DETOKENIZE.getName())); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.NullTokenGroupRedactions.getMessage()); + } + String groupName = group.getTokenGroupName(); + String redaction = group.getRedaction(); + if (groupName == null || groupName.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString(ErrorLogs.NULL_TOKEN_GROUP_NAME_IN_TOKEN_GROUP.getLog(), InterfaceName.DETOKENIZE.getName())); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.NullTokenGroupNameInTokenGroup.getMessage()); + } + if (redaction == null || redaction.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString(ErrorLogs.EMPTY_OR_NULL_REDACTION_IN_TOKEN_GROUP.getLog(), InterfaceName.DETOKENIZE.getName())); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.NullRedactionInTokenGroup.getMessage()); + } + } + } + + } + +} diff --git a/v3/src/main/java/com/skyflow/vault/controller/VaultController.java b/v3/src/main/java/com/skyflow/vault/controller/VaultController.java new file mode 100644 index 00000000..fc8cc278 --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/controller/VaultController.java @@ -0,0 +1,401 @@ +package com.skyflow.vault.controller; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.skyflow.VaultClient; +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.errors.SkyflowException; +import com.skyflow.generated.rest.core.ApiClientApiException; +import com.skyflow.generated.rest.types.InsertRecordData; +import com.skyflow.generated.rest.types.InsertResponse; +import com.skyflow.logs.ErrorLogs; +import com.skyflow.logs.InfoLogs; +import com.skyflow.logs.WarningLogs; +import com.skyflow.utils.Constants; +import com.skyflow.utils.Utils; +import com.skyflow.utils.logger.LogUtil; +import com.skyflow.utils.validations.Validations; +import com.skyflow.vault.data.*; +import io.github.cdimascio.dotenv.Dotenv; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.*; + +import static com.skyflow.utils.Utils.*; + +public final class VaultController extends VaultClient { + private static final Gson gson = new GsonBuilder().serializeNulls().create(); + private int insertBatchSize; + private int insertConcurrencyLimit; + private int detokenizeBatchSize; + private int detokenizeConcurrencyLimit; + + public VaultController(VaultConfig vaultConfig, Credentials credentials) { + super(vaultConfig, credentials); + this.insertBatchSize = Constants.INSERT_BATCH_SIZE; + this.insertConcurrencyLimit = Constants.INSERT_CONCURRENCY_LIMIT; + this.detokenizeBatchSize = Constants.DETOKENIZE_BATCH_SIZE; + this.detokenizeConcurrencyLimit = Constants.DETOKENIZE_CONCURRENCY_LIMIT; + } + + public com.skyflow.vault.data.InsertResponse bulkInsert(InsertRequest insertRequest) throws SkyflowException { + com.skyflow.vault.data.InsertResponse response; + LogUtil.printInfoLog(InfoLogs.INSERT_TRIGGERED.getLog()); + try { + LogUtil.printInfoLog(InfoLogs.VALIDATE_INSERT_REQUEST.getLog()); + Validations.validateInsertRequest(insertRequest); + configureInsertConcurrencyAndBatchSize(insertRequest.getValues().size()); + setBearerToken(); + com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest request = super.getBulkInsertRequestBody(insertRequest, super.getVaultConfig()); + + response = this.processSync(request, insertRequest.getValues()); + return response; + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); + LogUtil.printErrorLog(ErrorLogs.INSERT_RECORDS_REJECTED.getLog()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); + } catch (ExecutionException | InterruptedException e) { + LogUtil.printErrorLog(ErrorLogs.INSERT_RECORDS_REJECTED.getLog()); + throw new SkyflowException(e.getMessage()); + } + } + + public CompletableFuture bulkInsertAsync(InsertRequest insertRequest) throws SkyflowException { + LogUtil.printInfoLog(InfoLogs.INSERT_TRIGGERED.getLog()); + try { + LogUtil.printInfoLog(InfoLogs.VALIDATE_INSERT_REQUEST.getLog()); + Validations.validateInsertRequest(insertRequest); + configureInsertConcurrencyAndBatchSize(insertRequest.getValues().size()); + setBearerToken(); + com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest request = super.getBulkInsertRequestBody(insertRequest, super.getVaultConfig()); + List errorRecords = Collections.synchronizedList(new ArrayList<>()); + List> futures = this.insertBatchFutures(request, errorRecords); + + return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .thenApply(v -> { + List successRecords = new ArrayList<>(); +// List errorRecords = new ArrayList<>(); + + for (CompletableFuture future : futures) { + com.skyflow.vault.data.InsertResponse futureResponse = future.join(); + if (futureResponse != null) { + if (futureResponse.getSuccess() != null) { + successRecords.addAll(futureResponse.getSuccess()); + } + if (futureResponse.getErrors() != null) { + errorRecords.addAll(futureResponse.getErrors()); + } + } + } + + return new com.skyflow.vault.data.InsertResponse(successRecords, errorRecords, insertRequest.getValues()); + }); + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); + LogUtil.printErrorLog(ErrorLogs.INSERT_RECORDS_REJECTED.getLog()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); + } + } + + public DetokenizeResponse bulkDetokenize(DetokenizeRequest detokenizeRequest) throws SkyflowException { + LogUtil.printInfoLog(InfoLogs.DETOKENIZE_TRIGGERED.getLog()); + try { + DetokenizeResponse response; + configureDetokenizeConcurrencyAndBatchSize(detokenizeRequest.getTokens().size()); + LogUtil.printInfoLog(InfoLogs.VALIDATE_DETOKENIZE_REQUEST.getLog()); + Validations.validateDetokenizeRequest(detokenizeRequest); + setBearerToken(); + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest request = super.getDetokenizeRequestBody(detokenizeRequest); + + response = this.processDetokenizeSync(request, detokenizeRequest.getTokens()); + return response; + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); + LogUtil.printErrorLog(ErrorLogs.DETOKENIZE_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); + } catch (ExecutionException | InterruptedException e) { + LogUtil.printErrorLog(ErrorLogs.DETOKENIZE_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.getMessage()); + } + } + + public CompletableFuture bulkDetokenizeAsync(DetokenizeRequest detokenizeRequest) throws SkyflowException{ + LogUtil.printInfoLog(InfoLogs.DETOKENIZE_TRIGGERED.getLog()); + ExecutorService executor = Executors.newFixedThreadPool(detokenizeConcurrencyLimit); + try { + configureDetokenizeConcurrencyAndBatchSize(detokenizeRequest.getTokens().size()); + LogUtil.printInfoLog(InfoLogs.VALIDATE_DETOKENIZE_REQUEST.getLog()); + Validations.validateDetokenizeRequest(detokenizeRequest); + setBearerToken(); + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest request = super.getDetokenizeRequestBody(detokenizeRequest); + + LogUtil.printInfoLog(InfoLogs.PROCESSING_BATCHES.getLog()); + + List errorTokens = Collections.synchronizedList(new ArrayList<>()); + List successRecords = new ArrayList<>(); + + // Create batches + List batches = Utils.createDetokenizeBatches(request, detokenizeBatchSize); + + List> futures = this.detokenizeBatchFutures(executor, batches, errorTokens); + return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .thenApply(v -> { + for (CompletableFuture future : futures) { + DetokenizeResponse futureResponse = future.join(); + if (futureResponse != null) { + if (futureResponse.getSuccess() != null) { + successRecords.addAll(futureResponse.getSuccess()); + } + if (futureResponse.getErrors() != null) { + errorTokens.addAll(futureResponse.getErrors()); + } + } + } + LogUtil.printInfoLog(InfoLogs.DETOKENIZE_REQUEST_RESOLVED.getLog()); + executor.shutdown(); + return new DetokenizeResponse(successRecords, errorTokens, detokenizeRequest.getTokens()); + }); + } catch (Exception e){ + LogUtil.printErrorLog(ErrorLogs.DETOKENIZE_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.getMessage()); + } finally { + executor.shutdown(); + } + } + private com.skyflow.vault.data.InsertResponse processSync( + com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest insertRequest, + ArrayList> originalPayload + ) throws ExecutionException, InterruptedException { + LogUtil.printInfoLog(InfoLogs.PROCESSING_BATCHES.getLog()); + List successRecords = new ArrayList<>(); + List errorRecords = Collections.synchronizedList(new ArrayList<>()); + List> futures = this.insertBatchFutures(insertRequest, errorRecords); + + CompletableFuture allFutures = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); + allFutures.join(); + + for (CompletableFuture future : futures) { + com.skyflow.vault.data.InsertResponse futureResponse = future.get(); + if (futureResponse != null) { + if (futureResponse.getSuccess() != null) { + successRecords.addAll(futureResponse.getSuccess()); + } + if (futureResponse.getErrors() != null) { + errorRecords.addAll(futureResponse.getErrors()); + } + } + } + com.skyflow.vault.data.InsertResponse response = new com.skyflow.vault.data.InsertResponse(successRecords, errorRecords, originalPayload); + LogUtil.printInfoLog(InfoLogs.INSERT_REQUEST_RESOLVED.getLog()); + return response; + } + + private DetokenizeResponse processDetokenizeSync( + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest detokenizeRequest, + List originalTokens + ) throws ExecutionException, InterruptedException, SkyflowException { + LogUtil.printInfoLog(InfoLogs.PROCESSING_BATCHES.getLog()); + List errorTokens = Collections.synchronizedList(new ArrayList<>()); + List successTokens = new ArrayList<>(); + ExecutorService executor = Executors.newFixedThreadPool(detokenizeConcurrencyLimit); + List batches = Utils.createDetokenizeBatches(detokenizeRequest, detokenizeBatchSize); + try { + List> futures = this.detokenizeBatchFutures(executor, batches, errorTokens); + try{ + + CompletableFuture allFutures = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); + allFutures.join(); + } catch (Exception e){ + } + for (CompletableFuture future : futures) { + DetokenizeResponse futureResponse = future.get(); + if (futureResponse != null) { + if (futureResponse.getSuccess() != null) { + successTokens.addAll(futureResponse.getSuccess()); + } + if (futureResponse.getErrors() != null) { + errorTokens.addAll(futureResponse.getErrors()); + } + } + } + } catch (Exception e){ + LogUtil.printErrorLog(ErrorLogs.DETOKENIZE_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.getMessage()); + } finally { + executor.shutdown(); + } + DetokenizeResponse response = new DetokenizeResponse(successTokens, errorTokens, originalTokens); + LogUtil.printInfoLog(InfoLogs.DETOKENIZE_REQUEST_RESOLVED.getLog()); + return response; + } + + private List> detokenizeBatchFutures(ExecutorService executor, List batches, List errorTokens) { + List> futures = new ArrayList<>(); + try { + + for (int batchIndex = 0; batchIndex < batches.size(); batchIndex++) { + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest batch = batches.get(batchIndex); + int batchNumber = batchIndex; + CompletableFuture future = CompletableFuture + .supplyAsync(() -> processDetokenizeBatch(batch), executor) + .thenApply(response -> formatDetokenizeResponse(response, batchNumber, detokenizeBatchSize)) + .exceptionally(ex -> { + errorTokens.addAll(handleDetokenizeBatchException(ex, batch, batchNumber, detokenizeBatchSize)); + return null; + }); + futures.add(future); + } + } catch (Exception e){ + ErrorRecord errorRecord = new ErrorRecord(0, e.getMessage(), 500); + errorTokens.add(errorRecord); + } + return futures; + } + private com.skyflow.generated.rest.types.DetokenizeResponse processDetokenizeBatch(com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest batch) { + return this.getRecordsApi().detokenize(batch); + } + + private List> + insertBatchFutures( + com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest insertRequest, + List errorRecords) { + List records = insertRequest.getRecords().get(); + + ExecutorService executor = Executors.newFixedThreadPool(insertConcurrencyLimit); + List> batches = Utils.createBatches(records, insertBatchSize); + List> futures = new ArrayList<>(); + + try { + for (int batchIndex = 0; batchIndex < batches.size(); batchIndex++) { + List batch = batches.get(batchIndex); + int batchNumber = batchIndex; + CompletableFuture future = CompletableFuture + .supplyAsync(() -> insertBatch(batch, insertRequest.getTableName().get()), executor) + .thenApply(response -> formatResponse(response, batchNumber, insertBatchSize)) + .exceptionally(ex -> { + errorRecords.addAll(handleBatchException(ex, batch, batchNumber)); + return null; + }); + futures.add(future); + } + } finally { + executor.shutdown(); + } + return futures; + } + + private InsertResponse insertBatch(List batch, String tableName) { + com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest req = com.skyflow.generated.rest.resources.recordservice.requests.InsertRequest.builder() + .vaultId(this.getVaultConfig().getVaultId()) + .tableName(tableName) + .records(batch) + .build(); + return this.getRecordsApi().insert(req); + } + + private void configureInsertConcurrencyAndBatchSize(int totalRequests) { + try { + Dotenv dotenv = Dotenv.load(); + String userProvidedBatchSize = dotenv.get("INSERT_BATCH_SIZE"); + String userProvidedConcurrencyLimit = dotenv.get("INSERT_CONCURRENCY_LIMIT"); + + if (userProvidedBatchSize != null) { + try { + int batchSize = Integer.parseInt(userProvidedBatchSize); + int maxBatchSize = Math.min(batchSize, Constants.MAX_INSERT_BATCH_SIZE); + if (maxBatchSize > 0) { + this.insertBatchSize = maxBatchSize; + } else { + LogUtil.printWarningLog(WarningLogs.INVALID_BATCH_SIZE_PROVIDED.getLog()); + this.insertBatchSize = Constants.INSERT_BATCH_SIZE; + } + } catch (NumberFormatException e) { + LogUtil.printWarningLog(WarningLogs.INVALID_BATCH_SIZE_PROVIDED.getLog()); + this.insertBatchSize = Constants.INSERT_BATCH_SIZE; + } + } + + // Max no of threads required to run all batches concurrently at once + int maxConcurrencyNeeded = (totalRequests + this.insertBatchSize - 1) / this.insertBatchSize; + + if (userProvidedConcurrencyLimit != null) { + try { + int concurrencyLimit = Integer.parseInt(userProvidedConcurrencyLimit); + int maxConcurrencyLimit = Math.min(concurrencyLimit, Constants.MAX_INSERT_CONCURRENCY_LIMIT); + + if (maxConcurrencyLimit > 0) { + this.insertConcurrencyLimit = Math.min(maxConcurrencyLimit, maxConcurrencyNeeded); + } else { + LogUtil.printWarningLog(WarningLogs.INVALID_CONCURRENCY_LIMIT_PROVIDED.getLog()); + this.insertConcurrencyLimit = Math.min(Constants.INSERT_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } catch (NumberFormatException e) { + LogUtil.printWarningLog(WarningLogs.INVALID_CONCURRENCY_LIMIT_PROVIDED.getLog()); + this.insertConcurrencyLimit = Math.min(Constants.INSERT_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } else { + this.insertConcurrencyLimit = Math.min(Constants.INSERT_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } catch (Exception e) { + this.insertBatchSize = Constants.INSERT_BATCH_SIZE; + int maxConcurrencyNeeded = (totalRequests + this.insertBatchSize - 1) / this.insertBatchSize; + this.insertConcurrencyLimit = Math.min(Constants.INSERT_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } + + + private void configureDetokenizeConcurrencyAndBatchSize(int totalRequests) { + try { + Dotenv dotenv = Dotenv.load(); + String userProvidedBatchSize = dotenv.get("DETOKENIZE_BATCH_SIZE"); + String userProvidedConcurrencyLimit = dotenv.get("DETOKENIZE_CONCURRENCY_LIMIT"); + + if (userProvidedBatchSize != null) { + try { + int batchSize = Integer.parseInt(userProvidedBatchSize); + int maxBatchSize = Math.min(batchSize, Constants.MAX_DETOKENIZE_BATCH_SIZE); + if (maxBatchSize > 0) { + this.detokenizeBatchSize = maxBatchSize; + } else { + LogUtil.printWarningLog(WarningLogs.INVALID_BATCH_SIZE_PROVIDED.getLog()); + this.detokenizeBatchSize = Constants.DETOKENIZE_BATCH_SIZE; + } + } catch (NumberFormatException e) { + LogUtil.printWarningLog(WarningLogs.INVALID_BATCH_SIZE_PROVIDED.getLog()); + this.detokenizeBatchSize = Constants.DETOKENIZE_BATCH_SIZE; + } + } + + // Max no of threads required to run all batches concurrently at once + int maxConcurrencyNeeded = (totalRequests + this.detokenizeBatchSize - 1) / this.detokenizeBatchSize; + + if (userProvidedConcurrencyLimit != null) { + try { + int concurrencyLimit = Integer.parseInt(userProvidedConcurrencyLimit); + int maxConcurrencyLimit = Math.min(concurrencyLimit, Constants.MAX_DETOKENIZE_CONCURRENCY_LIMIT); + + if (maxConcurrencyLimit > 0) { + this.detokenizeConcurrencyLimit = Math.min(maxConcurrencyLimit, maxConcurrencyNeeded); + } else { + LogUtil.printWarningLog(WarningLogs.INVALID_CONCURRENCY_LIMIT_PROVIDED.getLog()); + this.detokenizeConcurrencyLimit = Math.min(Constants.DETOKENIZE_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } catch (NumberFormatException e) { + LogUtil.printWarningLog(WarningLogs.INVALID_CONCURRENCY_LIMIT_PROVIDED.getLog()); + this.detokenizeConcurrencyLimit = Math.min(Constants.DETOKENIZE_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } else { + this.detokenizeConcurrencyLimit = Math.min(Constants.DETOKENIZE_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } catch (Exception e) { + this.detokenizeBatchSize = Constants.DETOKENIZE_BATCH_SIZE; + int maxConcurrencyNeeded = (totalRequests + this.detokenizeBatchSize - 1) / this.detokenizeBatchSize; + this.detokenizeConcurrencyLimit = Math.min(Constants.DETOKENIZE_CONCURRENCY_LIMIT, maxConcurrencyNeeded); + } + } + +} \ No newline at end of file diff --git a/v3/src/main/java/com/skyflow/vault/data/DetokenizeRequest.java b/v3/src/main/java/com/skyflow/vault/data/DetokenizeRequest.java new file mode 100644 index 00000000..93ba8b9b --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/DetokenizeRequest.java @@ -0,0 +1,42 @@ +package com.skyflow.vault.data; + +import java.util.ArrayList; +import java.util.List; + +public class DetokenizeRequest { + private final DetokenizeRequestBuilder builder; + private DetokenizeRequest(DetokenizeRequestBuilder builder){ + this.builder = builder; + } + + public static DetokenizeRequestBuilder builder(){ + return new DetokenizeRequestBuilder(); + } + public List getTokens(){ + return this.builder.tokens; + } + public List getTokenGroupRedactions(){ + return this.builder.tokenGroupRedactions; + } + + public static final class DetokenizeRequestBuilder{ + private List tokens; + + private List tokenGroupRedactions; + + public DetokenizeRequestBuilder tokens(List tokens){ + this.tokens = tokens; + return this; + } + public DetokenizeRequestBuilder tokenGroupRedactions(List tokenGroupRedactions){ + this.tokenGroupRedactions = tokenGroupRedactions; + return this; + } + public DetokenizeRequest build(){ + return new DetokenizeRequest(this); + } + + + } + +} diff --git a/v3/src/main/java/com/skyflow/vault/data/DetokenizeResponse.java b/v3/src/main/java/com/skyflow/vault/data/DetokenizeResponse.java new file mode 100644 index 00000000..b00817db --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/DetokenizeResponse.java @@ -0,0 +1,63 @@ +package com.skyflow.vault.data; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.annotations.Expose; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class DetokenizeResponse { + @Expose(serialize = true) + private List success; + @Expose(serialize = true) + private DetokenizeSummary summary; + + @Expose(serialize = true) + private List errors; + + private List originalPayload; + private List tokensToRetry; + + public DetokenizeResponse(List success, List errors) { + this.success = success; + this.summary = summary; + this.errors = errors; + } + + public DetokenizeResponse(List success, List errors, List originalPayload) { + this.success = success; + this.errors = errors; + this.originalPayload = originalPayload; + this.summary = new DetokenizeSummary(this.originalPayload.size(), this.success.size(), this.errors.size()); + } + + public List getTokensToRetry() { + if (tokensToRetry == null) { + tokensToRetry = new ArrayList<>(); + tokensToRetry = errors.stream() + .filter(error -> (error.getCode() >= 500 && error.getCode() <= 599) && error.getCode() != 529) + .map(errorRecord -> originalPayload.get(errorRecord.getIndex())) + .collect(Collectors.toList()); + } + return tokensToRetry; + } + + public List getSuccess() { + return success; + } + public DetokenizeSummary getSummary() { + return this.summary; + } + + public List getErrors() { + return this.errors; + } + @Override + public String toString() { + Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); + return gson.toJson(this); + } + +} diff --git a/v3/src/main/java/com/skyflow/vault/data/DetokenizeResponseObject.java b/v3/src/main/java/com/skyflow/vault/data/DetokenizeResponseObject.java new file mode 100644 index 00000000..f45e2724 --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/DetokenizeResponseObject.java @@ -0,0 +1,63 @@ +package com.skyflow.vault.data; + +import com.google.gson.Gson; +import com.google.gson.annotations.Expose; + +import java.util.Map; + +public class DetokenizeResponseObject { + @Expose(serialize = true) + private String token; + @Expose(serialize = true) + private Object value; + @Expose(serialize = true) + private String tokenGroupName; + @Expose(serialize = true) + private String error; + + @Expose(serialize = true) + private int index; + + @Expose(serialize = true) + private Map metadata; + + public DetokenizeResponseObject(int index, String token, Object value, String tokenGroupName, String error, Map metadata) { + this.token = token; + this.value = value; + this.tokenGroupName = tokenGroupName; + this.error = error; + this.metadata = metadata; + this.index = index; + } + + public String getToken() { + return token; + } + + public Object getValue() { + return value; + } + + public String getTokenGroupName() { + return tokenGroupName; + } + + public String getError() { + return error; + } + + public int getIndex() { + return index; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String toString() { + Gson gson = new Gson(); + return gson.toJson(this); + } + +} diff --git a/v3/src/main/java/com/skyflow/vault/data/DetokenizeSummary.java b/v3/src/main/java/com/skyflow/vault/data/DetokenizeSummary.java new file mode 100644 index 00000000..c86c1854 --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/DetokenizeSummary.java @@ -0,0 +1,40 @@ +package com.skyflow.vault.data; + +import com.google.gson.Gson; +import com.google.gson.annotations.Expose; + +public class DetokenizeSummary { + @Expose(serialize = true) + private int totalTokens; + @Expose(serialize = true) + private int totalDetokenized; + @Expose(serialize = true) + private int totalFailed; + + public DetokenizeSummary() { + } + + public DetokenizeSummary(int totalTokens, int totalDetokenized, int totalFailed) { + this.totalTokens = totalTokens; + this.totalDetokenized = totalDetokenized; + this.totalFailed = totalFailed; + } + + public int getTotalTokens() { + return totalTokens; + } + + public int getTotalDetokenized() { + return totalDetokenized; + } + + public int getTotalFailed() { + return totalFailed; + } + + @Override + public String toString() { + Gson gson = new Gson(); + return gson.toJson(this); + } +} diff --git a/v3/src/main/java/com/skyflow/vault/data/ErrorRecord.java b/v3/src/main/java/com/skyflow/vault/data/ErrorRecord.java new file mode 100644 index 00000000..9044f189 --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/ErrorRecord.java @@ -0,0 +1,39 @@ +package com.skyflow.vault.data; + +import com.google.gson.Gson; +import com.google.gson.annotations.Expose; + +public class ErrorRecord { + @Expose(serialize = true) + private int index; + @Expose(serialize = true) + private String error; + @Expose(serialize = true) + private int code; +// public ErrorRecord() { +// } + + public ErrorRecord(int index, String error, int code) { + this.index = index; + this.error = error; + this.code = code; + } + public String getError() { + return error; + } + + public int getCode() { + return code; + } + + public int getIndex() { + return index; + } + + + @Override + public String toString() { + Gson gson = new Gson(); + return gson.toJson(this); + } +} \ No newline at end of file diff --git a/v3/src/main/java/com/skyflow/vault/data/InsertRequest.java b/v3/src/main/java/com/skyflow/vault/data/InsertRequest.java new file mode 100644 index 00000000..732df960 --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/InsertRequest.java @@ -0,0 +1,64 @@ +package com.skyflow.vault.data; + +import com.skyflow.enums.UpdateType; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class InsertRequest extends BaseInsertRequest { + private final InsertRequestBuilder builder; + + private InsertRequest(InsertRequestBuilder builder) { + super(builder); + this.builder = builder; + } + + public static InsertRequestBuilder builder() { + return new InsertRequestBuilder(); + } + + public List getUpsert() { + return this.builder.upsert; + } + + public UpdateType getUpsertType() { + return this.builder.upsertType; + } + + public static final class InsertRequestBuilder extends BaseInsertRequestBuilder { + private List upsert; + + private UpdateType upsertType; + + private InsertRequestBuilder() { + super(); + } + + @Override + public InsertRequestBuilder table(String table) { + super.table(table); + return this; + } + + @Override + public InsertRequestBuilder values(ArrayList> values) { + super.values(values); + return this; + } + + public InsertRequestBuilder upsert(List upsert) { + this.upsert = upsert; + return this; + } + + public InsertRequestBuilder upsertType(UpdateType upsertType) { + this.upsertType = upsertType; + return this; + } + + public InsertRequest build() { + return new InsertRequest(this); + } + } +} diff --git a/v3/src/main/java/com/skyflow/vault/data/InsertResponse.java b/v3/src/main/java/com/skyflow/vault/data/InsertResponse.java new file mode 100644 index 00000000..a84e121c --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/InsertResponse.java @@ -0,0 +1,69 @@ +package com.skyflow.vault.data; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.annotations.Expose; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +public class InsertResponse { + // These members will be included in the toString() output + @Expose(serialize = true) + private Summary summary; + @Expose(serialize = true) + private List success; + @Expose(serialize = true) + private List errors; + + // Internal fields. Should not be included in toString() output + private ArrayList> originalPayload; + private ArrayList> recordsToRetry; + + public InsertResponse(List successRecords, List errorRecords) { + this.success = successRecords; + this.errors = errorRecords; + } + + public InsertResponse( + List successRecords, + List errorRecords, + ArrayList> originalPayload + ) { + this.success = successRecords; + this.errors = errorRecords; + this.originalPayload = originalPayload; + this.summary = new Summary(this.originalPayload.size(), this.success.size(), this.errors.size()); + } + + public Summary getSummary() { + return this.summary; + } + + public List getSuccess() { + return this.success; + } + + public List getErrors() { + return this.errors; + } + + public ArrayList> getRecordsToRetry() { + if (recordsToRetry == null) { + recordsToRetry = new ArrayList<>(); + recordsToRetry = errors.stream() + .filter(error -> (error.getCode() >= 500 && error.getCode() <= 599) && error.getCode() != 529) + .map(errorRecord -> originalPayload.get(errorRecord.getIndex())) + .collect(Collectors.toCollection(ArrayList::new)); + } + return recordsToRetry; + } + + @Override + public String toString() { + Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); + return gson.toJson(this); + } +} \ No newline at end of file diff --git a/v3/src/main/java/com/skyflow/vault/data/Success.java b/v3/src/main/java/com/skyflow/vault/data/Success.java new file mode 100644 index 00000000..db302e6c --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/Success.java @@ -0,0 +1,46 @@ +package com.skyflow.vault.data; +import com.google.gson.Gson; +import com.google.gson.annotations.Expose; + +import java.util.List; +import java.util.Map; + +public class Success { + @Expose(serialize = true) + private int index; + @Expose(serialize = true) + private String skyflow_id; + @Expose(serialize = true) + private Map> tokens; + @Expose(serialize = true) + private Map data; + + public int getIndex() { + return index; + } + + public Success(int index, String skyflow_id, Map> tokens, Map data) { + this.index = index; + this.skyflow_id = skyflow_id; + this.tokens = tokens; + this.data = data; + } + + public String getSkyflowId() { + return skyflow_id; + } + + public Map> getTokens() { + return tokens; + } + + public Map getData() { + return data; + } + + @Override + public String toString() { + Gson gson = new Gson(); + return gson.toJson(this); + } +} \ No newline at end of file diff --git a/v3/src/main/java/com/skyflow/vault/data/Summary.java b/v3/src/main/java/com/skyflow/vault/data/Summary.java new file mode 100644 index 00000000..c15db6cb --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/Summary.java @@ -0,0 +1,42 @@ +package com.skyflow.vault.data; + +import com.google.gson.Gson; +import com.google.gson.annotations.Expose; + +public class Summary { + @Expose(serialize = true) + private int totalRecords; + @Expose(serialize = true) + private int totalInserted; + @Expose(serialize = true) + private int totalFailed; + + public Summary() { + } + + public Summary(int totalRecords, int totalInserted, int totalFailed) { + this.totalRecords = totalRecords; + this.totalInserted = totalInserted; + this.totalFailed = totalFailed; + } + + public int getTotalRecords() { + return totalRecords; + } + + + public int getTotalInserted() { + return totalInserted; + } + + public int getTotalFailed() { + return totalFailed; + } + + + @Override + public String toString() { + Gson gson = new Gson(); + return gson.toJson(this); + } +} \ No newline at end of file diff --git a/v3/src/main/java/com/skyflow/vault/data/Token.java b/v3/src/main/java/com/skyflow/vault/data/Token.java new file mode 100644 index 00000000..642d62c4 --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/Token.java @@ -0,0 +1,23 @@ +package com.skyflow.vault.data; + +import com.google.gson.annotations.Expose; + +public class Token { + @Expose(serialize = true) + private String token; + @Expose(serialize = true) + private String tokenGroupName; + + public String getToken() { + return token; + } + + public String getTokenGroupName() { + return tokenGroupName; + } + + public Token(String token, String tokenGroupName) { + this.token = token; + this.tokenGroupName = tokenGroupName; + } +} \ No newline at end of file diff --git a/v3/src/main/java/com/skyflow/vault/data/TokenGroupRedactions.java b/v3/src/main/java/com/skyflow/vault/data/TokenGroupRedactions.java new file mode 100644 index 00000000..3f89014c --- /dev/null +++ b/v3/src/main/java/com/skyflow/vault/data/TokenGroupRedactions.java @@ -0,0 +1,39 @@ +package com.skyflow.vault.data; + +public class TokenGroupRedactions { + private final TokenGroupRedactionsBuilder builder; + + private TokenGroupRedactions(TokenGroupRedactionsBuilder builder) { + this.builder = builder; + } + public String getTokenGroupName() { + return this.builder.tokenGroupName; + } + + public String getRedaction() { + return this.builder.redaction; + } + + public static TokenGroupRedactionsBuilder builder() { + return new TokenGroupRedactionsBuilder(); + } + + public static final class TokenGroupRedactionsBuilder { + private String tokenGroupName; + private String redaction; + + public TokenGroupRedactionsBuilder tokenGroupName(String tokenGroupName) { + this.tokenGroupName = tokenGroupName; + return this; + } + + public TokenGroupRedactionsBuilder redaction(String redaction) { + this.redaction = redaction; + return this; + } + + public TokenGroupRedactions build() { + return new TokenGroupRedactions(this); + } + } +} \ No newline at end of file diff --git a/v3/test/java/com/skyflow/SkyflowTests.java b/v3/test/java/com/skyflow/SkyflowTests.java new file mode 100644 index 00000000..c003e5e9 --- /dev/null +++ b/v3/test/java/com/skyflow/SkyflowTests.java @@ -0,0 +1,92 @@ +package com.skyflow; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.Env; +import com.skyflow.enums.LogLevel; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class SkyflowTests { + private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; + private static final String EXCEPTION_NOT_THROWN = "Should have thrown an exception"; + private static String vaultID = null; + private static String clusterID = null; + private static String newClusterID = null; + private static String token = null; + private static String anotherToken = null; + + @BeforeClass + public static void setup() { + vaultID = "test_vault_id"; + clusterID = "test_cluster_id"; + newClusterID = "new_test_cluster_id"; + token = "test_token"; + anotherToken = "another_test_token"; + } + + @Test + public void testAddingInvalidVaultConfig() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(""); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + Skyflow.builder().addVaultConfig(config).build(); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.EmptyVaultId.getMessage(), e.getMessage()); + } + } + + @Test + public void testAddingAnotherVaultConfig() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(vaultID); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + Skyflow.builder().addVaultConfig(config).addVaultConfig(config).build(); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.VaultIdAlreadyInConfigList.getMessage(), e.getMessage()); + } + } + + @Test + public void testUpdatingValidVaultConfig() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(vaultID); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + + // Set the config + Skyflow skyflowClient = Skyflow.builder().addVaultConfig(config).build(); + + Credentials credentials = new Credentials(); + credentials.setToken(token); + + // Updating the config directly + config.setClusterId(newClusterID); + config.setEnv(Env.PROD); + config.setCredentials(credentials); + + Assert.assertNotEquals(newClusterID, skyflowClient.getVaultConfig().getClusterId()); + Assert.assertEquals(clusterID, skyflowClient.getVaultConfig().getClusterId()); + Assert.assertNotEquals(Env.PROD, skyflowClient.getVaultConfig().getEnv()); + Assert.assertEquals(Env.SANDBOX, skyflowClient.getVaultConfig().getEnv()); + Assert.assertNotEquals(credentials, skyflowClient.getVaultConfig().getCredentials()); + Assert.assertNull(skyflowClient.getVaultConfig().getCredentials()); + + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } +} diff --git a/v3/test/java/com/skyflow/VaultClientTests.java b/v3/test/java/com/skyflow/VaultClientTests.java new file mode 100644 index 00000000..c99d8a08 --- /dev/null +++ b/v3/test/java/com/skyflow/VaultClientTests.java @@ -0,0 +1,161 @@ +package com.skyflow; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.Env; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.SkyflowException; +import com.skyflow.generated.rest.resources.recordservice.RecordserviceClient; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; +import io.github.cdimascio.dotenv.Dotenv; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class VaultClientTests { + private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; + private static VaultClient vaultClient; + private static String vaultID = null; + private static String clusterID = null; + private static VaultConfig vaultConfig; + + @BeforeClass + public static void setup() throws SkyflowException { + vaultID = "vault123"; + clusterID = "cluster123"; + vaultConfig = new VaultConfig(); + vaultConfig.setVaultId(vaultID); + vaultConfig.setClusterId(clusterID); + vaultConfig.setEnv(Env.PROD); + + Credentials credentials = new Credentials(); + credentials.setApiKey("sky-ab123-abcd1234cdef1234abcd4321cdef4321"); + vaultConfig.setCredentials(credentials); + vaultClient = new VaultClient(vaultConfig, credentials); + vaultClient.setBearerToken(); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); + } + + @Test + public void testVaultClientGetRecordsAPI() { + try { + RecordserviceClient recordsClient = vaultClient.getRecordsApi(); + Assert.assertNotNull(recordsClient); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail(INVALID_EXCEPTION_THROWN + e.getMessage()); + } + } + + @Test + public void testVaultClientGetVaultConfig() { + try { + VaultConfig config = vaultClient.getVaultConfig(); + Assert.assertNotNull(config); + Assert.assertEquals(vaultID, config.getVaultId()); + Assert.assertEquals(clusterID, config.getClusterId()); + Assert.assertEquals(Env.PROD, config.getEnv()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testSetBearerToken() { + try { + Credentials credentials = new Credentials(); + credentials.setApiKey("sky-ab123-abcd1234cdef1234abcd4321cdef4321"); + vaultConfig.setCredentials(credentials); + vaultClient = new VaultClient(vaultConfig, credentials); + vaultClient.setBearerToken(); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN + ": " + e.getMessage()); + } + } + + @Test + public void testSetBearerTokenWithApiKey() { + try { + Credentials credentials = new Credentials(); + credentials.setApiKey("sky-ab123-abcd1234cdef1234abcd4321cdef4321"); // Use a non-null dummy API key +// vaultConfig.setCredentials(credentials); +// vaultClient.updateVaultConfig(); + vaultClient.setCommonCredentials(credentials); + + // regular scenario + vaultClient.setBearerToken(); + + // re-use scenario + vaultClient.setBearerToken(); + + // If no exception is thrown, the test passes + Assert.assertTrue(true); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN + ": " + e.getMessage()); + } + } + + @Test + public void testSetBearerTokenWithEnvCredentials() { + try { + Dotenv dotenv = Dotenv.load(); + Credentials credentials = new Credentials(); + credentials.setCredentialsString(dotenv.get("SKYFLOW_CREDENTIALS")); + + // no credentials set at vault config and skyflow levels + vaultConfig.setCredentials(null); + vaultClient.setCommonCredentials(null); + + vaultClient.setBearerToken(); + + // Credentials at ENV level should be prioritised + Assert.assertEquals(credentials, getPrivateField(vaultClient, "finalCredentials")); + + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + Assert.assertNull(vaultClient.getVaultConfig().getCredentials()); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testPrioritiseCredentialsWithVaultConfigCredentials() throws Exception { + // set credentials at vault config level + Credentials credentials = new Credentials(); + credentials.setApiKey("test_api_key"); + vaultConfig.setCredentials(credentials); + + // set credentials at skyflow level + Credentials commonCredentials = new Credentials(); + commonCredentials.setToken("test_common_token"); + vaultClient.setCommonCredentials(commonCredentials); + + // vault config credentials should be prioritised + Assert.assertEquals(credentials, getPrivateField(vaultClient, "finalCredentials")); + } + + @Test + public void testPrioritiseCredentialsWithCommonCredentials() throws Exception { + // no credentials in vault config level + vaultConfig.setCredentials(null); + + // set credentials at skyflow level + Credentials credentials = new Credentials(); + credentials.setApiKey("common_api_key"); + vaultClient.setCommonCredentials(credentials); + + // common credentials should be prioritised + Assert.assertEquals(credentials, getPrivateField(vaultClient, "finalCredentials")); + } + + // Helper methods for reflection field access + private Object getPrivateField(Object obj, String fieldName) throws Exception { + java.lang.reflect.Field field = obj.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + return field.get(obj); + } + +} diff --git a/v3/test/java/com/skyflow/utils/UtilsTests.java b/v3/test/java/com/skyflow/utils/UtilsTests.java new file mode 100644 index 00000000..d3780e83 --- /dev/null +++ b/v3/test/java/com/skyflow/utils/UtilsTests.java @@ -0,0 +1,828 @@ +package com.skyflow.utils; + +import com.google.gson.JsonObject; +import com.skyflow.config.Credentials; +import com.skyflow.enums.Env; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.generated.auth.rest.core.ApiClientApiException; +import com.skyflow.generated.rest.types.InsertRecordData; +import com.skyflow.generated.rest.types.InsertResponse; +import com.skyflow.generated.rest.types.RecordResponseObject; +import com.skyflow.utils.validations.Validations; +import com.skyflow.vault.data.*; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.*; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class UtilsTests { + private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; + private static final String EXCEPTIONNOTTHROWN = "Should have thrown an exception"; + private static String filePath = null; + private static String credentialsString = null; + private static String token = null; + private static String context = null; + private static ArrayList roles = null; + + @BeforeClass + public static void setup() { + filePath = "invalid/file/path/credentials.json"; + credentialsString = "invalid credentials string"; + token = "invalid-token"; + context = "testcontext"; + roles = new ArrayList<>(); + String role = "testrole"; + roles.add(role); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); + } + + @Test + public void testGetVaultURL() { + // Test with production environment + String prodUrl = Utils.getVaultURL("abc123", Env.PROD); + Assert.assertEquals( + "https://abc123.skyvault.skyflowapis.com", + prodUrl + ); + + // Test with development environment + String devUrl = Utils.getVaultURL("xyz789", Env.DEV); + Assert.assertEquals( + "https://xyz789.skyvault.skyflowapis.dev", + devUrl + ); + } + @Test(expected = NullPointerException.class) + public void testGetVaultURLWithNullEnv() { + Utils.getVaultURL("abc123", null); + } + + @Test + public void testGetVaultURLWithEmptyClusterId() { + String url = Utils.getVaultURL("", Env.PROD); + Assert.assertEquals( + "https://.skyvault.skyflowapis.com", + url + ); + } + + @Test + public void testGenerateBearerTokenWithCredentialsFile() { + try { + Credentials credentials = new Credentials(); + credentials.setPath(filePath); + credentials.setContext(context); + credentials.setRoles(roles); + Utils.generateBearerToken(credentials); + Assert.fail(EXCEPTIONNOTTHROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.FileNotFound.getMessage(), filePath), + e.getMessage() + ); + } + } + + @Test + public void testGenerateBearerTokenWithCredentialsString() { + try { + Credentials credentials = new Credentials(); + credentials.setCredentialsString(credentialsString); + credentials.setContext(context); + credentials.setRoles(roles); + Utils.generateBearerToken(credentials); + Assert.fail(EXCEPTIONNOTTHROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.CredentialsStringInvalidJson.getMessage(), e.getMessage()); + } + } + + @Test + public void testGenerateBearerTokenWithToken() { + try { + Credentials credentials = new Credentials(); + credentials.setToken(token); + credentials.setContext(context); + credentials.setRoles(roles); + String bearerToken = Utils.generateBearerToken(credentials); + Assert.assertEquals(token, bearerToken); + } catch (SkyflowException e) { + Assert.assertEquals(e.getMessage(), ErrorMessage.BearerTokenExpired.getMessage()); + } + } + + @Test + public void testGetMetrics() { + try { + JsonObject metrics = Utils.getMetrics(); + Assert.assertNotNull(metrics.get(Constants.SDK_METRIC_NAME_VERSION)); + Assert.assertNotNull(metrics.get(Constants.SDK_METRIC_CLIENT_DEVICE_MODEL)); + Assert.assertNotNull(metrics.get(Constants.SDK_METRIC_CLIENT_OS_DETAILS)); + Assert.assertNotNull(metrics.get(Constants.SDK_METRIC_RUNTIME_DETAILS)); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testGetMetricsWithException() { + try { + System.clearProperty("os.name"); + System.clearProperty("os.version"); + System.clearProperty("java.version"); + + String sdkVersion = Constants.SDK_VERSION; + JsonObject metrics = Utils.getMetrics(); + Assert.assertEquals("skyflow-java@" + sdkVersion, metrics.get(Constants.SDK_METRIC_NAME_VERSION).getAsString()); + Assert.assertEquals("Java@", metrics.get(Constants.SDK_METRIC_RUNTIME_DETAILS).getAsString()); + Assert.assertTrue(metrics.get(Constants.SDK_METRIC_CLIENT_DEVICE_MODEL).getAsString().isEmpty()); + Assert.assertTrue(metrics.get(Constants.SDK_METRIC_CLIENT_OS_DETAILS).getAsString().isEmpty()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testCreateBatchesMultipleBatches() { + List records = new ArrayList<>(); + for (int i = 0; i < 125; i++) { + records.add(InsertRecordData.builder().build()); + } + List> batches = Utils.createBatches(records, 50); + + Assert.assertEquals(3, batches.size()); + Assert.assertEquals(50, batches.get(0).size()); + Assert.assertEquals(50, batches.get(1).size()); + Assert.assertEquals(25, batches.get(2).size()); + } + + @Test + public void testCreateBatchesWithEmptyList() { + List records = new ArrayList<>(); + List> batches = Utils.createBatches(records, 50); + Assert.assertTrue("Batches should be empty for empty input", batches.isEmpty()); + } + + @Test + public void testCreateBatchesWithSmallerSizeThanBatch() { + List records = new ArrayList<>(); + for (int i = 0; i < 25; i++) { + records.add(InsertRecordData.builder().build()); + } + List> batches = Utils.createBatches(records, 50); + + Assert.assertEquals("Should create single batch", 1, batches.size()); + Assert.assertEquals("Batch should contain all records", 25, batches.get(0).size()); + } + + @Test + public void testCreateBatchesWithExactBatchSize() { + List records = new ArrayList<>(); + for (int i = 0; i < 50; i++) { + records.add(InsertRecordData.builder().build()); + } + List> batches = Utils.createBatches(records, 50); + + Assert.assertEquals("Should create single batch", 1, batches.size()); + Assert.assertEquals("Batch should have exact size", 50, batches.get(0).size()); + } + + @Test + public void testCreateBatchesPreservesOrder() { + List records = new ArrayList<>(); + for (int i = 0; i < 75; i++) { + InsertRecordData record = InsertRecordData.builder() + .data(Optional.of(Collections.singletonMap("id", String.valueOf(i)))) + .build(); + records.add(record); + } + + List> batches = Utils.createBatches(records, 50); + + Assert.assertEquals("Should create two batches", 2, batches.size()); + Assert.assertEquals("First record in first batch should be 0", + "0", batches.get(0).get(0).getData().get().get("id")); + Assert.assertEquals("First record in second batch should be 50", + "50", batches.get(1).get(0).getData().get().get("id")); + } + + @Test(expected = NullPointerException.class) + public void testCreateBatchesWithNullList() { + Utils.createBatches(null, 50); + } + + @Test + public void testCreateErrorRecord() { + Map recordMap = new HashMap<>(); + recordMap.put("error", "Test error"); + recordMap.put("message", "Test message"); + recordMap.put("http_code", 400); + + ErrorRecord error = Utils.createErrorRecord(recordMap, 1); + + Assert.assertEquals(1, error.getIndex()); + Assert.assertEquals("Test error", error.getError()); + Assert.assertEquals(400, error.getCode()); + } + + @Test + public void testHandleBatchExceptionApiClientExceptionWithSingleError() { + List batch = Arrays.asList(InsertRecordData.builder().build(), InsertRecordData.builder().build()); + List> batches = Collections.singletonList(batch); + + Map errorMap = new HashMap<>(); + errorMap.put("error", "Common error"); + errorMap.put("http_code", 403); + + Map responseBody = new HashMap<>(); + responseBody.put("error", errorMap); + + ApiClientApiException apiException = new ApiClientApiException("Forbidden", 403, responseBody); + Exception exception = new Exception("Test exception", apiException); + + List errors = Utils.handleBatchException(exception, batch, 0); + + Assert.assertEquals("Should have errors for all records", 2, errors.size()); + Assert.assertEquals("Error message should be same", "Test exception", errors.get(0).getError()); + Assert.assertEquals("Error code should be same", 500, errors.get(0).getCode()); + Assert.assertEquals("First error index", 0, errors.get(0).getIndex()); + Assert.assertEquals("Second error index", 1, errors.get(1).getIndex()); + } + + @Test + public void testHandleBatchExceptionWithNonApiClientException() { + List batch = Arrays.asList(InsertRecordData.builder().build(), InsertRecordData.builder().build()); + List> batches = Collections.singletonList(batch); + + RuntimeException exception = new RuntimeException("Unexpected error"); + + List errors = Utils.handleBatchException(exception, batch, 0); + + Assert.assertEquals("Should have errors for all records", 2, errors.size()); + Assert.assertEquals("Error message should match", "Unexpected error", errors.get(0).getError()); + Assert.assertEquals("Error code should be 500", 500, errors.get(0).getCode()); + Assert.assertEquals("First error index", 0, errors.get(0).getIndex()); + Assert.assertEquals("Second error index", 1, errors.get(1).getIndex()); + } + + @Test + public void testHandleBatchExceptionWithNonZeroBatchNumber() { + List batch = Arrays.asList(InsertRecordData.builder().build(), InsertRecordData.builder().build()); + List> batches = Arrays.asList(new ArrayList<>(), batch); + + RuntimeException exception = new RuntimeException("Batch error"); + + List errors = Utils.handleBatchException(exception, batch, 1); + + Assert.assertEquals("Should have errors for all records", 2, errors.size()); + Assert.assertEquals("First error index should be offset", 2, errors.get(0).getIndex()); + Assert.assertEquals("Second error index should be offset", 3, errors.get(1).getIndex()); + } + + @Test + public void testHandleBatchExceptionWithNullResponseBody() { + List batch = Arrays.asList(InsertRecordData.builder().build(), InsertRecordData.builder().build()); + List> batches = Collections.singletonList(batch); + + ApiClientApiException apiException = new ApiClientApiException("Bad Request", 400, null); + Exception exception = new Exception("Test exception", apiException); + + List errors = Utils.handleBatchException(exception, batch, 0); + Assert.assertEquals("Should return empty list for null response body", 2, errors.size()); + } + + @Test + public void testFormatResponseWithSuccessAndErrorRecords() { + RecordResponseObject successRecord = RecordResponseObject.builder() + .skyflowId(Optional.of("testId1")) + .error(Optional.empty()) + .build(); + RecordResponseObject errorRecord = RecordResponseObject.builder() + .error(Optional.of("Test error")) + .httpCode(Optional.of(400)) + .build(); + + InsertResponse response = InsertResponse.builder() + .records(Optional.of(Arrays.asList(successRecord, errorRecord))) + .build(); + + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 0, 50); + + Assert.assertNotNull(result.getSuccess()); + Assert.assertEquals(1, result.getSuccess().size()); + Assert.assertEquals("testId1", result.getSuccess().get(0).getSkyflowId()); + + Assert.assertNotNull(result.getErrors()); + Assert.assertEquals(1, result.getErrors().size()); + Assert.assertEquals("Test error", result.getErrors().get(0).getError()); + Assert.assertEquals(400, result.getErrors().get(0).getCode()); + } + + @Test + public void testFormatResponseWithNullResponse() { + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(null, 0, 50); + Assert.assertNull(result); + } + + @Test + public void testFormatResponseWithSuccessRecordsOnly() { + RecordResponseObject successRecord1 = RecordResponseObject.builder() + .skyflowId(Optional.of("id1")) + .error(Optional.empty()) + .build(); + RecordResponseObject successRecord2 = RecordResponseObject.builder() + .skyflowId(Optional.of("id2")) + .error(Optional.empty()) + .build(); + + InsertResponse response = InsertResponse.builder() + .records(Optional.of(Arrays.asList(successRecord1, successRecord2))) + .build(); + + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 0, 50); + + Assert.assertNotNull("Response should not be null", result); + Assert.assertEquals("Should have two success records", 2, result.getSuccess().size()); + Assert.assertEquals("First skyflow ID should match", "id1", result.getSuccess().get(0).getSkyflowId()); + Assert.assertEquals("Second skyflow ID should match", "id2", result.getSuccess().get(1).getSkyflowId()); + Assert.assertTrue("Error list should be empty", result.getErrors().isEmpty()); + } + + @Test + public void testFormatResponseWithErrorRecordsOnly() { + RecordResponseObject errorRecord1 = RecordResponseObject.builder() + .error(Optional.of("Error 1")) + .httpCode(Optional.of(400)) + .build(); + RecordResponseObject errorRecord2 = RecordResponseObject.builder() + .error(Optional.of("Error 2")) + .httpCode(Optional.of(500)) + .build(); + + InsertResponse response = InsertResponse.builder() + .records(Optional.of(Arrays.asList(errorRecord1, errorRecord2))) + .build(); + + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 0, 50); + + Assert.assertNotNull("Response should not be null", result); + Assert.assertEquals("Should have two error records", 2, result.getErrors().size()); + Assert.assertEquals("First error message should match", "Error 1", result.getErrors().get(0).getError()); + Assert.assertEquals("First error code should match", 400, result.getErrors().get(0).getCode()); + Assert.assertEquals("Second error message should match", "Error 2", result.getErrors().get(1).getError()); + Assert.assertEquals("Second error code should match", 500, result.getErrors().get(1).getCode()); + Assert.assertTrue("Success list should be empty", result.getSuccess().isEmpty()); + } + + @Test + public void testFormatResponseWithBatchOffset() { + RecordResponseObject successRecord = RecordResponseObject.builder() + .skyflowId(Optional.of("id1")) + .error(Optional.empty()) + .build(); + RecordResponseObject errorRecord = RecordResponseObject.builder() + .error(Optional.of("Error")) + .httpCode(Optional.of(400)) + .build(); + + InsertResponse response = InsertResponse.builder() + .records(Optional.of(Arrays.asList(successRecord, errorRecord))) + .build(); + + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 1, 50); + + Assert.assertNotNull("Response should not be null", result); + Assert.assertEquals("Should have correct index for error record", 51, result.getErrors().get(0).getIndex()); + } + + @Test + public void testFormatResponseWithEmptyRecords() { + InsertResponse response = InsertResponse.builder() + .records(Optional.of(new ArrayList<>())) + .build(); + + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 0, 50); + + Assert.assertNotNull("Response should not be null", result); + Assert.assertTrue("Success list should be empty", result.getSuccess().isEmpty()); + Assert.assertTrue("Error list should be empty", result.getErrors().isEmpty()); + } + + @Test + public void testFormatResponseWithTokens() { + Map tokens = new HashMap<>(); + tokens.put("field1", "token1"); + tokens.put("field2", "token2"); + + RecordResponseObject successRecord = RecordResponseObject.builder() + .skyflowId(Optional.of("id1")) + .tokens(Optional.of(tokens)) + .error(Optional.empty()) + .build(); + + InsertResponse response = InsertResponse.builder() + .records(Optional.of(Collections.singletonList(successRecord))) + .build(); + + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 0, 50); + + Assert.assertNotNull("Response should not be null", result); + Assert.assertEquals("Should have one success record", 1, result.getSuccess().size()); + Assert.assertEquals("Skyflow ID should match", "id1", result.getSuccess().get(0).getSkyflowId()); + } + @Test + public void testFormatResponseWithTokenListMapping() { + // Prepare test data + Map tokenData = new HashMap<>(); + List> tokenList = new ArrayList<>(); + Map tokenMap = new HashMap<>(); + tokenMap.put("token", "token123"); + tokenMap.put("tokenGroupName", "group1"); + tokenList.add(tokenMap); + tokenData.put("field1", tokenList); + + // Create success record with tokens + RecordResponseObject successRecord = RecordResponseObject.builder() + .skyflowId(Optional.of("id1")) + .tokens(Optional.of(tokenData)) + .error(Optional.empty()) + .build(); + + // Create response object + InsertResponse response = InsertResponse.builder() + .records(Optional.of(Collections.singletonList(successRecord))) + .build(); + + // Format response + com.skyflow.vault.data.InsertResponse result = Utils.formatResponse(response, 0, 50); + + // Assertions + Assert.assertNotNull("Response should not be null", result); + Assert.assertEquals("Should have one success record", 1, result.getSuccess().size()); + + Success successResult = result.getSuccess().get(0); + Assert.assertEquals("Skyflow ID should match", "id1", successResult.getSkyflowId()); + + Map> tokens = successResult.getTokens(); + Assert.assertNotNull("Tokens map should not be null", tokens); + Assert.assertTrue("Should contain field1", tokens.containsKey("field1")); + + List tokensList = tokens.get("field1"); + Assert.assertEquals("Should have one token", 1, tokensList.size()); + Assert.assertEquals("Token value should match", "token123", tokensList.get(0).getToken()); + Assert.assertEquals("Token group name should match", "group1", tokensList.get(0).getTokenGroupName()); + } + @Test + public void testHandleBatchExceptionWithRecordsInResponseBody() { + // Prepare test data + List batch = Arrays.asList( + InsertRecordData.builder().build(), + InsertRecordData.builder().build() + ); + List> batches = Collections.singletonList(batch); + + // Create nested records with errors + List> recordsList = new ArrayList<>(); + Map record1 = new HashMap<>(); + record1.put("error", "Error 1"); + record1.put("http_code", 400); + Map record2 = new HashMap<>(); + record2.put("error", "Error 2"); + record2.put("http_code", 401); + recordsList.add(record1); + recordsList.add(record2); + + // Create response body + Map responseBody = new HashMap<>(); + responseBody.put("records", recordsList); + + // Create API exception + ApiClientApiException apiException = new ApiClientApiException("Bad Request", 400, responseBody); + Exception exception = new Exception("Test exception", apiException); + + // Test the method + List errors = Utils.handleBatchException(exception, batch, 0); + + // Assertions + Assert.assertNotNull("Errors list should not be null", errors); + Assert.assertEquals("Should have two error records", 2, errors.size()); + + // Verify first error + Assert.assertEquals("First error message should match", "Test exception", errors.get(0).getError()); + Assert.assertEquals("First error code should match", 500, errors.get(0).getCode()); + Assert.assertEquals("First error index should be 0", 0, errors.get(0).getIndex()); + + // Verify second error + Assert.assertEquals("Second error message should match", "Test exception", errors.get(1).getError()); + Assert.assertEquals("Second error code should match", 500, errors.get(1).getCode()); + Assert.assertEquals("Second error index should be 1", 1, errors.get(1).getIndex()); + } + + @Test + public void testValidateDetokenizeRequestValidInput() throws SkyflowException { + ArrayList tokens = new ArrayList<>(); + tokens.add("token1"); + tokens.add("token2"); + + ArrayList groupRedactions = new ArrayList<>(); + groupRedactions.add(TokenGroupRedactions.builder() + .tokenGroupName("group1") + .redaction("MASK") + .build()); + + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(tokens) + .tokenGroupRedactions(groupRedactions) + .build(); + + Validations.validateDetokenizeRequest(request); // Should not throw an exception + } + + @Test + public void testValidateDetokenizeRequestNullRequest() { + try{ + Validations.validateDetokenizeRequest(null); + Assert.fail(EXCEPTIONNOTTHROWN); + } catch (SkyflowException e){ + assertEquals(e.getMessage(), ErrorMessage.DetokenizeRequestNull.getMessage()); + } + + } + + @Test + public void testValidateDetokenizeRequestEmptyTokens() { + try { + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(new ArrayList<>()) + .tokenGroupRedactions(new ArrayList<>()) + .build(); + + Validations.validateDetokenizeRequest(request); + + } catch (SkyflowException e){ + assertEquals(e.getMessage(), ErrorMessage.EmptyDetokenizeData.getMessage()); + } + } + + @Test + public void testValidateDetokenizeRequestNullTokenInList() { + ArrayList tokens = new ArrayList<>(); + tokens.add(null); + + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(tokens) + .tokenGroupRedactions(new ArrayList<>()) + .build(); + } + + @Test + public void testValidateDetokenizeRequestNullGroupRedactions() { + ArrayList tokens = new ArrayList<>(); + tokens.add("token1"); + + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(tokens) + .tokenGroupRedactions(null) + .build(); + try{ + Validations.validateDetokenizeRequest(request); + } catch (SkyflowException e){ + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testValidateDetokenizeRequestNullTokenGroupRedaction() { + ArrayList tokens = new ArrayList<>(); + tokens.add("token1"); + + ArrayList groupRedactions = new ArrayList<>(); + groupRedactions.add(null); + + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(tokens) + .tokenGroupRedactions(groupRedactions) + .build(); + try{ + Validations.validateDetokenizeRequest(request); + } catch (SkyflowException e){ + Assert.assertEquals(ErrorMessage.NullTokenGroupRedactions.getMessage(), e.getMessage());// + } + } + + @Test + public void testValidateDetokenizeRequestEmptyTokenGroupName() { + ArrayList tokens = new ArrayList<>(); + tokens.add("token1"); + + ArrayList groupRedactions = new ArrayList<>(); + groupRedactions.add(TokenGroupRedactions.builder() + .tokenGroupName("") + .redaction("MASK") + .build()); + + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(tokens) + .tokenGroupRedactions(groupRedactions) + .build(); + + try{ + Validations.validateDetokenizeRequest(request); + } catch (SkyflowException e){ + assertEquals(ErrorMessage.NullTokenGroupNameInTokenGroup.getMessage(), e.getMessage()); + } + } + + @Test + public void testValidateDetokenizeRequestEmptyRedaction() { + ArrayList tokens = new ArrayList<>(); + tokens.add("token1"); + + ArrayList groupRedactions = new ArrayList<>(); + groupRedactions.add(TokenGroupRedactions.builder() + .tokenGroupName("group1") + .redaction("") + .build()); + + DetokenizeRequest request = DetokenizeRequest.builder() + .tokens(tokens) + .tokenGroupRedactions(groupRedactions) + .build(); + + try { + Validations.validateDetokenizeRequest(request); + } catch (SkyflowException e){ + assertEquals(ErrorMessage.NullRedactionInTokenGroup.getMessage(), e.getMessage()); + } + } + + @Test + public void testValidateInsertRequestNullTable() { + ArrayList> values = new ArrayList<>(); + HashMap valueMap = new HashMap<>(); + valueMap.put("key1", "value1"); + values.add(valueMap); + + InsertRequest request = InsertRequest.builder() + .table(null) + .values(values) + .build(); + + try { + Validations.validateInsertRequest(request); + } catch (SkyflowException e) { + assertEquals(ErrorMessage.TableKeyError.getMessage(), e.getMessage()); // Replace with the actual error message + } + } + + @Test + public void testValidateInsertRequestEmptyTable() { + ArrayList> values = new ArrayList<>(); + HashMap valueMap = new HashMap<>(); + valueMap.put("key1", "value1"); + values.add(valueMap); + + InsertRequest request = InsertRequest.builder() + .table("") + .values(values) + .build(); + + try { + Validations.validateInsertRequest(request); + } catch (SkyflowException e) { + assertEquals(ErrorMessage.EmptyTable.getMessage(), e.getMessage()); // Replace with the actual error message + } + } + + @Test + public void testValidateInsertRequestNullValues() { + InsertRequest request = InsertRequest.builder() + .table("testTable") + .values(null) + .build(); + + try { + Validations.validateInsertRequest(request); + } catch (SkyflowException e) { + assertEquals(ErrorMessage.ValuesKeyError.getMessage(), e.getMessage()); // Replace with the actual error message + } + } + + @Test + public void testValidateInsertRequestEmptyValues() { + InsertRequest request = InsertRequest.builder() + .table("testTable") + .values(new ArrayList<>()) + .build(); + + try { + Validations.validateInsertRequest(request); + } catch (SkyflowException e) { + assertEquals(ErrorMessage.EmptyValues.getMessage(), e.getMessage()); // Replace with the actual error message + } + } + + + @Test + public void testFormatDetokenizeResponseValidResponse() { + // Arrange + List responseObjectsGen = new ArrayList<>(); + Map tokens = new HashMap<>(); + tokens.put("token1", "value1"); + tokens.put("token2", "value2"); + com.skyflow.generated.rest.types.DetokenizeResponseObject object = com.skyflow.generated.rest.types.DetokenizeResponseObject.builder().token("token1").value("value1").tokenGroupName("demo").build(); + responseObjectsGen.add(object); + responseObjectsGen.add(object); + + com.skyflow.generated.rest.types.DetokenizeResponse response = com.skyflow.generated.rest.types.DetokenizeResponse.builder().response(Optional.of(responseObjectsGen)).build(); + + int batch = 0; + int batchSize = 2; + + // Act + DetokenizeResponse result = Utils.formatDetokenizeResponse(response, batch, batchSize); + + // Assert + Assert.assertNotNull(result); + Assert.assertEquals(2, result.getSuccess().size()); + Assert.assertEquals(0, result.getErrors().size()); + } + + @Test + public void testFormatDetokenizeResponseResponseWithErrors() { + + + List responseObjectsGen = new ArrayList<>(); + com.skyflow.generated.rest.types.DetokenizeResponseObject object = com.skyflow.generated.rest.types.DetokenizeResponseObject.builder().error("Error occurred").httpCode(400).build(); + com.skyflow.generated.rest.types.DetokenizeResponseObject object2 = com.skyflow.generated.rest.types.DetokenizeResponseObject.builder().token("token1").tokenGroupName("demo").value("hello").build(); + + responseObjectsGen.add(object); + responseObjectsGen.add(object2); + + com.skyflow.generated.rest.types.DetokenizeResponse response = com.skyflow.generated.rest.types.DetokenizeResponse.builder().response(Optional.of(responseObjectsGen)).build(); + + int batch = 1; + int batchSize = 2; + + // Act + DetokenizeResponse result = Utils.formatDetokenizeResponse(response, batch, batchSize); + + // Assert + assertEquals(1, result.getSuccess().size()); + assertEquals(1, result.getErrors().size()); + assertEquals("Error occurred", result.getErrors().get(0).getError()); + } + + @Test + public void testFormatDetokenizeResponse_NullResponse() { + // Act + DetokenizeResponse result = Utils.formatDetokenizeResponse(null, 0, 2); + + // Assert + Assert.assertNull(result); + } + + public static List createDetokenizeBatches(com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest request, int batchSize) { + List detokenizeRequests = new ArrayList<>(); + List tokens = request.getTokens().get(); + + for (int i = 0; i < tokens.size(); i += batchSize) { + // Create a sublist for the current batch + List batchTokens = tokens.subList(i, Math.min(i + batchSize, tokens.size())); + List tokenGroupRedactions = null; + if (request.getTokenGroupRedactions().isPresent() && !request.getTokenGroupRedactions().get().isEmpty() && i < request.getTokenGroupRedactions().get().size()) { + tokenGroupRedactions = request.getTokenGroupRedactions().get().subList(i, Math.min(i + batchSize, request.getTokenGroupRedactions().get().size())); } + // Build a new DetokenizeRequest for the current batch + com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest batchRequest = com.skyflow.generated.rest.resources.recordservice.requests.DetokenizeRequest.builder() + .vaultId(request.getVaultId()) + .tokens(new ArrayList<>(batchTokens)) + .tokenGroupRedactions(tokenGroupRedactions) + .build(); + + detokenizeRequests.add(batchRequest); + } + + return detokenizeRequests; + } + + + private DetokenizeResponseObject createResponseObject(String token, String value, String groupName, String error, Integer httpCode) { + DetokenizeResponseObject responseObject = new DetokenizeResponseObject( + 0, + String.valueOf(Optional.ofNullable(token)), + Optional.ofNullable(value), + String.valueOf(Optional.ofNullable(groupName)), + String.valueOf(Optional.ofNullable(error)), + null + );return responseObject; + } + +} \ No newline at end of file diff --git a/v3/test/java/com/skyflow/vault/controller/VaultControllerTests.java b/v3/test/java/com/skyflow/vault/controller/VaultControllerTests.java new file mode 100644 index 00000000..7ffa1d3a --- /dev/null +++ b/v3/test/java/com/skyflow/vault/controller/VaultControllerTests.java @@ -0,0 +1,373 @@ +package com.skyflow.vault.controller; + +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.validations.Validations; +import com.skyflow.vault.data.InsertRequest; +import org.junit.*; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.Field; +import java.util.*; +import static org.junit.Assert.*; + + +public class VaultControllerTests { + private static final String ENV_PATH = "/home/saib/skyflow3/skyflow-java/v3/.env"; + + private VaultConfig vaultConfig; + private Credentials credentials; + + @Before + public void setUp() { + vaultConfig = new VaultConfig(); + vaultConfig.setVaultId("vault123"); + vaultConfig.setClusterId("cluster123"); + vaultConfig.setEnv(com.skyflow.enums.Env.DEV); + + credentials = new Credentials(); + credentials.setToken("valid-token"); + vaultConfig.setCredentials(credentials); + + writeEnv("INSERT_BATCH_SIZE=50\nINSERT_CONCURRENCY_LIMIT=10"); + } + + @After + public void tearDown() { + // Optionally clean up .env file + writeEnv(""); // or restore to default + } + + private void writeEnv(String content) { + try (FileWriter writer = new FileWriter(ENV_PATH)) { + writer.write(content); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private VaultController createController() { + return new VaultController(vaultConfig, credentials); + } + + // Helper to set private fields via reflection + private void setPrivateField(Object obj, String field, Object value) throws Exception { + Field f = obj.getClass().getDeclaredField(field); + f.setAccessible(true); + f.set(obj, value); + } + + private void invokeConfigureInsertConcurrencyAndBatchSize(VaultController controller, int totalRequests) throws Exception { + Method method = VaultController.class.getDeclaredMethod("configureInsertConcurrencyAndBatchSize", int.class); + method.setAccessible(true); + method.invoke(controller, totalRequests); + } + + private ArrayList> generateValues(int noOfRecords){ + ArrayList> values = new ArrayList<>(); + for (int i = 0; i < noOfRecords; i++) { + values.add(new HashMap<>()); + } + + return values; + } + + @Test + public void testValidation_tableIsNull() { + InsertRequest req = InsertRequest.builder().table(null).values(generateValues(1)).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for null table"); + } catch (SkyflowException e) { + assertTrue(!e.getMessage().isEmpty()); + } + } + + @Test + public void testValidation_tableIsEmpty() { + InsertRequest req = InsertRequest.builder().table(" ").values(generateValues(1)).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for empty table"); + } catch (SkyflowException e) { + assertTrue(!e.getMessage().isEmpty()); + } + } + + @Test + public void testValidation_valuesIsNull() { + InsertRequest req = InsertRequest.builder().table("table1").values(null).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for null values"); + } catch (SkyflowException e) { + assertTrue(!e.getMessage().isEmpty()); + } + } + + @Test + public void testValidation_valuesIsEmpty() { + InsertRequest req = InsertRequest.builder().table("table1").values(new ArrayList<>()).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for empty values"); + } catch (SkyflowException e) { + assertFalse(e.getMessage().isEmpty()); + } + } + + @Test + public void testValidation_upsertIsEmpty() throws SkyflowException { + InsertRequest req = InsertRequest.builder().table("table1").values(generateValues(1)).upsert(new ArrayList<>()).build(); + // Should not throw, just logs a warning + Validations.validateInsertRequest(req); + } + + + @Test + public void testValidation_keyIsNullOrEmpty() { + ArrayList> values = new ArrayList<>(); + HashMap map = new HashMap<>(); + map.put(null, "value"); + values.add(map); + InsertRequest req = InsertRequest.builder().table("table1").values(values).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for null key in values"); + } catch (SkyflowException e) { + assertFalse(e.getMessage().isEmpty()); + } + + // Test empty key + values.clear(); + map = new HashMap<>(); + map.put(" ", "value"); + values.add(map); + req = InsertRequest.builder().table("table1").values(values).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for empty key in values"); + } catch (SkyflowException e) { + assertFalse(e.getMessage().isEmpty()); + } + } + + @Test + public void testValidation_valueIsNullOrEmpty() { + ArrayList> values = new ArrayList<>(); + HashMap map = new HashMap<>(); + map.put("field1", null); + values.add(map); + InsertRequest req = InsertRequest.builder().table("table1").values(values).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for null value in values"); + } catch (SkyflowException e) { + assertFalse(e.getMessage().isEmpty()); + } + + // Test empty value + values.clear(); + map = new HashMap<>(); + map.put("field1", " "); + values.add(map); + req = InsertRequest.builder().table("table1").values(values).build(); + try { + Validations.validateInsertRequest(req); + fail("Expected SkyflowException for empty value in values"); + } catch (SkyflowException e) { + assertFalse(e.getMessage().isEmpty()); + } + } + + @Test + public void testDefaultValues() throws Exception { + VaultController controller = createController(); + setPrivateField(controller, "insertBatchSize", Constants.INSERT_BATCH_SIZE); + setPrivateField(controller, "insertConcurrencyLimit", Constants.INSERT_CONCURRENCY_LIMIT); + + invokeConfigureInsertConcurrencyAndBatchSize(controller, 10); + assertEquals(Constants.INSERT_BATCH_SIZE.intValue(), getPrivateInt(controller, "insertBatchSize")); + assertEquals(Math.min(Constants.INSERT_CONCURRENCY_LIMIT, (10 + Constants.INSERT_BATCH_SIZE - 1) / Constants.INSERT_BATCH_SIZE), + getPrivateInt(controller, "insertConcurrencyLimit")); + } + + @Test + public void testCustomValidBatchAndConcurrency() throws Exception { + writeEnv("INSERT_BATCH_SIZE=5\nINSERT_CONCURRENCY_LIMIT=3"); + VaultController controller = createController(); + + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(20)).build(); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + assertEquals(5, getPrivateInt(controller, "insertBatchSize")); + assertEquals(3, getPrivateInt(controller, "insertConcurrencyLimit")); + } + + @Test + public void testBatchSizeExceedsMax() throws Exception { + writeEnv("INSERT_BATCH_SIZE=1100\nINSERT_CONCURRENCY_LIMIT=3"); + VaultController controller = createController(); + + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(50)).build(); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + assertEquals(1000, getPrivateInt(controller, "insertBatchSize")); + } + + @Test + public void testConcurrencyExceedsMax() throws Exception { + writeEnv("INSERT_CONCURRENCY_LIMIT=110"); + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(50)).build(); + + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + assertEquals(1, getPrivateInt(controller, "insertConcurrencyLimit")); + } + + @Test + public void testBatchSizeZeroOrNegative() throws Exception { + writeEnv("INSERT_BATCH_SIZE=0"); + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(10)).build(); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + assertEquals(50, getPrivateInt(controller, "insertBatchSize")); + + writeEnv("INSERT_BATCH_SIZE=-5"); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + assertEquals(50, getPrivateInt(controller, "insertBatchSize")); + } + + @Test + public void testConcurrencyZeroOrNegative() throws Exception { + writeEnv("INSERT_CONCURRENCY_LIMIT=0"); + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(10)).build(); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + int min = Math.min(Constants.INSERT_CONCURRENCY_LIMIT, (10 + Constants.INSERT_BATCH_SIZE - 1) / Constants.INSERT_BATCH_SIZE); + assertEquals(min, getPrivateInt(controller, "insertConcurrencyLimit")); + + + + + writeEnv("INSERT_CONCURRENCY_LIMIT=-5"); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + min = Math.min(Constants.INSERT_CONCURRENCY_LIMIT, (10 + Constants.INSERT_BATCH_SIZE - 1) / Constants.INSERT_BATCH_SIZE); + assertEquals(min, getPrivateInt(controller, "insertConcurrencyLimit")); + } + + + @Test + public void testTotalRequestsLessThanBatchSize() throws Exception { + writeEnv("INSERT_BATCH_SIZE=100\nINSERT_CONCURRENCY_LIMIT=10"); + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(10)).build(); + + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) { + // Ignore, Testing concurrency/batch config + } + + assertEquals(100, getPrivateInt(controller, "insertBatchSize")); + assertEquals(1, getPrivateInt(controller, "insertConcurrencyLimit")); + } + + @Test + public void testTotalRequestsZero() throws Exception { + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(0)).build(); + + boolean exceptionThrown = false; + + try { + + controller.bulkInsert(insertRequest); + } catch (Exception e) { + exceptionThrown = true; + } + assertTrue("Exception should be thrown for zero records", exceptionThrown); + } + + + @Test + public void testHighConcurrencyForLowRecords() throws Exception { + writeEnv("INSERT_BATCH_SIZE=1000\nINSERT_CONCURRENCY_LIMIT=100"); + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(10000)).build(); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) {} + + // Only 10 batches needed, so concurrency should be clamped to 10 + assertEquals(1000, getPrivateInt(controller, "insertBatchSize")); + assertEquals(10, getPrivateInt(controller, "insertConcurrencyLimit")); + } + + + @Test + public void testFractionalLastBatch() throws Exception { + writeEnv("INSERT_BATCH_SIZE=100"); + VaultController controller = createController(); + InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(10050)).build(); + + try { + controller.bulkInsert(insertRequest); + } catch (Exception ignored) {} + + // Last batch should have 50 records, concurrency should be 101 + assertEquals(100, getPrivateInt(controller, "insertBatchSize")); + assertEquals(10, getPrivateInt(controller, "insertConcurrencyLimit")); + } + + private int getPrivateInt(Object obj, String field) throws Exception { + Field f = obj.getClass().getDeclaredField(field); + f.setAccessible(true); + return f.getInt(obj); + } +} \ No newline at end of file diff --git a/v3/test/java/com/skyflow/vault/data/InsertTests.java b/v3/test/java/com/skyflow/vault/data/InsertTests.java new file mode 100644 index 00000000..7ea17d89 --- /dev/null +++ b/v3/test/java/com/skyflow/vault/data/InsertTests.java @@ -0,0 +1,267 @@ +package com.skyflow.vault.data; + +import com.skyflow.Skyflow; +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.Env; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.SdkVersion; +import com.skyflow.utils.Utils; +import com.skyflow.utils.validations.Validations; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class InsertTests { + private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; + private static final String EXCEPTION_NOT_THROWN = "Should have thrown an exception"; + private static final String requestId = "95be08fc-4d13-4335-8b8d-24e85d53ed1d"; + private static String vaultID = null; + private static String clusterID = null; + private static String table = null; + private static ArrayList> values = null; + private static ArrayList> tokens = null; + private static HashMap valueMap = null; + private static HashMap tokenMap = null; + private static List upsert = new ArrayList<>(); + private static Skyflow skyflowClient = null; + + @BeforeClass + public static void setup() { + + vaultID = "vault123"; + clusterID = "cluster123"; + + Credentials credentials = new Credentials(); + credentials.setToken("valid-token"); + + VaultConfig vaultConfig = new VaultConfig(); + vaultConfig.setVaultId(vaultID); + vaultConfig.setClusterId(clusterID); + vaultConfig.setEnv(Env.DEV); + vaultConfig.setCredentials(credentials); + + table = "test_table"; + values = new ArrayList<>(); + tokens = new ArrayList<>(); + valueMap = new HashMap<>(); + tokenMap = new HashMap<>(); + upsert.add("upsert_column"); + SdkVersion.setSdkPrefix(Constants.SDK_PREFIX); + } + + @Before + public void setupTest() { + values.clear(); + tokens.clear(); + valueMap.clear(); + valueMap.put("test_column_1", "test_value_1"); + valueMap.put("test_column_2", "test_value_2"); + tokenMap.clear(); + tokenMap.put("test_column_1", "test_token_1"); + } + + @Test + public void testValidInputInInsertRequestValidations() { + try { + values.add(valueMap); + tokens.add(tokenMap); + + InsertRequest request = InsertRequest.builder() + .table(table) + .upsert(upsert) + .values(values) + .build(); + Validations.validateInsertRequest(request); + + Assert.assertEquals(table, request.getTable()); + Assert.assertEquals(upsert, request.getUpsert()); + Assert.assertEquals(1, request.getValues().size()); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testValidInputInInsertRequestValidationsWithTokenModeDisable() { + try { + values.add(valueMap); + tokens.add(tokenMap); + InsertRequest request = InsertRequest.builder() + .table(table) + .upsert(upsert) + .values(values) + .build(); + Validations.validateInsertRequest(request); + + Assert.assertEquals(table, request.getTable()); + Assert.assertEquals(upsert, request.getUpsert()); + Assert.assertEquals(1, request.getValues().size()); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testNoTableInInsertRequestValidations() { + InsertRequest request = InsertRequest.builder().build(); + try { + Validations.validateInsertRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.TableKeyError.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testEmptyTableInInsertRequestValidations() { + InsertRequest request = InsertRequest.builder().table("").build(); + try { + Validations.validateInsertRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.EmptyTable.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testNoValuesInInsertRequestValidations() { + InsertRequest request = InsertRequest.builder().table(table).build(); + try { + Validations.validateInsertRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.ValuesKeyError.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testEmptyValuesInInsertRequestValidations() { + InsertRequest request = InsertRequest.builder().table(table).values(values).build(); + try { + Validations.validateInsertRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.EmptyValues.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testEmptyKeyInValuesInInsertRequestValidations() { + valueMap.put("", "test_value_3"); + values.add(valueMap); + InsertRequest request = InsertRequest.builder().table(table).values(values).build(); + try { + Validations.validateInsertRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.EmptyKeyInValues.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testEmptyValueInValuesInInsertRequestValidations() { + valueMap.put("test_column_3", ""); + values.add(valueMap); + InsertRequest request = InsertRequest.builder().table(table).values(values).build(); + try { + Validations.validateInsertRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.EmptyValueInValues.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testEmptyUpsertInInsertRequestValidations() { + values.add(valueMap); + InsertRequest request = InsertRequest.builder().table(table).values(values).upsert(new ArrayList<>()).build(); + try { + Validations.validateInsertRequest(request); +// Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.EmptyUpsert.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + } + } + + @Test + public void testInsertResponse() { + try { + Map value = new HashMap<>(); + value.put("test_column_1", "test_value_1"); + Success success = new Success(0, "id", null, null); + + List successList = new ArrayList<>(); + successList.add(success); + InsertResponse response = new InsertResponse(successList, null); + String responseString = "{\"success\":[{\"index\":0,\"skyflow_id\":\"id\"}]}"; + Assert.assertEquals(1, response.getSuccess().size()); + Assert.assertNull(response.getErrors()); + Assert.assertEquals(responseString, response.toString()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testInsertErrorResponse() { + try { + HashMap value = new HashMap<>(); + value.put("test_column_1", "test_value_1"); + Success success = new Success(0, "id", null, value); + + List successList = new ArrayList<>(); + successList.add(success); + + List errorList = new ArrayList<>(); + ErrorRecord error = new ErrorRecord(1, "Bad Request", 400); + errorList.add(error); + + InsertResponse response1 = new InsertResponse(successList, errorList); + String responseString = "{\"success\":[{\"index\":0,\"skyflow_id\":\"id\",\"data\":{\"test_column_1\":\"test_value_1\"}}],\"errors\":[{\"index\":1,\"error\":\"Bad Request\",\"code\":400}]}"; + Assert.assertEquals(1, response1.getSuccess().size()); + Assert.assertEquals(1, response1.getErrors().size()); + Assert.assertEquals(responseString, response1.toString()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + +} diff --git a/v3/v3.iml b/v3/v3.iml new file mode 100644 index 00000000..c23533a1 --- /dev/null +++ b/v3/v3.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file